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

https://media.nimvio.com/Project_7b52b729-4b2f-4836-83ff-80c738b6f0a9/Media/assets_doc_sitefinity/site-db-cd_published.png

Here is the database deployment process in Staging environment.

  1. After the database has been successfully deployed from the Staging CI Pipeline, it will automatically trigger into the Staging CD Pipeline.
  2. The SQL script will be executed on the primary database.

Database CD Process in Production

https://media.nimvio.com/Project_7b52b729-4b2f-4836-83ff-80c738b6f0a9/Media/assets_doc_sitefinity/site-db-cd2_published.png

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.

  1. After the database has been successfully deployed to the Production CI Pipeline, it will automatically be triggered into the Production CD Pipeline.
  2. The primary database will then be duplicated to the secondary database.
  3. 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.
  4. Once exported, the SQL script will be executed in the secondary database.
  5. 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.
  6. 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.

  1. From the Cloudvanti Sitefinity Management Portal menu, select Pipelines. Then select Releases.
  2. Then, select the corresponding release pipeline. For Staging, <subscription-name>-DB-Deploy-STG.CD. For Production, <subscription-name>-DB-Deploy-PRD.CD.
     
    https://media.nimvio.com/Project_7b52b729-4b2f-4836-83ff-80c738b6f0a9/Media/assets_doc_sitefinity/site-db-cd3_published.png

     
  3. To check on the deployment progress, click on the STG part of stages on the release list.
     
    https://media.nimvio.com/Project_7b52b729-4b2f-4836-83ff-80c738b6f0a9/Media/assets_doc_sitefinity/site-db-cd4_published.png

     
  4. A list will appear where you can check the log for progress and any errors during the Deploy Database Process.
     
    https://media.nimvio.com/Project_7b52b729-4b2f-4836-83ff-80c738b6f0a9/Media/assets_doc_sitefinity/site-db-cd5_published.png

     

Re-execute Database CD Pipeline

https://media.nimvio.com/Project_7b52b729-4b2f-4836-83ff-80c738b6f0a9/Media/assets_doc_sitefinity/site-db-cd6_published.png

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

https://media.nimvio.com/Project_7b52b729-4b2f-4836-83ff-80c738b6f0a9/Media/assets_doc_sitefinity/site-db-cd7_published.png

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.

  1. Create a new Release within the DB-Deploy-STG Pipeline. It will automatically be triggered into the database Staging CD Pipeline.
  2. The primary database will be duplicated to the secondary database. (If BackupBeforeDeploy is set to false, this step will be skipped)
  3. Then the secondary database will be exported to Azure storage. (If BackupBeforeDeploy is set to false, this step will be skipped)
  4. The SQL script will be executed in the primary database.

Production CD Pipeline

https://media.nimvio.com/Project_7b52b729-4b2f-4836-83ff-80c738b6f0a9/Media/assets_doc_sitefinity/site-db-cd8_published.png

When a new Release is created within the Database Deploy Production Pipeline, it will run the database within the Production CD Pipeline.

Here is the database deployment process in Production.

  1. Create a new Release within the DB-Deploy-PRD Pipeline. It will automatically be triggered into the database Production CD Pipeline.
  2. The primary database will be duplicated to the secondary database. (If BackupBeforeDeploy is set to false, this step will be skipped)
  3. Then the secondary database will be exported to Azure storage. (If BackupBeforeDeploy is set to false, this step will be skipped)
  4. The SQL script will be executed in the secondary database.
  5. 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.
  6. 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.

Manually Re-execute CD Pipeline

You can manually re-execute the previously failed SQL Script within the Management Portal.

Here are the steps to re-execute the database within the CD Pipeline:

  1. From the Cloudvanti Sitefinity Management Portal menu, select Pipelines. Then select Releases.
  2. Then, select the corresponding release pipeline. For Staging, <subscription-name>-DB-Deploy-STG.CD. For Production, <subscription-name>-DB-Deploy-PRD.CD.
     
    https://media.nimvio.com/Project_7b52b729-4b2f-4836-83ff-80c738b6f0a9/Media/assets_doc_sitefinity/site-db-cd9_published.png

     
  3. Click the Create Release button.
  4. Input the database version that needs to be executed and BackupBeforeDeploy value to True or False. Entering a value for the description is optional.
     
    https://media.nimvio.com/Project_7b52b729-4b2f-4836-83ff-80c738b6f0a9/Media/assets_doc_sitefinity/site-db-cd10_published.png

     
  5. Click Create, and the Database Deploy CD Pipeline will run.