Skip to content
This repository was archived by the owner on Aug 14, 2024. It is now read-only.

Latest commit

 

History

History
51 lines (35 loc) · 2.45 KB

File metadata and controls

51 lines (35 loc) · 2.45 KB
title 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 built in export and import commands. These commands will save and load all project and user data, but will not contain any event data.

Backup is currently not working, see issue: getsentry/sentry#36868

Backup

docker-compose run --rm -T -e SENTRY_LOG_LEVEL=CRITICAL web export > sentry/backup.json

If you omit the -T or -e SENTRY_LOG_LEVEL=CRITICAL parts, your backup file will have logging lines mixed in and you'll have to remove them somehow.

Restore

Once you have a backup by using the export command, 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:

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

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

We strongly recommended that you restore your backup on the same version of Sentry on a fresh install (empty database but migrations are run). Otherwise, you are very likely to hit errors and may corrupt your database.

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
Only backing up and restoring these volumes should bring back all persisted data. If you also need to back up in-flight data, we recommend backing up any project-specific volumes that docker-compose automatically creates, typically with the sentry_self_hosted_sentry- prefix.

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.