Skip to Content
DBVision

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:

  1. Stop DBVision and move dbvision.db (plus -wal and -shm if present) out of <DBVISION_DATA_DIR>.
  2. Copy the pre-upgrade backup file to <DBVISION_DATA_DIR>/dbvision.db with mode 0600.
  3. 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):

  1. Stop DBVision and back up <DBVISION_DATA_DIR> and the current key. Generate a new key with openssl rand -base64 32.
  2. Set DBVISION_MASTER_KEY to the new key and DBVISION_PREVIOUS_MASTER_KEY to the old key, then start DBVision.
  3. Verify the startup log prints Re-sealed N secrets with the current master key.
  4. 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.

On this page