Self-Hosted Backup & Restore

Quick Backup

If you need a quick way to backup and restore your Sentry instance and you don't need historical event data, you can use the included backup and restore scripts in the self-hosted/scripts directory. These commands will save and load all project and user data, but will not contain any event data. Run these from your self-hosted directory. As of 23.3.1, we're enabling users to opt in/out of error reporting for these scripts.

Backup

This script creates a backup.json file in the sentry directory in your main self-hosted repo.

Copied
./scripts/backup.sh

Restore

Once you have a backup by using the backup script, the easiest way to restore it is to place it under the sentry directory in your main self-hosted repo, next to the config files. This directory automatically gets mounted to /etc/sentry so you can run the following to restore your backup:

Copied
./scripts/restore.sh

If you don't see any errors and the process exits with code 0, congratulations, you have just restored your backup.

Legacy Backup and Restore

If you're running on a version of self-hosted Sentry that is below 23.3.1, you'll need to use the built in import and export commands instead.

Backup

Copied
docker-compose run -v $(pwd)/sentry:/sentry-data/backup  --rm -T -e SENTRY_LOG_LEVEL=CRITICAL web export /sentry-data/backup/backup.json

Restore

Copied
docker-compose run --rm -T web import /etc/sentry/backup.json

Full Backup

The ideal way to backup and restore Sentry is to backup and restore all Docker volumes that it uses. All volumes that hold critical long-term data are already defined as global volumes at install time and are prefixed with sentry-:

  • sentry-data
  • sentry-postgres
  • sentry-redis
  • sentry-zookeeper
  • sentry-kafka
  • sentry-clickhouse
  • sentry-symbolicator

Docker documents how to backup and restore volumes on their documentation. You may use different methods as long as the volumes can be read back without issues.

You can edit this page on GitHub.