Operations

Backup, Update, and Rollback

Back up /data and /library safely, pin immutable Docker tags or digests, run zero-surprise upgrades, and roll back cleanly when needed.

Because Bunko stores SQLite databases alongside separate encryption and signing keys in /data, consistent backups and disciplined updates keep your library safe across schema upgrades.

What to back up

Always back up the entire /data volume as one atomic unit while Bunko is stopped:

  • /data/accounts.db — User accounts, password hashes, permissions, media root reservations, and shared catalog keys.
  • /data/users/<id>/ — Every user's SQLite database (WAL files included), retained covers, and translation-backups/.
  • /data/settings.key, /data/session.key, and /data/access.token — Without settings.key, encrypted service and catalog credentials in SQLite cannot be decrypted.

Back up /library separately using your standard media/NAS backup strategy (snapshots, rsync, or Borg/Restic). Bunko never modifies or deletes media files during normal upgrades.

Taking a consistent backup

  1. Stop Bunko so SQLite cleanly checkpoints its WAL journal and no worker writes are in flight:
docker compose stop bunko
  1. Archive the /data volume (adjust the volume name if yours differs):
docker run --rm -v bunko_bunko-data:/data:ro -v "$PWD/backups":/backup alpine \
  tar -czf "/backup/bunko-data-$(date +%F).tar.gz" -C /data .
  1. Restart Bunko:
docker compose start bunko

Never run two Bunko replicas on one volume

SQLite WAL requires single-host local file locking. Deploy strictly one Bunko container per /data volume and avoid placing /data on unreliable network filesystems (NFS/SMB).

Pinning image tags and digests

For predictable production operations, pin a specific version tag or immutable SHA-256 digest in docker-compose.yml instead of floating on :latest:

services:
  bunko:
    image: ghcr.io/lucas-lepajollec/bunko:1.0.0

Record your currently running digest before every upgrade so you can roll back to the exact image bytes:

docker inspect --format='{{index .RepoDigests 0}}' bunko

Safe upgrade procedure

  1. Record the current image digest and stop Bunko (docker compose stop bunko).
  2. Take a fresh backup of the entire /data volume.
  3. Pull the target image and recreate the container:
docker compose pull bunko
docker compose up -d bunko
  1. Bunko runs additive transactional SQLite migrations automatically on startup (current tenant schema is v35) without lowering a newer user_version.
  2. Verify health and your library before resuming bulk downloads:
curl -fsS http://127.0.0.1:2512/api/health

Expected response: {"status":"ok","version":"1.0.0"}.

Safe rollback procedure

Because SQLite schema migrations are forward-only, never run an older Bunko image directly against a database migrated by a newer release.

  1. Stop Bunko (docker compose stop bunko).
  2. Restore your pre-upgrade /data archive into the volume so databases and keys match the previous release.
  3. Set image: in docker-compose.yml back to your recorded previous tag or digest.
  4. Start Bunko (docker compose up -d bunko) and verify /api/health.
  5. Leave /library media files intact unless you deliberately need to restore media files as well.