Docs Self-hosting
Backups
What to back up on a Snapsbrew instance, and how to back up and restore a Docker install.
Snapsbrew keeps its data in four places. Back up all four.
| What | Where | Why it is important |
|---|---|---|
| The database | MySQL (the mysql volume in Docker) |
Accounts, templates, template versions, snaps, forms, tokens and the usage log. |
| The storage folder | storage/ (the storage volume in Docker) |
Rendered images and uploads on the public disk, editor assets, uploaded spreadsheets, the Passport keys and the logs. |
The .env file |
The root of the app | All settings, and APP_KEY. |
| The bucket | S3, Spaces or R2 | Rendered images and uploads, if MEDIA_DISK is a bucket. |
Redis holds the cache, the sessions and the queued jobs. If you lose Redis, users must sign in again and the queued jobs are lost. A backup of Redis is not necessary for most instances.
Keep APP_KEY safe
CAUTION: Keep a copy of APP_KEY with every backup. The app encrypts data with this key.
If APP_KEY changes or is lost:
- The stored signed-URL keys cannot be decrypted, so the signed URLs stop working.
- The two-factor secrets of the users cannot be decrypted.
- The setup token changes. This is important only before the first account exists.
Keep .env out of a public place. It holds APP_KEY and all other secrets.
Keep the Passport keys
The OAuth flow of the MCP server signs tokens with the Passport keys. The keys are storage/oauth-private.key and storage/oauth-public.key, or the values of PASSPORT_PRIVATE_KEY and PASSPORT_PUBLIC_KEY. If you lose the keys, every MCP client that connected with OAuth must connect again.
Back up a Docker install
Docker Compose adds the project name to each volume name. The project name is the name of the folder by default. The examples use the project name snapsbrew, so the volumes are snapsbrew_mysql and snapsbrew_storage.
-
Dump the database:
docker compose exec -T mysql sh -c 'exec mysqldump --single-transaction -u root -p"$MYSQL_ROOT_PASSWORD" "$MYSQL_DATABASE"' > snapsbrew.sql -
Copy the
storagevolume to an archive:docker run --rm -v snapsbrew_storage:/data -v "$PWD":/backup alpine tar czf /backup/storage.tar.gz -C /data . -
Copy
.envto the same safe place as the two files.
The mysqldump with --single-transaction makes a consistent copy while the app runs.
Restore a Docker install
-
Stop the app containers:
docker compose stop web horizon scheduler -
Load the database dump:
docker compose exec -T mysql sh -c 'exec mysql -u root -p"$MYSQL_ROOT_PASSWORD" "$MYSQL_DATABASE"' < snapsbrew.sql -
Load the storage archive into the volume:
docker run --rm -v snapsbrew_storage:/data -v "$PWD":/backup alpine sh -c 'cd /data && tar xzf /backup/storage.tar.gz' -
Put the saved
.envback in the root of the app. -
Start the stack:
docker compose up -d
Back up an install without Docker
- Dump the database with
mysqldump --single-transaction. - Copy the
storagefolder. - Copy
.env.
Test the backup
Restore a backup on a test machine from time to time. Then make sure that you can sign in, open a template and render a snap.