Application Deployment Strategies

September 11, 2019

There are number of strategies deploy application in to production environment. Today we are going to test all these different strategies in OpenShift platform.(I am using mini version of OpenShift called MiniShift in my mac)

Pre-Requisites for the following test,

1. Install MiniShift
	 brew cask install minishift
2. After the successful installation, start OpenShift locally
	 minishift start --vm-driver virtualbox

Once minishift started successfully, you will see similar details in your console,
  
Note:  The IP is dynamically generated for each OpenShift cluster. To check the IP, run the minishift ipcommand.
  
The server is accessible via web console at:
    https://192.168.99.100:8443/console

You are logged in as:
    User:     developer
    Password: developer

To login as administrator:
    oc login -u system:admin

Here we are going to discuss the following options

Blue/Green

Blue/Green deployment is a technique that reduces downtime and risk by running two identical production environments called Blue and Green. At any time, only one of the environments is live, with the live environment serving all production traffic.

To test Blue/Green deployment login to the above URL with developer account

  1. Click on the Nginx icon Screen Shot 2019-09-11 at 1 32 31 PM

  2. Click Next fill all the details for project (Below screen will when you click advanced) Git URL - https://github.com/nbenjamin/deployment-examples.git Branch - Blue

Screen Shot 2019-09-11 at 2 46 57 PM

  1. Click on Continue to the project overview Screen Shot 2019-09-11 at 2 49 19 PM

  2. Now click on the url from right side. Screen Shot 2019-09-11 at 2 50 58 PM

The page will display text in blue: Screen Shot 2019-09-11 at 2 52 47 PM

So Now we running version, its time to update the applicaiton with newer version

  1. Repeat the step number 1 Screen Shot 2019-09-11 at 1 32 31 PM

  2. Click Next fill all the details for project (Below screen will when you click advanced) Git URL - https://github.com/nbenjamin/deployment-examples.git Branch - Green Screen Shot 2019-09-11 at 3 06 12 PM

  3. Contiue the step till we get the deployed URL and you should see something like this New-URL

Screen Shot 2019-09-11 at 3 10 03 PM

Once testing is over, its time to switch over to the new version

  1. To enable the routing, click Application menu-> rounter and select bluegreendeploy application Screen Shot 2019-09-11 at 3 14 26 PM

  2. Now click on Edit from Action Screen Shot 2019-09-11 at 3 19 03 PM

  3. Select the right service and Save.

Screen Shot 2019-09-11 at 3 20 53 PM

  1. Now Old URL will have the latest (Green) changes URL Screen Shot 2019-09-11 at 3 22 59 PM

Canary

Canary deployments are a pattern for rolling out releases to a subset of users or servers. The idea is to first deploy the change to a small subset of servers, test it, and then roll the change out to the rest of the servers.

If you are already in Applicaiton->Router page, then select Split traffic across multiple services on the Alternate Services and this allow you to select the service which you need.

Screen Shot 2019-09-11 at 3 58 33 PM

In the above configuration, selected 50% weight, so in this case, first request goes to blue page and the second request goes to green

A/B Testing

A/B testing is suitable for frontend applications that are introducing new features or user interface changes. Its very important to hear feedback users, thus doing it directly in production is the best test environment you can have. The users’ reaction can show whether changes you have done are intuitive or not, and you can eventually adapt your changes according to the feedback.

OpenShift’s perspective, this is literally the same as canary deployment, except that you set the weights between the two services to 50% each