This topic describes how to ensure a deployment fits in your deployment window by deploying applications in two stages. The first stage compiles the application code, generates the SQL scripts, and uploads binaries to the destination environment (with no impact on running applications). The second stage runs the SQL scripts to update the database and changes the running version of the application in the application server. These two stages can be executed separately.
In this example the eCommerce, Cases and CRM Services applications are deployed to Production.
Why execute a 2-Stage deployment?
The eCommerce, Cases and CRM Cervices applications are critical to the business, so the Operations team needs to ensure the deployment occurs within a time frame that does not impact the business.
In this example the deployment window is between 2 a.m. and 3 a.m.
Activate the 2-Stage Deployment
By default, LifeTime deploys the applications in a single stage: the application code is compiled and deployed, and the running version of the application is changed in the application server.
To activate the 2-stage deployment mode on a platform installed on-premises, in the infrastructure management console, click on the 'Infrastructure' option, then click the 'Manage Environments' link.
Click 'Edit' in the Production environment, to change the environment settings. Finally check the 'Execute deployments in two stages' option.
Then click 'Save' to activate the 2-stage deployment mode for Production.
In OutSystems PaaS, this option can be found in the environment management console by selecting the 'Administration' tab, tap 'Environment Configuration', and check 'Enable 2-Stage Deploy' option.
The First Deployment Stage
Now that the 2-stage deployment mode is active, the operations team can execute ahead the first stage of the deployment. Learn how to Deploy an Application.
One day prior to changing the running version of the applications, the operations team starts the first stage of the deployment: click the 'Prepare Deployment' button.
During the first stage, the application binaries are copied to the front-end servers. This requires CPU usage on the Deployment Controller server, but has low overhead in CPU and IO usage in front-end servers. As such, depending on your infrastructure configuration, consider executing the first deployment stage outside business peak hours, ensuring the maximum performance of your applications.
One of the advantages of deploying applications in two stages is that the first stage can be executed without the operations team supervision since no changes are made to the running applications. When the first stage finishes, LifeTime prompts for permission to proceed to the second stage and change the running applications.
The Second Deployment Stage
At 2:00 a.m., the Operations team can proceed with the deployment, and change the applications running in Production. Click the 'Continue Deployment' button to confirm that you want to change the applications running on Production.
LifeTime checks whether the Production environment has changed since the deployment has started. If there are any changes to the application version running in Production, the impact analysis previously executed is no longer valid. If this happens, a warning is displayed informing that the application has been changed in the destination environment.
Now the SQL scripts run, and the running applications are changed.