User:Nuqing/Blue-green deployment

Blue-Green Deployment Blue-green deployment is a release strategy that can be utilized by developers for deploying software in a production environment. Blue can be one particular production environment whereas green can define an identical production environment. Under blue-green deployment strategy, software developers are able to minimize downtime and reduce risk.

Background
Blue-green deployment is one of the techniques used in continuous delivery, which is a software engineering method to release a usable software in a fast speed, as well as continuous integration.

Definition
Blue-green deployment is a release strategy that can be utilized by developers for deploying software in a production environment. Blue can be one particular production environment whereas green can define an identical production environment. Under blue-green deployment strategy, software developers are able to minimize downtime and reduce risk . The following diagram displays Blue Green Deployment in a software deployment scenario.

From a technical perspective, Blue-green deployment can also be viewed as a process where two sets of machines that switch traffic from each other. .

Principle
1. Two environments need to be identical so that a development team can easily switch between both environments. Either or environment can function as a backup while the other environment is live. 2. If the green environment has not been deployed, one should make sure to test the complete green environment in its entirety. This will ensure fully functionality when the green environment replaces the blue environment in production

Implementation
As defined, the implementation of blue-green environment therefore is concerned with Amazon Web Services, IIS, Tomcat and Cloud foundry.

AWS: (Amazon Web Services) In a traditional environment, since two versions of the same software often run in the same server, the environment should always be prepared for switching from two version. Therefore developers should be extra cautious when they update their production environment as it may cause problem when reverting the server between two version. Another advantage to this approach is you now have a really easy rollback, as the other folder contains the previous version of your website.

IIS: (Internet Information Services) 1.Queries IIS on the remote server to find out what the “active” home directory is (maybe the “Green” folder). 2.Unzips the package file into the inactive folder (“Blue”). 3.Changes the IIS home directory on the website to point to the updated slice (“Blue”).

Tomcat Server: Tomcat Server is primarily a Java based server. The Tomcat environment involves shutting down the services, uninstalling old versions of Tomcat and re-installing newer versions of Tomcat. Parallel development is the term used to describe the blue-green deployment.

Cloud foundry: For cloud foundry the following illustrates a perfect example: Step 1: Push an App Step 2: Update App and Push Step 3: Map Original Route to Green Step 4: Unmap Route to Blue Step 5: Remove Temporary Route to Green

Benefit and Challenge
Benefits: 1. Minimizes downtime by switching between blue and green environments. 2. Provides developers a fast way to rollback, if one of the environments becomes corrupted or fails in production. 3. Allows developer to test disaster-recovery. This allows the developer to accommodate a situation where there is a so-called "disaster" occurs. Challenge: How to handle database in blue-green deployment is one of the biggest issues: Sometimes a new release of software involves changes in the schema of the database. Two separated databases, one serving as the other’s duplicate version can cause a lot of trouble in database migration. To implement blue-green deployment, those changes have to be done in a way that can keeps the database’s behavioral and informational semantics not only for the new but also the old version application. It is important that all the deployment and test process for the database refactory is done before deploying the new software, therefore to retain the consistency of database and also a backup for switching between blue and green environment.