Go to the profile of  Leo
Leo
why do i need a bio? they are painful to write.
2 min read

How to backup Ghost Blog in Azure

How to backup Ghost Blog in Azure

When I setup my ghost blog in Azure, I immediately utilized the backup feature of Azure. I did not really pay attention to it until I want to upgrade my Ghost to 0.90.

Always perform backups before doing any upgrades

Steps to analyze

Analyzing the logs hints me of what caused the partial succeed.

In order to analyze what happened here are the steps that I did:

  1. You have to go to the old portal. (I cannot see how I can do it in the new portal)
  2. Go to Management Services
  1. Sort the operation and look for BackupWebsite
  2. Click details found at the bottom and you will see the following message:

Message:
Creating temp folder.
Retrieve site meta-data.
Backing up the databases.
Backing up site content and uploading to the blob...
File skipped - \site\wwwroot\content\data\ghost.db:
Sharing violation to C:\Resources\directory
0ce20e6bc36e472faab023d854941a59.ControllerRole.BackupRestore
727f89b4-e480-4e7f-9be9-7dcf554af4e1\package\fs
site\wwwroot\content\data\ghost.db
Uploading metadata to the blob.
Backup completed! Total backup size: 91762 KB

The reason for that is Ghost is running and it cannot do a backup.

Solution

According to this answer

Unfortunately, right now you cannot automate the backup without shutting down Ghost. This is because it isn't smart to be copying the database while it could be being read/written to. A script that stops Ghost, makes a copy, and starts it back up would prob only ~1 second of down time, so if you have times that are slower, you could probably get away with it. If you can't, then just do the manual export for all the post data, and have a script backup all your images.

So in order to do automate this, I would have to create a backup script that would shut down Ghost first and then schedule a backup. This is not the best solution right now because this would include down time.