Business-critical applications need to be continuously available, 24X7. How do you ensure that your applications do not go down during version upgradations and deployments? A single downtime scenario during system maintenance might impact your business significantly. Choosing a viable strategy to mitigate risk is always better than taking a chance! Blue-Green deployment strategy rules out the possibility of your software/applications going haywire.
What is Blue-Green Deployment Strategy?
Blue-Green deployment strategy depends on two similar production configurations that alternate between active and inactive. Itreduces the risk of deployment failures into the production environment. The current live/active production environment can be indicated as ‘Blue’ while a parallel/standby environment is also created and named as ‘Green’ into which and the verified code would be deployed. As long as there is no requirement for rollbacks, the "Blue" environment is maintained as it is. Once the deployment is ready, a simple network change turns over the active and idle environments.
How does Blue-Green Deployment Strategy work?
Applications are divided into stateless and stateful as per the storage of memory or data of the past, so are their deployment strategies based on their compatibility. In general, the stateless (with no memory of the past) applications are comparably easier to manage, deploy and monitor when compared to a stateful (with the memory of the past) app for which the deployment strategy is complex, and needs to be devised for every phase of deployment.
There are two methods to database changes:
- Backward Compatibility - is dealt by the Blue-Green deployment strategy. It ensures forward or backward compatibility of data. It gives a suggested solution to perform zero downtime deployment and maintain backward compatibility in parallel.
- Backward Incompatibility – is handled by the Blue-Maintenance-Green deployment strategy, which we call as Blue-Gray-Green deployment strategy. It gives a warning to not to try to perform zero downtime deployment without some planning. Blue-Gray-Green deployment strategy enables to make changes to the database.
A case in point
Let's call the Production environment which is live right now as ‘Blue’. During deployment, create a new instance of the old production environment ‘Green’ into which all the deployment is done. The idea is to test the performance of the application on ‘Green’ environment - if everything is working as intended. The load balancing is done at the TCP level or using a widely used BIG-IP Load balancer.
- Blue-Green Deployment: The load balancing is to be done to both Blue and Green initially. The Blue instance can be used for a rollback operation which is equally important and gives you a built-in approach for all your deployment processes. Gradually the original ‘Blue’ instance will subside due to the lack of traffic, and ‘Green’ will only remain as the single instance.
- Blue-Gray-Green Deployment: If back-end schema changes need to be made, a full-fledged rollback might not happen but there is a need for viable deployment and rollback strategy in Microservices as thousands of services operate at the same time. One way of resolving this issue is to divide the application into backward compatible and backward incompatible deployments. The backward incompatible applications or deployments are divided into three layers and changes can be made at the backend of the UI layer.
This approach is the key for the live environment which has thousands of services which need to be continuously available. However, it would be difficult in the case of polling-based applications where a server streams data to an application, and a number of users would be pulling the same information at the same time.
To sum it up, Blue-Green deployment strategy is the need of the hour. Although it has been coming into the limelight at a snail's pace, it has a lot of potential in terms of achieving zero downtimewhile implementing agile methodologies like Continuous Delivery and Continuous Deployment. We at AutoRABIT can help you with your deployment challenges. Contact us at firstname.lastname@example.org for further information.