Backups
Everything a community has is in its data folder. Back up three things:
| What | Why |
|---|---|
sblurp.db |
Members, channels, messages, settings and custom emoji. |
files/ |
Uploads, banners, icons and channel headers. |
file-key |
Signs file URLs. Restore it with files/. |
The simple way
Make a consistent copy of the database while the server runs, then copy the files:
sqlite3 /var/lib/sblurp/sblurp.db ".backup /backups/sblurp.db"
cp -r /var/lib/sblurp/files /var/lib/sblurp/file-key /backups/
To move to new hardware, stop the server, copy the whole data folder and start it there.
Automatic backups to Cloudflare R2
The container image backs itself up to Cloudflare R2 when you give it the keys:
- Litestream sends every database change to R2 within 10 seconds.
- An encrypted backup tool copies
file-keyandfiles/one minute after start and then every hour. It keeps 24 hourly, 7 daily, 4 weekly and 12 monthly snapshots. - On a new, empty volume the container restores the files first, then the database, then starts the server.
R2 is free under 10 GB and a million writes a month. A 10 second sync stays under the write limit.
Set it up
-
In Cloudflare, go to R2 and make a bucket, such as
sblurp-backups. -
Make an R2 API token with "Object Read & Write" for that bucket only. Write down the access key ID, the secret and your account ID.
-
Make a backup password and keep it in your password manager. Without it the file backups cannot be read.
openssl rand -base64 32 -
Add the values to
.env(Compose) or as secrets (Fly):AWS_ACCESS_KEY_ID=... AWS_SECRET_ACCESS_KEY=... R2_ENDPOINT=https://ACCOUNT_ID.r2.cloudflarestorage.com R2_BUCKET=sblurp-backups BACKUP_PASSWORD=... BACKUP_NAME=my-community -
Restart the container.
What can be lost
Messages are never more than 10 seconds behind. Uploads can be up to an hour behind. If the disk is lost, uploads from the last hour are lost too.
Restore
A new machine or a new volume. Start the container with the same R2 values and the same BACKUP_NAME. It restores the files and the database before the server starts.
The database is bad, for example after a bad migration. Stop the server, move the old files away and restore:
mkdir -p /root/bad && mv sblurp.db* /root/bad/
litestream restore /var/lib/sblurp/sblurp.db
For a point in time, add for example -timestamp 2026-10-16T12:00:00Z.
Test your backups
Try a restore once a month, so you know it works:
litestream restore -o /tmp/check.db /data/sblurp.db
sqlite3 /tmp/check.db 'pragma integrity_check' && rm /tmp/check.db
sblurp-backup check
Run these inside the container, for example with fly ssh console or docker compose exec. The container already has the R2 values. sblurp-backup check reads the file backups and reports errors. sblurp-backup snapshots lists them.
View this page as Markdown · Glossary · API schema.json · openapi.json