Deploy a containerized API into a staging environment in a public cloud automatically whenever new commits are integrated into the main branch.
Stack:
- Cloud Platform: AWS
- Code Hosting Platform: GitHub
- CI/CD Tool: Jenkins with Jenkins Pipeline
- Infrastructure Management Tool: Terraform
- Configuration Management Tool: Ansible
- Image Management Tool: Packer
- Container Build Tool: Docker
- API: Express.js
- Staging Environment for Jenkins: EC2 instance
- Staging Environment for API: ECS Fargate with ALB and application auto-scaling
- Amazon Linux 2 AMI (HVM)
- Ansible
- Terraform
- Jenkins with plugins ("GIT", "Pipeline", and "Pipeline: AWS Steps") + AWS Credentials + 1 Jenkins Job for the API
- Docker
- AWS CLI
- AWS CLI profile named devops_cicd (see "profile" in the packer configuration). Permission needed: EC2.
- If the user devops_cicd has no default vpc, set a VPC and subnet IDs manually in the packer configuration.
./packer/build.sh <jenkins_user_aws_access_key_id> <jenkins_user_aws_secret_access_key>
Note: the access key will be replaced by an IAM role soon
- S3 bucket to store the Terraform state (see "bucket" in the staging configuration).
- AWS CLI profile named devops_cicd (see "profile" in the terraform configuration). Permissions needed: S3, VPC, and EC2.
./terraform/run.sh staging init
./terraform/run.sh staging deploy
See the repository devops_demoapp.