Upgrades, Backups & Key Rotation
Back up and restore the DBVision data volume, roll back automatic pre-upgrade backups, and rotate or revoke keys.
Backup and restore
Stop DBVision before archiving the /data volume (docker compose stop dbvision or docker stop dbvision):
backup_dir=$(mktemp -d)
docker run --rm --mount type=volume,source=dbvision-data,target=/data,readonly \
alpine tar -C /data -cpf - . > "$backup_dir/dbvision-data.tar" &&
tar -tf "$backup_dir/dbvision-data.tar"Keep the archive in private storage off the data volume. To restore into a new volume:
docker volume create dbvision-restored
docker run --rm -i --mount type=volume,source=dbvision-restored,target=/data \
alpine tar -C /data -xpf - < "$backup_dir/dbvision-data.tar"Start the matching DBVision version with the original DBVISION_MASTER_KEY and BETTER_AUTH_SECRET.
Automatic pre-upgrade backups
Before applying pending Drizzle migrations at startup, DBVision copies dbvision.db into <DBVISION_DATA_DIR>/backups/dbvision-<schema-tag>-<UTC-timestamp>.sqlite and retains up to five backups. If backup preparation fails, startup stops before migrating.
To roll back an upgrade:
- Stop DBVision and move
dbvision.db(plus-waland-shmif present) out of<DBVISION_DATA_DIR>. - Copy the pre-upgrade backup file to
<DBVISION_DATA_DIR>/dbvision.dbwith mode0600. - Start the previous image tag with the key that sealed the backup's secrets.
Rotate the master key
Run a single DBVision instance during rotation (no rolling or blue/green replacement on the first restart):
- Stop DBVision and back up
<DBVISION_DATA_DIR>and the current key. Generate a new key withopenssl rand -base64 32. - Set
DBVISION_MASTER_KEYto the new key andDBVISION_PREVIOUS_MASTER_KEYto the old key, then start DBVision. - Verify the startup log prints
Re-sealed N secrets with the current master key. - Remove
DBVISION_PREVIOUS_MASTER_KEY, restart DBVision, and open a saved connection to confirm decryption works.
If a key leaked, also replace all target database passwords and LLM keys, run PRAGMA wal_checkpoint(TRUNCATE); VACUUM; PRAGMA wal_checkpoint(TRUNCATE); on dbvision.db while stopped, and destroy all pre-rotation backups.
Rotate the auth secret
Set a new BETTER_AUTH_SECRET (or delete <DBVISION_DATA_DIR>/auth-secret) and restart. All existing user sessions end, and undecryptable MCP signing keys are removed at startup so Better Auth can issue new ones.