Skip to content

Updates and backups

Updating (Docker)

cd odbavto
git pull
docker compose up -d --build

Database migrations run automatically when the container starts. Always make a backup before updating (see below) and read the changelog, especially the BREAKING sections.

Don't update during an event

An update restarts the app for a few seconds and disconnects scanners and agents. Plan it outside operating hours.

What to back up

Data Where How
Database volume <project>_postgres_data pg_dump
Label images and logos volume <project>_private_media volume archive
Configuration .env file copy (contains passwords, store securely)

Backup

cd odbavto
mkdir -p backup

# database
docker compose exec -T db sh -c 'pg_dump -U "$POSTGRES_USER" -Fc "$POSTGRES_DB"' \
  > backup/odbavto-$(date +%F).dump

# label images
docker run --rm -v odbavto_private_media:/data -v "$PWD/backup":/backup alpine \
  tar czf /backup/private_media-$(date +%F).tar.gz -C /data .

The volume name follows COMPOSE_PROJECT_NAME (here odbavto). docker volume ls lists all volumes.

Run backups regularly, e.g. nightly via cron, and keep copies off the server too.

Restore

cd odbavto
docker compose stop web

# database
docker compose exec -T db sh -c 'pg_restore -U "$POSTGRES_USER" -d "$POSTGRES_DB" --clean --if-exists' \
  < backup/odbavto-2026-10-30.dump

# label images
docker run --rm -v odbavto_private_media:/data -v "$PWD/backup":/backup alpine \
  sh -c 'tar xzf /backup/private_media-2026-10-30.tar.gz -C /data'

docker compose start web

Local installation

All data is in the db.sqlite3 file and the private_media/ folder. Back them up with the server stopped. The update procedure is in Local installation.