Skip to content

Backup and Restore

thenotoriousJeremy edited this page Aug 20, 2026 · 2 revisions

Backup & Restore

Bindarr stores all application data, user accounts, locations, cards, and custom valuations in a single SQLite database file (bindarr.db).


SQLite Architecture & WAL Mode

Bindarr operates SQLite in WAL (Write-Ahead Logging) mode for high concurrency and performance. In WAL mode, three files coexist in the data directory:

  1. bindarr.db — The primary database file.
  2. bindarr.db-wal — The Write-Ahead Log containing recent uncommitted or uncheckpointed transactions.
  3. bindarr.db-shm — Shared-memory index for concurrent readers.

Caution with Raw File Copies: Never copy bindarr.db directly while the server is active without stopping the container or using Bindarr's automated backup engine. Doing so may result in missing transactions that are still buffered in the -wal file.


Automated Rolling Backups

Bindarr includes a built-in automated backup scheduler that generates safe SQLite snapshots while the server is live and serving requests:

  • Schedule: Runs automatically every 24 hours (BACKUP_INTERVAL_HOURS=24).
  • Retention: Retains the last 10 snapshots (BACKUP_KEEP_LAST=10), automatically deleting older snapshots.
  • Location: Snapshots are saved to /app/database/backups/ within the persistent storage volume.

Managing Backups in the Admin Panel

Administrators can navigate to Admin → Backups to:

  • Trigger an immediate database snapshot.
  • View a table of existing backup timestamps and file sizes.
  • Download a snapshot file (.db.bak) directly to your computer.

Creating Manual Off-Site Backups

To create an off-site copy of your database using Docker:

Method 1: Cold Backup (Safest)

Stop the container to ensure all WAL transactions are fully flushed to disk:

# 1. Stop the container
docker compose stop

# 2. Copy the database file to your current working directory
docker run --rm -v bindarr-data:/data -v "$PWD":/backup alpine cp /data/bindarr.db /backup/bindarr-manual-backup.db

# 3. Restart the container
docker compose start

Method 2: Live Hot Backup via SQLite Vacuum

If you cannot take downtime, trigger SQLite's online backup API:

docker exec bindarr sqlite3 /app/database/bindarr.db ".backup '/app/database/backups/manual.db'"

Restoring a Database

To restore Bindarr from a backup snapshot:

  1. Stop the container:
    docker compose stop
  2. Copy your backup file into the volume as bindarr.db:
    docker run --rm -v bindarr-data:/data -v "$PWD":/backup alpine cp /backup/bindarr-manual-backup.db /data/bindarr.db
  3. Remove any lingering stale WAL files:
    docker run --rm -v bindarr-data:/data alpine rm -f /data/bindarr.db-wal /data/bindarr.db-shm
  4. Start Bindarr:
    docker compose start

In-App Collection Export & Import

Individual users can also export and import their card collections without requiring server-level filesystem access:

Exporting

  1. Go to Settings → Data Management or Collection → Export.
  2. Choose your format:
    • JSON: Full fidelity export including custom market values, physical binder pages/slots, and grading details.
    • CSV: TCGplayer-compatible format containing card names, set codes, conditions, quantities, and printings.

Importing

  1. Go to Settings → Import Collection.
  2. Select your CSV or JSON file.
  3. Review the preview and click Confirm Import.

Clone this wiki locally