Blue-Green Deployment
Introduction
Goal
Understand how to use blue-green deployment in Bloomreach Cloud and what the advantages and drawback of this approach are.
Background
Bloomreach Cloud is designed for blue-green deployment. Blue-green deployment is a release management approach based on running two similar production environments called Blue and Green. Production traffic is served by one of the environments (for example, Green). A new release is deployed in the other environment (for example, Blue). After deployment is successfully completed, production traffic routing is switched from the environment running the previous release (for example, Green) to the environment running the new release (for example, Blue).
Advantages
Reduced Risk
A new release can be verified after deployment before going live. In case of issues with the new release, production traffic is not affected.
Increased Availability
The environment running the current release keeps serving production traffic while the new release is being deployed and verified in the other environment. Switching production traffic to the new release is almost instant.
Easier Rollback
In case a new release turns out to issues after going live, production traffic can be switched back instantly to the environment running the previous release.
Drawbacks
Content Freeze Required
During the entire process of bringing a new release live, any data written to the repository and databases by the current release will get lost. Therefore, a content freeze must be enforced from before starting the backup of the current live environment until after production traffic has been switched to the other environment running the new release. A content freeze means that all content creation and modification, both by CMS users and any import processes, must be suspended. Also, any data collected by the website (forms, relevance data) during the content freeze must be manually recovered and migrated. All users must be logged out when the content freeze starts.
Procedure
- Deployment of the initial release in Green
- Create the Green environment.
- Deploy version 1.0.0 of your Bloomreach Experience Manager in Green.
-
Make Green the active environment by setting it as production.
- Create the Blue environment.
- Deploy version 1.0.0 of your Bloomreach Experience Manager in Blue.
- Deployment of a subsequent release in Blue
- Announce the start of a content freeze.
- Make a backup of Green.
- Restore the backup in Blue.
- Deploy version 1.1.0 of your Bloomreach Experience Manager in Blue.
-
Verify that version 1.1.0 is running correctly in Blue.
This verification should not contaminate the databases. Extensive testing should be done before this step in a separate acceptance environment. -
Make Blue the active environment by setting it as production. Make sure to check the Switch domain rules checkbox.
- Announce the end of the content freeze.
- Monitor stability of Blue now that it is handling production traffic.
- Once version 1.1.0 has proven to be stable in Blue, deploy version 1.1.0 in Green so the two environments are in sync. This way Green can act as a fail-over environment in case Blue has unexpected problems, although its content is outdated. It also makes the next deployment in Green more reliable.
- Deployment of a subsequent release in Green
- Announce the start of a content freeze.
- Make a backup of Blue.
- Restore the backup in Green.
- Deploy version 1.2.0 of your Bloomreach Experience Manager in Green.
-
Verify that version 1.2.0 is running correctly in Green.
This verification should not contaminate the databases. Extensive testing should be done before this step in a separate acceptance environment. -
Make Green the active environment by setting it as production. Make sure to check the Switch domain rules checkbox.
- Announce the end of the content freeze.
- Monitor stability of Green now that it is handling production traffic.
- Once version 1.2.0 has proven to be stable in Green, deploy version 1.2.0 in Blue so the environments are in sync.
At this point, Deployment of a subsequent release in Blue and Deployment of a subsequent release in Green can be repeated indefinitely.
Keep Distributions In Sync
When you have deployed a new project release in one environment and want to bring the other environment up to date, always first deploy the new distribution and only then restore a backup of the already updated environment.
It is best to follow the procedure explained above which always brings the distribution in the inactive environment in sync with the distribution in the active environment.
Example
Suppose Blue and Green are both running project release 1.0.0 based on Bloomreach Experience Manager 11. You successfully update Blue to project release 2.0.0 based on Bloomreach Experience Manager 12. Next, you want to update Green to project release 2.0.0 as well. You should not first restore a backup of Blue into Green and then deploy the distribution 2.0.0. Green is still running 1.0.0/11 and restoring the backup of Blue based on 2.0.0/12 will redeploy the old distribution which will corrupt the database. Instead, first deploy the distribution 2.0.0 and then restore the backup of Blue.
Database 1.0.0 | Database 2.0.0 | ||
Distribution 1.0.0 |
OK
|
|
|
deploy ↓ |
|||
Distribution 2.0.0 |
OK
|
restore → |
OK
|