https://platformengineering.org logo
Title
j

James Caffey

11/13/2022, 1:56 PM
Hey platform engineers! I’m glad to have have found this community and slack channel. I am working on building a “Rosetta Stone” of IaC for Django + Vue.js applications on AWS using ECS Fargate. I’m building GitHub Actions pipelines that launch the same application infrastructure with CDK, Terraform and Pulumi. I’ll post some more details in this thread, but looking forward to meeting others in this slack group who are tackling similar issues!
- I’m building libraries for each IaC tool (Terraform/CDK/Pulumi) and calling these libraries to deploy my sample application - I am deploying a Django + Vue sample microblogging application that I’m using for demonstration (ublog) - The sample app adheres to the 12Factor methodology - It uses a static frontend site, an API service, a worker service (celery) and a task scheduling service (celery beat) - It makes use of RDS Postgres, ElastiCache Redis and S3 for file storage (blog posts can have images) - I am using GitHub Actions to build pipelines for IaC deployments - The application update process is separate from the infrastructure updated process, and it also uses GitHub Actions - The application update process involves deploying new container images to an ECS cluster and using the AWS CLI to invoke
run-task
for database migrations and other tasks to be executed before starting a rolling update - The Infrastructure as Code (Terraform/Pulumi/CDK) code is broken out into separate logical units - A base unit (defines networking, persistent data services, IAM, etc.) - An app stack (defines ECS resources) - I will likely break these logical units into smaller, more focused units in the future once I get a strong handle on all three IaC and how to deploy them in a consistent way - Each IaC library supports two types of environments: production environments and ad hoc environments - Production environments make use of application autoscaling and dedicated RDS and ElastiCache resources and are suitable for use in production environments and a small number of production-like pre-production environments (such as stage, rc, qa for example) - Ad hoc environments use a shared VPC, load balancer and RDS instance and are meant to be made available to developers on-demand through a self-service internal developer platform (IDP)
https://github.com/briancaffey/cdk-django (CDK Construct library) https://github.com/briancaffey/terraform-aws-django (Terraform Modules) https://github.com/briancaffey/pulumi-aws-django (WIP Pulumi Component) https://github.com/briancaffey/django-step-by-step (sample microblogging application monorepo that includes GitHub Actions for infra + app deployments)
I have been been working a lot on the concept of “ad hoc environments” (an IDP using shared resources that developers can use for on-demand/self-service environments). I wrote about that here: https://briancaffey.github.io/2022/03/27/ad-hoc-developer-environments-for-django-with-aws-ecs-terraform-and-github-actions/ Soon I’m aiming to write the second version of this article with a lot of my recent learnings and insights from this slack!