FoxuTech

What Is Blue-Green Deployment?

Blue-green deployment

There are most of the organization has been followed/ing the Blue-Green Deployment and have proved it as safe method for continuous deployment.

Software deployment is one of the critical parts of software development, if there is any issue, it may lead to lot of issues, like downtime or you may have to spend more time to troubleshoot, which may lead your users to not able to access the feature. In case if you have automated the release process and scheduled it on weekend or late night, if there is any issue, you may need to spend your precious time on troubleshooting.

Well, there are lot of ways we can overcome this by following some best deployment practice’s available. But there are lot of it, like canary, blue-green, etc., it will be hard to find which suits for our environment to achieve minimal or zero downtime. Today, lets learn about blue-green deployment, and coming posts will see about other available deployments, so it will be easy to choose the best solution which fits your requirement.

Blue-Green Deployment

A blue/green deployment is an application deployment strategy in which you create two separate, but identical environments. One environment (blue) is running the current application version and one environment (green) is running the new or to-be application version.

Using a blue/green deployment strategy increases application availability and reduces deployment risk by simplifying the rollback process if a deployment fails. Once testing has been completed on the green environment, live application traffic can be directed to the green environment and the blue environment can kept idle for some time and then we can retire it.  

How Blue-Green Deployments Works?

Why Blue-green? Does that fulfil all our requirement? Well yes, it fulfils most of standard processes part of deployment.

The basis of the blue-green method is side-by-side deployments. For that, we need two separate but identical environments. And I mean environment in the most general way, including servers, VMs, containers, configurations, databases, among other things. Sometimes we can use different boxes or we can use separate VMs running on the same hardware or it can be different containers running in a same machine.

In simple term, we need to duplicate all the resources in our deployment side, like we need to build two independent production environments.

But sometime it is hard to keep two different environments with all the resources, as production contains a greater number of depended resources. Replicating and keeping them updated will be another set of challenge in large setup, so in that, you could see, most of the blue-green deployment environment contains shared resources as following.

As we have two environments now, it is time to plan for switching the connection between environments. For that we may need some load balancer or router or proxy server to switch it. You can find the below example; this will help to route the traffic between different versions/environments.

Blue and green take turns to play the role of production. Only one of the environments is live at any given time. Say, for instance, that blue is active. In that case, it receives all the traffic—meanwhile, green acts as a staging area, where we can deploy and test the next version.

Users continue accessing v1 on blue while the new v2 release is deployed on green.

Once we make sure the version running in green is working well, we’ll switch the route. Then the cycle begins again.

Deployment is complete once users are switched to the new version running on green.

The Cloud Makes Blue-Green Deployments More Feasible

When we speak about two separate environments, it will add most cost for the organization, especially for on-promises setup. How we can avoid? Yeah, great solution is cloud. Cloud added more flexible for the organization which helps to create on-demand environments using automation tools like Terraform, pulumi, ansible, etc. Also, we can simplify releases with containers, or orchestrate deployments using Kubernetes. This also provides flexibility and cost reductions.

Blue-Green Deployments Benefits

Blue-green is a good solution when you expect,

To use blue-green deployments, we’ll need a few things:

The Pros of Blue-Green Deployments

Before you decide, please check the pros and cons of the deployment strategy, it should help you to pick right deployment process.

The Cons of Blue-Green Deployments

At this point, you might be thinking that blue-green must have a catch. Otherwise, everyone that could would be using it. So, let’s examine the drawbacks:

Hope this helps to understand about the blue-green deployment and this also may help you to decide you to pick the right deployment strategy. In coming post will see about canary and other deployment strategies, that may give more idea take right choice. You can read also about canary vs Blue-Green deployment.

Exit mobile version