Manual deployment can be a pain especially when you have to deploy multiple times a day. One of the new projects I am working on at the moment is hosted on AWS ECS, and I found myself manually updating docker images in ECR and ECS service tasks via AWS console.
Amazon Elastic Container Service (Amazon ECS) is a fully managed container orchestration service. It supports Fargate to provide serverless compute for containers and removes the need to provision and manage servers. See more in https://aws.amazon.com/ecs.
That was really inefficient so I started to research on which continuous deploy tool for this project. I have experience working with CircleCI and AWS CodePipeline, but this time I needed to find a different way. I wanted to use a simple, fast and cheap CD tool. CodePipeline tends to be more complex than other tools to setup and doesn't have native support for a multi-branch deploy workflow. I had a better experience with CircleCI, but it felt burdensome to request and wait for approval from my company's billing department.
GitHub Actions met all the checks. It's fully integrated in GitHub and doesn't use any external tools. Also, it's free. Sort of. 2,000 Actions minutes/month for Free, 3,000 Actions minutes/month for Team and 50,000 Actions minutes/month for Enterprise plan.
Below is the a diagram I created to explain the continuous deployment workflow I am using for this project.
- Developer pushes code
- GitHub Action runs tests and linter tools
If they pass, GitHub Action builds and pushes new docker image to ECR
- If code is pushed to dev branch, a new dev image is built and uploaded
- If code is pushed to master branch, a new master image is built and uploaded
- After image is uploaded successfully, GitHub Action updates ECS service tasks.
Before implementing this GitHub Action, I had to go through these steps manually:
- Build a docker image
- Upload the image to ECR
- Update the task associated with this ECS service
- Force deploy the service