Self Hosted Backup

Hey, you self hosters out there. What/how are you guys backing up your ghost installs?

I know we can download the JSON file, but I would love for a way to automate the export of the /content directory, as well as the JSON file on a schedule. Perhaps send to object storage (s3?) somehow.

I guess it depends on your host. My strategy includes the following:

  • scheduled mysqldump
  • ghost backup when I perform an upgrade
  • Host backup (off-site snapshots)
  • Manual snapshot for major OS or Ghost upgrades

On my local machines, I use BorgBackup for local and off-site backups, and could use this on the VPS, too.

1 Like

I use a combination of BackBlaze for very cost-efficient S3 storage and Restic for writing incremental backups.

Restic has support for BackBlaze using “b2” prefix

Run a cron job nightly…

#!/bin/bash
export B2_ACCOUNT_ID="12345"
export B2_ACCOUNT_KEY="123secretkey"
export RESTIC_REPOSITORY="b2:bucketName:repoName"
export RESTIC_PASSWORD_FILE="/usr/local/bin/resticpw.txt"
restic backup /home/ghost/content/

I’m looking at this now. The plan I’m considering is using Ansible to configure Autorestic to back up to BackBlaze B2.

I’m already familiar with Ansible. If you aren’t, you might want to skip that layer.

Ansible+autorestic allows me to manage all the configuration details including the installation details in a YAML file.

I plan to define the of the server with Ansible, so I’ll have all the configuration details in one place.

I’m not sure if I’ll even bother to run mysqldump or just instead backup the underlying the file system.

Even if the filesystem isn’t completely “clean” when a snapshot is taken, MySQL should still be able to recover and boot. Whether to use mysqldump or not is a detail I may look into more!

Actually, I will add one layer to my system, which is 1Password for secret storage. Ansible playbooks can be easily written to pull secrets from a password manager.

So the Ansible playbooks can be reasonable stored in git as a backup and rollback option without the secrets being embedded there.

1 Like

I would choose a hosting company that integrates automatic backups with “snapshots”. Digital Ocean already does that. Pikapods will soon.

1 Like

A few days ago, Diolinux, a blog here in Brazil, had problems with Digital Ocean backups and Snapshots. The files were all corrupted. And he reports that Digital Ocean support didn’t solve his problem.

I’ve been using CloudPanel.
It makes daily backups in a cloud of my choice (OneDrive) and dumps the database.
Snapshots of the machine are made with Oracle.
When I needed to, I was able to restore the services in both cases.

Are there any useful tutorials for setting up automated Ghost backups?

It depends on your hosting. Digital Ocean does it (it’s an additional service that comes with a price) and I heard Pikapods will do it in a few months too.

I know about Digital Ocean. I use Contabo’s Cloud VPS.

use the software that are designed for website backup. There are many option available in free and paid trial like, automatic backup, Schedule backup and cloud storage integration.

Ghost has no plugins, so there aren’t really software to back it up. If you do self hosting, it must be integrated in your hosting. Digital Ocean has it, while others not.

Then you can follow their docs on creating snapshots on CONTABO.

1 Like

yes,
cloud provider usually have Snapshot menu
i use GCP and Snapshot schedule everyday (autodel snapshot if older than 7 day)

want manual backup?

  • use shell command to dump SQL and cron job it
  • use shell command to zip content folder and cron job it

I’ve started building an Ansible role to manage my Ghost installs (discussed here: Interested in Ansible Role to install Ghost to run with podman containers / systemd / private networking? ).

I’m considering extending it to add this Ansible Role for the Restic backup tool along with BackBlaze B2 backups.

The idea is simply by defining a new Ghost blog in my Ansible config, per-site backups with Restic would automatically be set up for it. So, rather than restoring a snapshot of the whole filesystem, I would be able to restore just the files or MySQL database for a single Ghost instance.

But since I’m using Ansible, I would only have to define the backup scheme once for it be available to all my Ghost installs.

1 Like