Deployment Policy to Ensure Zero Downtime — Blue Green Deployment
Today I’ll discuss how can we rollout deployment on production environment keeping in mind high availability of services and zero downtime. There are quite few techniques we can use for this purpose. Today we will discuss Blue Green Deployment or Red Black Deployment. In my opinion is a fancy word simple deployment policy.
Blue Green Deployment
The basic idea in blue green deployment is that you run the two applications side by side one with old build and other with latest build. As we have some overview that what’s blue green deployment is, now let’s have a deep dive in the process of blue green deployment.
Say we have a blue server with old running build). And want to deploy new build on production environment. Create a replica a green server () on our production servers. deploy the new build on a server and say it green server. Once the build is deployed, run a smoke or sanity test to verify that everything in working fine. Now when you are sure that everything is good with the new build (green server), let’s roll it out for the users. Now here we can use two strategies to roll out new release. One thing that is important is you should keep both the server up and running for some time to fall back to the previous release in case of any issue with the new release on green server.
- Redirect all the users to new green server.
- Gradually roll out the new release, i.e redirect some percentage of users to the green server to make sure that new build working fine. One verified, increase the load on green server.
Checklist for Blue Green Deployment
Here is the checklist for blue green deployment that you should maintain
- You have two server up and running (with new and old builds)
- run sanity tests on server with new build
- Route some traffic to the new server for gradual roll out.
- Route all the traffic to the new server (with latest build)
- Keep the old server for some time for rolling back in case of some issue with new production build.
Final Words
We can achieve this using managed service of AWS if we our servers are hosted on AWS, for routing we can use Route53. But if the servers are in a data center and there is no managed service, then we need to have some strategy for the deployment to of the new release. And Blue Green Deployment strategy is a good option. For routing purpose we can utilize our load balancer or any other service.