Data and Backups
Everything torq stores lives in a single directory: /data inside the container (TORQ_DATA_DIR).
| Path | Contents |
|---|---|
/data/torq.db (+ -wal, -shm) | SQLite database in WAL mode |
/data/attachments/ | Uploaded photos, manuals, and invoices |
/data/backups/ | Automatic database copies taken before each schema upgrade (newest 3 kept) |
/data/secret.key | Encryption key for 2FA authenticator secrets and SMTP passwords |
secret.key together with the databaseNever back up torq.db alone without secret.key (or the entire /data volume). Without secret.key, authenticator app codes stop working (users must fall back to recovery codes) and stored SMTP passwords cannot be decrypted.
Creating backups
Copying /data/torq.db with cp or tar while torq is writing can produce an incomplete or corrupt database. Either use SQLite's online .backup command or stop the container first.
- Online backup (no downtime)
- Stop & archive full volume
Because the torq image is distroless (it contains no shell or sqlite3), use a temporary Alpine container mounting the same volume:
docker run --rm -v torq-data:/data alpine sh -c \
'apk add --no-cache sqlite >/dev/null && sqlite3 /data/torq.db ".backup /data/backups/manual-$(date +%F).db"'
To back up attachments and secret.key alongside the online database snapshot, copy /data/attachments/ and /data/secret.key as well.
Stop torq briefly and archive the entire /data volume to a compressed tarball:
docker stop torq
docker run --rm -v torq-data:/data:ro -v "$PWD":/backup alpine \
tar czf /backup/torq-$(date +%F).tgz -C /data .
docker start torq
On a VPS, provider disk snapshots (such as Hetzner Backups) are also a reliable extra layer — SQLite in WAL mode recovers cleanly from crash-consistent snapshots.
Vehicle history exports
Each vehicle's History tab can be printed or exported as JSON or CSV (useful for archiving or handing over to a buyer). New CSV columns are always appended at the end so existing column positions remain stable (hour_meter and hours from v1.7.0, vehicle_type from v1.8.0). When a shop name is configured, CSV exports begin with an instance row and JSON exports include instance.name.
Upgrading
- Read the release notes — the Upgrading section notes whether a release includes database migrations.
- Back up first, especially before releases with schema migrations.
- Pull the new image and recreate the container (
docker compose pull && docker compose up -d). Schema migrations run automatically on startup and only move forward. Before migrating, torq copies the database to/data/backups/(keeping the newest3copies). Do not stop the container while a migration is running.
Rolling back
Every image is tagged both latest and by commit SHA (ghcr.io/app-torq/torq:sha-<commit>, listed on each release page):
- Stop torq.
- If the newer version ran a database migration, restore your backup (or the pre-upgrade copy from
/data/backups/). Older torq binaries will refuse to run against a newer schema. - Start the earlier image tag (for example
ghcr.io/app-torq/torq:sha-<commit>).