Skip to content

Backups & recovery

Back up MongoDB and uploads together so database media paths match the files. Redis should also be retained when scheduled/pending jobs matter.

The application’s own backup feature (Settings → Backups) writes one unencrypted .tar.gz per run: manifest.json, every MongoDB collection as newline-delimited Extended JSON, and the gallery/ files.

Treat that archive as a bearer bundle and protect it accordingly. It contains credential ciphertext (the WhatsApp session, backup/webhook credentials, and the Telegram bot token are AES-256-GCM ciphertext — unreadable without the encryption secret, but decryptable by anyone who also holds that secret), AdminUser Argon2id password hashes, ApiKey SHA-256 hashes, and the audit log. Anyone holding the archive and the server’s secrets holds the accounts. Store archives encrypted at rest, behind access control that only the operator has, and never in a shared bucket or a public location. Backup archives are not encrypted by the application itself; archive-level encryption (for example an opt-in passphrase) is a follow-up, not part of this release.

Restoring an archive also restores the ciphertext as-is, so a restored install still needs the same encryption secret to use its stored credentials.

Backups go to Google Drive, S3, and S3-compatible storage (including Cloudflare R2 and MinIO). There is no local-filesystem backup destination. Destinations, credentials, and schedules are configured from the Backups page and stored (encrypted) in MongoDB.

S3-compatible destinations and private endpoints

Section titled “S3-compatible destinations and private endpoints”

The endpoint credential is optional: without it the client uses https://s3.<region>.amazonaws.com. An endpoint with no scheme defaults to https:; only http: and https: are accepted, and redirects are never followed.

An endpoint that is — or resolves to — a private or loopback address is refused by default. A self-hosted MinIO on http://localhost:9000, 10.x, or 192.168.x is nevertheless a legitimate deployment, so the refusal is per destination, not global: set the destination credential allowPrivateEndpoint to "true" to opt that one destination in. Never set it on a destination whose endpoint you do not control.

Terminal window
# MongoDB
docker compose exec -T mongodb \
mongodump --archive --gzip --db leviro-relay > leviro-relay.mongodb.gz
# Application state (one volume: uploads, gallery, data, logs)
docker run --rm \
--volume leviro-relay_state:/source:ro \
--volume "$PWD":/backup \
alpine tar -czf /backup/leviro-relay.state.tgz -C /source .
# Redis — persist, then archive the volume while the stack is stopped
docker compose exec redis redis-cli BGSAVE
docker compose stop api worker redis
docker compose start redis api worker

Test restores in a separate environment. Restoring over a live production database is destructive — do it only during a maintenance window. Never treat docker compose down -v as routine cleanup; it deletes all named volumes.

  1. Confirm MongoDB and Redis report healthy.
  2. Confirm the worker is running and not restarting.
  3. Open Session and inspect the connection state.
  4. Review worker logs for authentication, media, or retry errors.
  5. Confirm the state volume is mounted at /app/state in both the API and the worker. A worker that cannot see the API’s uploads/ fails every media job with a missing file.
  6. If WhatsApp explicitly logged the device out, pair again. Do not delete valid credentials merely to troubleshoot a temporary network outage.