Database Restore CD Process

The Database Restore function allows you to restore the database via the Release Pipeline deployment. Be sure to have the database file in .bacpac format before you upload it into your Azure Storage Account.

The CD Pipeline is required to be run manually with these two (2) input parameters:

  • BacpacFilePath, the backup file path within the designated Azure Storage Account.
  • BackupBeforeRestore, when set to True, the pipeline will backup the database before the process of restoring. Setting it to False skips the backup process.
    The backup file will be stored in the system folder of the designated Azure Storage Account. Click Database Backup Folder to learn more.

Take note that the pipeline restored for the Staging and Production environment are separated.

Staging Restore Process

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

Here is the database restore process in Staging.

  1. Create a new release within the <subscription-name>-DB-Restore-STG.CD Pipeline. It will automatically be triggered into the database Staging CD Pipeline.
  2. The primary database will be duplicated to the secondary database. (This step will be skipped if BackupBeforeRestore is set to false)
  3. Then the secondary database will be exported to Azure Storage. (This step will be skipped if BackupBeforeRestore is set to false)
  4. Restore the database from Azure Storage to the secondary database.
  5. Connect the Staging website to the secondary database and delete the primary database.

Production Restore Process

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

Here is the database restore process in Production.

  1. Create a new Release and with the name <subscription-name>-DB-Deploy-PRD.CD. It will automatically be triggered into the database Production CD Pipeline.
  2. The primary database will be duplicated to the secondary database. (This step will be skipped if BackupBeforeRestore is set to false)
  3. Then the secondary database will be exported to Azure Storage. (This step will be skipped if BackupBeforeRestore is set to false)
  4. Restore the database from Azure Storage (the .bacpac file) to 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.

Get Backup File Path

  1. Be sure to have your database upload to the storage account within the Azure portal. Click Upload Database Backup File to learn more.
  2. We already provide the link to the Azure Storage location in the Wiki section in Management Portal.
     
    https://media.nimvio.com/Project_7b52b729-4b2f-4836-83ff-80c738b6f0a9/Media/assets_doc_sitefinity/site-db-restore3_published.png

     
  3. To restore database from system backup in Staging or Production, choose system folder. Choose user folder to restore from the uploaded database backup file.
     
    https://media.nimvio.com/Project_7b52b729-4b2f-4836-83ff-80c738b6f0a9/Media/assets_doc_sitefinity/site-db-restore4_published.png

     
  4. Click on the file you want to restore and copy the path.
     
    https://media.nimvio.com/Project_7b52b729-4b2f-4836-83ff-80c738b6f0a9/Media/assets_doc_sitefinity/site-db-restore5_published.png

     

 

Applying Restore

  1. Go to Cloudvanti Sitefinity Management Portal >> Pipelines >> Releases.
  2. Choose the release pipelines
    Staging: <subscription-name>-DB-Restore-STG.CD.
    Production: <subscription-name>-DB-Restore-PRD.CD.
     
    https://media.nimvio.com/Project_7b52b729-4b2f-4836-83ff-80c738b6f0a9/Media/assets_doc_sitefinity/site-db-restore6_published.png

     
  3. Click the Create release button in top right
     
    https://media.nimvio.com/Project_7b52b729-4b2f-4836-83ff-80c738b6f0a9/Media/assets_doc_sitefinity/site-db-restore7_published.png

     
  4. Fill this form with the version that you need. For BacpacFilePath, fill it with where you put your database path before in the storage account. User can also set BackupBeforeRestore to True (will backtup) or False (skip backup).
    https://media.nimvio.com/Project_7b52b729-4b2f-4836-83ff-80c738b6f0a9/Media/assets_doc_sitefinity/site-db-restore8_published.png

     
  5. Users can check and click the stage in the release history for the details of the deployment progress.
     
    https://media.nimvio.com/Project_7b52b729-4b2f-4836-83ff-80c738b6f0a9/Media/assets_doc_sitefinity/site-db-restore9_published.png

     
  6. Users can see the log of every task or check what is the error if the process failed.
    https://media.nimvio.com/Project_7b52b729-4b2f-4836-83ff-80c738b6f0a9/Media/assets_doc_sitefinity/site-db-restore10_published.png