This blog post illustrate development cycle using django app container. I assume readers are already somewhat familar with docker and docker-compose. Although I used django for app development, it is language-agnostic since the post is about containerized application deployment.
Walkthough is devided into three parts consisting three different environemt respectively. First part, describes the architecture of the app(api and async worker) and how they are deployed on local
enviroment. Second part is how to deploy the docker containers on cloud using single ec2 instance with on staging
environment. Third part, illustrate how to convert traditional ec2 deployment into ECS using fargate with github actions on prod
environment.
local
- run docker containers on desktop/laptop with sqlite and redis server using docker-compose
stating
- run docker containers on single ec2 instance with mysql RDS and ElasticCache
prod
- convert stagning setup to ECS Fargate
Before going straight to ECS deployment, we will setup up a staging
env to test the application using ec2 compute instance and other AWS cloud services. If you are familar with AWS infra and confident with ecs setup, you can skip this part. However I will be using same vpc, redis and mysql for production
env so it would be worth while to take a look at the setup. (you should use different vpc, redis and mysql for your actual production
deployment)
The staging
cloud architecture will consist following AWS services.
Refer to the cloudformation for detailed configurations.
UPDATE(2020/11/05) :
I have replaced cloudformation and terraform with AWS CDK. Please refer to following link
https://github.com/kokospapa8/ecs-fargate-sample-app/tree/master/config/cdk