Deep Dive into Continuous Delivery of Microservices on AWS
The goal of this project is to enable developers play with continuous delivery of microservices on Awazon Web Services (AWS) cloud. Those planning to do startups could get tips and code samples to get started with development, testing and releasing (continuously deploying) the software thereby gaining the competitive edge for their products.
The project would demonstrate some of the following:
- Developers check-in the code into the code repository such as GitLab.
- GitLab webhook triggers the Jenkins job
- Jenkins job starts with getting code from repository, build the code, run the unit tests/integration
- Once build and tests run successfully, Jenkins build the image for microservices and push the same to either of Dockerhub or AWS ECR (EC2 Container Registry).
- After the docker image for microservices is pushed to the image repository, following is done to deploy microservices (would run within containers) on AWS EC2 Container Service (ECS) Cluster or AWS Elastic Beanstalk (EB).
- AWS ECS Cluster: For deploying to ECS cluster, a new task definition is registered and the ECS service is updated. As a result of updating ECS service, the container using microservices image (pulled from image repository) gets started.
- AWS Elastic Beanstalk: For deploying the microservices on AWS EB, the execution of EB Cli command related with deployment is executed which leads to starting of container (with microservice image) on EC2 instance on AWS EB environment.
This project is intended to provide information related with some of the following topics.
1. Setup Gitlab and Jenkins
2. Setup Dockerhub, AWS ECR
3. Containerize Springboot Microservice
4. Continuous Delivery using AWS ECS
5. Continuous Delivery using AWS Elastic Beanstalk
Setup Gitlab and Jenkins
The first step is to get setup with the development envitonment. We shall use Docker images for GitLab and Jenkins and, Docker-compose for starting/commissioning the environment. Once environment is commissioned, it would be required to login into both GitLab and Jenkins to do some of the following:
-
GitLab: Ceate code repository
-
Jenkins:Install plugins,configure system, create job, configure job etc.
Read further details on this page, Jenkins Gitlab with Docker Containers
Setup Dockerhub and AWS account
Next step is to create your account with image repository such as Dockerhub and AWS ECR.
- Dockerhub: Go to Dockerhub and get signed up. You will be using this credentials from within Jenkins to login to Dockerhub and push the images.
- AWS: Go to AWS and get signed up.
Containerize Springboot Microservice
Springboot can be used to create microservice and Docker containers can be used to containerize them. Read further details on this page, Containerize Springboot Microservice
Continuous Delivery of Microservices on AWS using AWS ECS
AWS EC2 Container Service (ECS) is a highly scalable container management service which is used to start, stop and run microservices within Docker containers on AWS EC2 instances. In this project, it is demonstrated as to how to deploy container-based microservices using CLI commands from within Jenkins. As part of getting setup with ECS, following needs to be done:
- Create a repository (EC2 Repository - ECR)
- Create a task definition
- Create an ECS cluster
- Create a service
Following represents the solution architecture of deploying microservices on AWS using AWS ECS.
Read further details on this page, Continuous Delivery of Microservices with AWS ECS
Continuous Delivery of Microservices on AWS using AWS Elastic Beanstalk
AWS Elastic Beanstalk service is used to deploy and scale web applications and services developed with Java, .NET, PHP, Nodejs, Python, Ruby, Go and Docker on servers such as Apache, Tomcat, Nginx etc. All one is required to do is simply upload their code and Elastic Beanstalk does some of the following aspect of deployment:
- Capacity provisioning
- Load balancing
- Auto-scaling
- Application-health monitoring
Following represents the solution architecture of deploying microservices on AWS using AWS Elastic Beanstalk based on single container docker configurations. Note that Docker platform for Elastic Beanstalk supports two generic configurations such as single container and multicontainer.
Read further details on this page, Continuous delivery of Microservices on AWS using AWS Elastic Beanstalk