How to backup and migrate Ghost 6 to another provider

Hi
I am reading the docs about ghost 6 selfhosting with docker and I cannot find any references on how to migrate an installation or how to do a backup.

I wanted to know how to do a backup that allow me to migrate to another provider if needed in the future.

This does not seem to be updated to Ghost 6.

Does anyone have any idea how this process will work?
What is the data that needs to be backed up from a ghost 6 to keep all data, including Ghost6 features, analytics and activity pub? If possible of course.

Thanks

For proper full backups, I always recommend against the JSON exports.

They do not include email analytics or comments, for example.

If you really want to spin up a Ghost site 1:1 again, there’s only one way:

  1. Backup your MySQL database
  2. Backup your /content folder

The steps to get backups are the same in Ghost 6 (copying from my blog, but since that is mainly about migrations, I don’t think a link will do any good here):


To back up your database, you can do the following:

# Create a directory for your backups
mkdir -p ~/ghost-migration

# First, list your containers to find the MySQL one
docker ps

# Then create the backup directly from the container
docker exec MYSQL_CONTAINER_NAME mysqldump -u root -p ghost > ~/ghost-migration/ghost_backup.sql

For the content folder in a Docker setup, you’ll need to locate and copy from your mounted volume. Here’s the safest way to do this:

# First, find your Ghost volume
docker volume ls

# Inspect the volume to find its location
docker volume inspect ghost_ghost_data

# Create a temporary container to copy the content
docker run --rm \
  -v ghost_ghost_data:/ghost_content \
  -v ~/ghost-migration:/backup \
  alpine \
  tar czf /backup/ghost_content_backup.tar.gz -C /ghost_content .

Now both your backups are in the ~/ghost-migration folder on your Docker host. You can download them to your local computer using rsync:

rsync -av your_username@your_server:~/ghost-migration/ ./ghost-migration/
4 Likes

Thank you @jannis
Amazing reply as always.

Is it possible to backup tinybird?
I plan to host it locally just in case.

Same with activity pub…

Hey @jannis , if this isn’t already in the docs, it’d be a great thing to PR, maybe also with the restore directions? :slight_smile:

ActivityPub is tricky. You can back up the entire ActivityPub server’s MySQL database, but restoring that on another server is a challenge. The sites (multiple Ghost sites can use one AP server) share cryptographic keys with the AP server, so you’d could only reuse the AP server with the same Ghost sites (using a database backup for these).

The same process as for the MySQL database applies for it. Just swap the database to the one for ActivityPub instead of ghost.

Tinybird: you should be able to use Sinks for that:

Yes, I had the same thought when writing this yesterday, since we can do that now. I am on vacation at the moment, so I put it on my list of things to do when I am back home :smiley:

2 Likes