Nowadays, the deployment process is more complex. Continuous Delivery is one of the methods, which is commonly used. Continuous Delivery aims on releasing software in short cycles. This way you can reduce cost, time and risk.
That’s the theory behind Continuous Delivery and it sounds quite useful. However, Continuous Delivery doesn’t provide you with a specific strategy how to achieve this in practice.
Continuous Delivery and Blue-Green Deployment
That’s when Blue-Green Deployment should enter your mind. It helps you to manage your release strategy and to minimize the downtime.
You might wonder how you can deploy a new release at any time, while customers browse on your live system. Therefore you should split your deployment into two stages.
Let’s have a look at our diagram to get a better understanding of the process:
You have an active and a passive stage, here it is Blue and Green. The idea is to push your new feature first on the passive stage, let’s say Green. There, you can run your tests and check everything.
Finally, when everything runs fine on Green, you configure your router to point to Green. So just with a simple click you have switched your production server and released the latest version. As you can see, you can deploy and release item with zero downtime, but what if something goes wrong after you have already switched to the other server?
The old version is still on the passive stage, so you can just instruct your router to direct all traffic to that. This means, in the worst case, you can just go back to the previous version.
This sounds pretty awesome, how can we use it on anynines? Fortunately, there exists a plugin for cloud foundry which allows us to do exactly what we have mentioned before.
Let us go through the steps you need to configure for your application. We use the go example app. If you would like to go through an introduction about anynines, you can visit our Getting Started Guide (https://support.anynines.com/home)
- Get the go example app:
- Get the Blue-Green Deployment Plugin:
- Push it:
git clone https://github.com/anynines/a9s-go-example.git
cf add-plugin-repo garage https://garage-cf-plugins.eu-gb.mybluemix.net/ cf install-plugin blue-green-deploy -r garage
(Note: You should use the latest Cloud Foundry Command Line Interface (cf CLI)
cf blue-green-deploy go-example
Well done! You have successfully deployed your first application with the Blue-Green Deployment plugin on anynines.
That’s all you need to do. If you push a new version of your application, the plugin renames either your old version to go-example-old or rename the latest version to go-example-new and maps the route to the latest version. All you have to do is a simple push and let the magic happen.