Skip to content
Vectana
Esc
↑↓navigate↵open⌘Jpreview
On this page

Upgrades and backups

Upgrade Vectana to a new version, and back up and restore the database.

Back up

All data lives in PostgreSQL. Back it up regularly, and always before upgrading.

mkdir -p backups && chmod 700 backups
docker compose exec -T db pg_dump -U vectana vectana | gzip > backups/vectana-$(date +%Y%m%d%H%M%S).sql.gz

Keep a copy of .env somewhere safe too — it holds SECRET_KEY and your passwords.

Upgrade

Read what changed

Check the releases and the changelog for the new version.

Back up

Back up the database as shown above.

Change the version and restart

Set VECTANA_VERSION in .env to the new version, then pull and restart.

docker compose pull
docker compose up -d

On start, migrate brings the database schema up to date automatically.

Check it

docker compose logs migrate        # "Running upgrade ..." means the schema was updated
curl http://127.0.0.1:8000/api/health

Roll back

Database migrations only move forward. To go back to an older version, set VECTANA_VERSION back and restore the backup you took before upgrading.

docker compose stop app worker
docker compose exec -T db psql -U vectana -d postgres -c "DROP DATABASE vectana WITH (FORCE);" -c "CREATE DATABASE vectana OWNER vectana;"
gunzip -c backups/vectana-XXXXXXXXXXXXXX.sql.gz | docker compose exec -T db psql -U vectana -d vectana
docker compose up -d