Backups
The gateway stores jobs, receipts, batches, and checkpoints in a SQLite
database. Use persistent local disk, not /tmp or a network filesystem. SQLite
is configured for WAL mode, synchronous=NORMAL, and up to five connections.
Create a backup
Use SQLite's backup facility so WAL state is handled consistently:
sqlite3 /var/lib/witness/gateway.db ".backup '/backups/gateway-YYYYMMDD-HHMMSS.db'"
Back up the binary version, gateway database, network config, log key, and signed key history as a set. Back up each signer's config and latest checkpoint state separately; never copy state between signers. Protect backups containing keys or bearer tokens, and test restoration.
Restore
Stop the gateway before replacing its database. Restore a known-compatible backup, ensure the service identity owns the database directory, and start the reviewed binary. The gateway runs embedded migrations at startup. Migrations are forward-only, so a downgrade requires a compatible pre-upgrade backup. For v0.10, follow the migration guide and start with a fresh protocol v2 database. Never restart a signer on stale checkpoint state or silently start it with an empty file after state loss; review the last known checkpoint before resuming service.
What a backup does not prove
A database backup protects against some process, host, and disk failures. It does not make gateway records tamper-evident, prove historical gateway honesty, or replace client verification of signatures and proofs. Preserve independent signed receipts, signed checkpoints, consistency proofs, and auditor state when those are part of the deployment's evidence model.