This article is a high-level description of how to create an automated production upgrade process using your own existing pipeline tool and Torque. Before you start with setting up the upgrade process, make sure you've properly completed the steps in Setting up your Production Environment.
Upgrading your production environment is done automatically through your existing pipeline using the Torque API. The following is a typical example of a pipeline, constructed in Azure DevOps:
In this article, we'll review the pipeline steps that, together, are responsible for the automation of your production upgrade. Add the following steps to your pipeline:
- Deploying the green environment
- Exposing the new green environment to traffic
- Promoting the green environment
Deploying the Green Environment
Once all tests have successfully completed, you can push all the changes to production and promote your green environment creating the latest version. Add a step to your pipeline that (a) deploys the new green environment based on your production environment blueprint and (b) runs all the required tests on the new green.
The following example shows an example of a similar step in Azure DevOps:
Exposing the New Green Environment to Traffic
You can use your monitoring tools to check the health and status of your green environment before and during its exposure to traffic. Once all tests and monitoring activities on the new green environment have completed successfully, you are ready to gradually expose the new green environment to traffic.
Add a step to your pipeline that includes the automatic gradual exposure of your green environment to user traffic. The following example shows an exposure from 0 to 100 in one shot:
Promoting Green to Blue
The promotion step is the final step in the production upgrade flow. When all traffic is redirected to the green environment, it's time to promote the new green environment. As long as the two environments (the new green and the blue) are still up, you have the option to easily roll back to the previous version (the blue environment) if any unexpected issues with the new environment come up.
Once it's clear that the new green environment is stable, you can teardown the old blue environment and make the new green into the new blue.
You can include manual intervention in your pipeline by gating the final promotion step and enforcing manual approval by a designated stakeholder.