Database CD Process

This process follows up after the build in the database CI Pipeline has been successfully published. The process will execute the SQL script and triggers automatically after the CI Pipeline completes in their respective environment's database.

Staging CD Pipeline

Here is the database deployment process in Staging.

  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 then be executed on the primary database.

Production CD Process

A deployment slot in Production will be available for testing of 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 trigger 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 here for more details on uploading database backup file.
  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 that you are exporting from a transactionally consistent copy of your database.

Validate the CD Pipeline

To check the state of the database CI process you can see the status of each build from the pipelines. Here are the steps to check the database CD pipeline.

  1. Go to Cloudvanti Management Portal >> Pipelines >> Releases
  2. Choose release pipeline:
    Staging: <subscription-name>-DB-Deploy-STG.CD.
    Production: <subscription-name>-DB-Deploy-PRD.CD.


  3. Users can click the STG button in the release history for the details of the deployment progress.

  4. In the Deploy Database Process user can see the progress and check the logs if there is an error.


Re-execute Database CD Pipeline

The Re-executing database is the process of re-execute the previous SQL script. This process will not rollback the database version. Re-executing the SQL script will create a new release in the Database Deploy CD Pipeline.

User need to input 2 parameters to re-execute the SQL script.

  • Artifact Version, this refers to the SQL script published by the Database Deploy CI Pipeline based on your commit. You can see the list of the artifact version in the Database Deploy CI Pipeline.
  • BackupBeforeDeploy, set the value to True if want to back up the database first before executing the script or False to skip the backup process.
    The backup file will store in Azure Storage, system folder. For more detail see this section.

Staging CD Pipeline

When User creates a new release in Database Deploy Staging Pipeline it will run the database Staging CD Pipeline. Here is the database deployment process in Staging.

  1. User creates new Release in the DB-Deploy-STG pipeline. It will automatically trigger the database Staging CD pipeline.
  2. The primary database will be duplicated to the secondary database. (This step will be skipped if BackupBeforeDeploy is false)
  3. Then the secondary database will be exported to Azure storage. (This step will be skipped if BackupBeforeDeploy is false)
  4. The SQL script will be executed in the primary database.

Production CD Pipeline

When User creates a new release in the Database Deploy Production Pipeline it will run the database Production CD Pipeline. Here is the database deployment process in Production.

  1. User creates new Release in the DB-Deploy-PRD pipeline. It will automatically trigger the database Production CD pipeline.
  2. The primary database will be duplicated to the secondary database. (This step will be skipped if BackupBeforeDeploy is false)
  3. Then the secondary database will be exported to Azure storage. (This step will be skipped if BackupBeforeDeploy is false)
  4. The SQL script will be executed in the secondary database.
  5. The secondary database will be connected to the deployment slot. Then the deployment slot will be warmed up. If the deployment slot website warm-up is:
    • succeeded, the production and development slot will be swapped.
    • failed, the secondary database will be deleted and the process CD stopped.
  6. After the production and development slot will be swapped, it will warming-up. If the warm-up:
    • succeeded, the primary database will be deleted.
    • failed, the production and development slot will be swapped again. Then the secondary database will be deleted.

Re-execute CD Pipeline

User can manually re-execute the previous SQL script that has been executed in Management Portal. Here is the step to re-execute database CD:

  1. Go to Cloudvanti Management Portal >> Pipelines >> Releases
  2. Choose release pipeline:
    Staging: <subscription-name>-DB-Deploy-STG.CD.
    Production: <subscription-name>-DB-Deploy-PRD.CD.

  3. Click the Create Release Button.
  4. Input the database version that needs to be executed and BackupBeforeDeploy value to True or False. User can input the description but it is optional.
  5. Click Create and the Database Deploy CD Pipeline will run.