Skip to content

Upgrading and backups

Everything Chelsea stores lives in three Docker volumes: the database, the uploaded files and the cache. The cache can be lost; the other two cannot. Upgrading replaces the containers, never the volumes.

Terminal window
# 1. Back up the database, and keep a copy of .env: ENCRYPTION_KEY cannot be recovered
docker compose exec -T db sh -c 'pg_dump -U postgres -Fc "$POSTGRES_DB"' > chelsea-$(date +%F).dump
# 2. Get the new version and rebuild
git pull
docker compose --profile app up -d --build

migrate runs on every start. It applies only the migrations the new version adds, so a start with nothing new changes nothing. Watch it with docker compose --profile app logs migrate. web and worker don’t start if it fails.

Copy the file server’s volume into a dated archive in the current folder:

Terminal window
docker run --rm --volumes-from "$(docker compose ps -q s3)" -v "$PWD":/backup alpine \
tar czf /backup/files-$(date +%F).tgz -C /data .

Migrations only move forward. To return to an older version, restore the database dump you took before upgrading first:

Terminal window
docker compose exec -T db sh -c 'pg_restore --clean -U postgres -d "$POSTGRES_DB"' < chelsea-2026-11-01.dump

Then check out the older version and start it again.