Wikibase Suite (WBS)

Backing up and restoring

Wikibase Suite (WBS) stores the parts that make your instance unique in two places: service data in Docker volumes, and configuration in the config directory and .env file. The procedures below explain how to back up each and how to restore service data when recovering from a failed upgrade or reset.

Back up your data

WBS stores service data in the following Docker volumes:

To back up these data volumes:

  1. If you have not already, log in to your server and change to your WBS directory.

  2. Create a backup directory one level above the directory from which you operate WBS, shut down the instance, and dump the contents of all Docker volumes into .tar.gz files there.

    mkdir -p ../backup
    docker compose down
    
    for v in \
        wbs-deploy_wikibase-image-data \
        wbs-deploy_mysql-data \
        wbs-deploy_wdqs-data \
        wbs-deploy_elasticsearch-data \
        wbs-deploy_quickstatements-data \
        wbs-deploy_traefik-letsencrypt-data \
        ; do
      docker run --rm --volume $v:/backup debian:12-slim tar cz backup > ../backup/$v.tar.gz
    done
    
  3. If you are backing up before an update, reset, or migration, return to that procedure and leave the services stopped. Otherwise, start WBS again:

    docker compose up -d
    

Back up your configuration

WBS configuration is contained in the following files:

To back up your configuration:

  1. If you have not already, log in to your server and change to your WBS directory.

  2. Copy the config directory and .env file into the same backup directory.

    mkdir -p ../backup/config
    cp -a ./config/. ../backup/config/
    cp -a ./.env ../backup/.env
    

    Keep this backup as a reference when resetting or upgrading. The .env file and configuration may contain plaintext passwords and other secrets, so store the backup directory securely. Do not restore old generated configuration files wholesale after reset; manually reapply your local changes to the new files created during reset.

Restore from a backup

  1. If you have not already, log in to your server and change to your WBS directory.

  2. Shut down the instance and populate the Docker volumes with data from the ../backup directory. Only restore these backups when recovering from a failed upgrade or reset.

    Warning: the restore commands remove the existing Docker volumes before restoring the backup files.

    docker compose down
    
    for v in \
        wbs-deploy_wikibase-image-data \
        wbs-deploy_mysql-data \
        wbs-deploy_wdqs-data \
        wbs-deploy_elasticsearch-data \
        wbs-deploy_quickstatements-data \
        wbs-deploy_traefik-letsencrypt-data \
        ; do
      docker volume rm $v 2> /dev/null
      docker volume create $v
      docker run -i --rm --volume $v:/backup debian:12-slim tar xz < ../backup/$v.tar.gz
    done
    
  3. If another procedure directed you to restore a backup, return to that procedure after the restore is complete. Otherwise, start WBS again:

    docker compose up -d