Are you trying to deploy a new update to the production environment? However, are you afraid of the risks involved with downtime or buggy application?
This is when Blue-Green Deployment comes to the rescue by providing a smooth transition to the new update. To understand how it is done, let us go through the blog, where weundefinedll see what Blue-Green Deployment is, and how it can be done in the Azure cloud with a step-by-step guide.
Blue-Green Deployment is a technique of running two applications, that are identical, in the production environment to reduce the risk of application downtime. Here, Blue deployment is the current version of an application, and green is the next/new version to be launched.
Let us understand this by example. Suppose the current application version is 1.0 (Blue Deployment), and the future version/new version is 2.0 (Green Deployment). Right now, multiple users are using version 1.0, however, the new version is to be deployed in the production environment, and donundefinedt want to give any downtime to the users. So to start the process, we would redirect a few users to the Green Deployment. Once it is confirmed that the new version can perform and sustain the traffic without any bugs or lag, we can redirect all users to the Green Deployment in a controlled manner.
Before starting with the Azure Blue-Green deployment, look at the following resources required for the whole process.
There are two sets for the deployment. The first set is Blue Deployment which is your current version, and the other set is your Green deployment which is your next version of your application. Using the two different sets simultaneously helps to revert the application to the old version (Blue Deployment) if the new version (Green Deployment) cannot handle network traffic. For both sets, we have connected to the same database.
Now, we would be creating the load balancers for Blue and Green Deployments. While deploying the load balancer, attach the IP Address in the frontend pool and add the Virtual Machine to the backend pool (This step applies for both Blue and Green Deployment).
The question here is how we would know if the new version (Green Deployment) is ready for handling network traffic as expected?
We would be creating a weighted Traffic manager and attaching both load balancers to the traffic manager. Add 90% traffic to the Blue Deployment (current version) and 10% to the Green Deployment (new version) and send some user traffic requests to the traffic manager. If the output is as per the defined parameters, we can add 100% traffic to the Green Deployment.
Configuration of Blue-Green Deployment in azure cloud
How to create a Resource Group.
How to create Virtual Machine
Note: There are the same steps for deploying a Green deployment virtual machine.
How to create Azure Database for PostgreSQL flexible servers
Note: Select the same Resource Group as we are using for Virtual Machine
Note: We would need a new subnet as the Virtual Machineundefineds subnet wonundefinedt work for the Postgre flexible server.
How to Create Load Balancer in Azure
Note: For Green deployment as well, follow the same steps.
Note: Select the same V-net as did for the Virtual Machine.
How to create a Traffic manager in Azure
(Follow the same steps for adding the undefinedGreen Deploymentundefined endpoint)
(Select the same public IP Address as we added for the Frontend IP Configuration for the Load Balancer)
Note: We have added 90% for the Blue Deployment and for the rest 10% for the Green Deployment.
(For the output you will see DNS name URL at the Traffic managerundefineds overview section)
Note: For adding a Public IP address in the Endpoints, we need to add a DNS name in the IP Addressundefineds configuration.
Congratulations! Youundefinedve successfully deployed the new update of your application without any downtime, and the new version is running smoothly. In case of a major bug, that is not allowing the users to use it properly, you can roll back the update, work on it, and deploy it back.
We, at Seaflux, are
Director of Engineering