Database - CD Process
Database CD Process
This process follows up after the artefact in the database CI Pipeline has been successfully published. The process will execute the SQL script and triggers automatically after the CI Pipeline completes its respective environment's database.
Database CD Pipeline in Staging
Here is the database deployment process in Staging environment.
- After the database has been successfully deployed from the Staging CI Pipeline, it will automatically trigger into the Staging CD Pipeline.
- The SQL script will be executed on the primary database.
Database CD Process in Production
A deployment slot in Production will be available for testing the deployed database after the script has been executed successfully. Should the CD Pipeline fail, there is no need for a manual restore of the backup file as the pipeline will have it done automatically.
Here is the database deployment process in Production.
- After the database has been successfully deployed to the Production CI Pipeline, it will automatically be triggered into the Production CD Pipeline.
- The primary database will then be duplicated to the secondary database.
- The secondary database will be exported to Azure storage.
The backup file will also be stored in the Azure Storage within the system folder. Click uploading database backup file for more details.
- Once exported, the SQL script will be executed in the secondary database.
- The secondary database will be connected to the deployment slot. The deployment slot will begin to initiate the warm-up state. Should the deployment slot website warm-up state be:
- Successful, the production and development slot will be swapped.
- Failed, the secondary database will be deleted and the CD Process will stop.
- After the production and development slot have been swapped, it will enter the warm-up state. Should the warm-up be:
- Successful, the primary database will be deleted.
- Failed, the production and development slot will continue to swap again. The secondary database will then be deleted.
For the exported database to be transactionally consistent in step 3, you must ensure either that no write activity is occurring during the export, or exporting from a transactionally consistent copy of your database.
Reviewing the State of Your Build Process
To check the state of the database CD process you can see the status of each build from the pipelines. Here are the steps to check the database CD pipeline.
- From the Cloudvanti Sitefinity Management Portal menu, select Pipelines. Then select Releases.
- Then, select the corresponding release pipeline. For Staging, <subscription-name>-DB-Deploy-STG.CD. For Production, <subscription-name>-DB-Deploy-PRD.CD.
- To check on the deployment progress, click on the STG part of stages on the release list.
- A list will appear where you can check the log for progress and any errors during the Deploy Database Process.
Re-execute Database CD Pipeline
This process will re-execute when we failed to commit SQL Script. However, it will not rollback to the previous version of the database. Re-executing the SQL script will create a new release within the Database Deploy CD Pipeline.
There are two (2) parameters to be set in order to re-execute the SQL script:
- Artefact Version refers to the SQL script published by the Database Deploy CI Pipeline based on your commit. See the list of the artefact version in the Database Deploy CI Pipeline.
- BackupBeforeDeploy, to back up the database before executing the script, set this to "True". Otherwise, set it to "False" to skip the backup process.
The backup file will be stored in Azure Storage, a system folder. Learn more on uploading database files.
Staging CD Pipeline
When a new release in the Database Deploy Staging Pipeline is created, it will run the database within the Staging CD Pipeline.
Here is the database deployment process in Staging.
- Create a new Release within the DB-Deploy-STG Pipeline. It will automatically be triggered into the database Staging CD Pipeline.
- The primary database will be duplicated to the secondary database. (If BackupBeforeDeploy is set to false, this step will be skipped)
- Then the secondary database will be exported to Azure storage. (If BackupBeforeDeploy is set to false, this step will be skipped)
- The SQL script will be executed in the primary database.