Deployment is the process of updating code and other activities on the server to make software available for use.
In the current situation, there is an increase in demand for continuous deployment to stay current with software updates, so as to provide the user with good quality application experience. There are many techniques available in the market for this, and in this article, we will be discussing about Blue Green Deployment.
Blue Green Deployment is a software release model that consists of two identical production environments; Blue and Green, configured in a way where one environment is live and the other is in staging (idle) state.
The idea behind this is to redirect traffic between two environments running with a different version of the application.
This process eliminates downtime and reduces the risk that happens due to deployment. In case any error occurs with the new version, we can immediately roll back to the stable version by swapping the environment.
In some organizations, it is also termed as Red Black Deployment.
To implement Blue-Green deployment, there should be two identical environments. Also, this requires Router or Load Balancer so that traffic can be routed to the desired environment.
In the image, we have two production environments, Blue and Green. The Blue environment is one where current (let's say version 1) of the application is running and is live as well. All the traffic of the application is directed to Blue by Router or load balancer (as per the infra set up). Meanwhile, version 2 of the application is deployed and tested on Green Environment.
Currently, at this stage, we can refer to Blue environment as Live and Green as idle or at staging state.
Once the code for version 2 is tested and ready to be live for production, we redirect the traffic from Blue Environment to Green Environment, making Green as Live and Blue as a staging environment. If any problem is detected with the Infrastructure or application after version 2 is made live, we can roll back to the previous version just by swapping the environment.
Blue Green deployment matches all requirements of seamless, safe and fully reversible conditions for ideal deployment, but there are some practices that need to be adopted for smooth process, for eg. automating the workflow so that there is minimum human intervention, reducing chances of manual error.
Along with that, it is also important to keep monitoring in place for Blue Green application.
Based upon infrastructure and application, there are various services i.e. Docker, Kubernetes, Cloud, Cloudfoundry etc available which can be used to implement Blue-Green Deployment.
We will be discussing further on Blue Green deployment on Cloud and the steps to implement it.
The advent of cloud computing in deployment has helped the system to reduce associated risks.
Cloud utilities of infra management, billing and automation have made it easier to implement Blue-Green Deployment, making it a quicker task at a lower cost.
By utilizing AWS for Blue-Green Deployment, we can access many services that help in automation of deployment and infrastructure i.e. AWS CLI, SDK, ELB, Elastic Beanstalk, CloudFormation etc. There are a number of solutions that AWS provides which we can use, some of them being:
We will discuss Using Elastic Beanstalk and swapping Application in detail:
Elastic Beanstalk provides us with the ease in deployment. Once we upload application code with some version on Elastic Beanstalk and provide information about application, it deploys our application in Blue Environment and provide its URL.
The above Environment configuration is then copied and used to launch the new version of application-i.e. Green Environment with its different and own URL.
This point of time our application is Up with two environments but traffic is going only to Blue Environment.
For Switching the environment to Green and serving traffic to it, we need to choose other Environment details from Elastic Beanstalk Console and Swap it using Action menu. It leads Elastic Beanstalk to perform DNS Switch and once DNS changes are done, we can terminate Blue Environment. In this way, traffic will be redirected to Green Environment.
For Rollback, we need to invoke the Switch Environment URL again.
Blue-Green Deployment provides us with minimum Down Time and reliable deployment.
Blue-Green Deployment has become useful in deploying an application for Development Teams, but it can be used under the below scenarios:
There are a number of deployment techniques being used in the industry to deploy the application. As a DevOps Engineer, it becomes important to know the insights about different techniques based on our infrastructure providing and choose the right technique as per the impact on the end-user.
Since many people are heading toward Blue-Green Deployment, there are some cases where this process is not recommended.
In some cases, it involves risk which makes deployment more prone to failure and breakdown.
Blue Green deployment is one of favourable technique to deploy application . Since every deployment technique and application has its own pros and cons , therefore team should collaborate and work on choosing the right deployment technique for their application according to tools, and services used to host your application.
For deployment technique to work on, there is no fixed approach that will suit and work in every scenario. there should be extensive research before settling for any deployment technique.
Your email address will not be published. Required fields are marked *