Backup, Restore & Upgrades
Florabase guards against failed upgrades automatically, while keeping paired database + media backups as the authoritative recovery procedure.
Upgrading Florabase
Section titled “Upgrading Florabase”- Read the release notes on GitHub Releases (and optionally verify
release-manifest.json). Note thatflorabase-postgresmay update within PostgreSQL 18 (Alpine/security updates), but never crosses a PostgreSQL major version automatically. - Take a paired backup using your current release.
- Download
compose.yamlfrom the target release tag (preserving your host bind paths,FLORABASE_DB_PASSWORD, andFLORABASE_CANONICAL_ORIGIN, or update your pinned image tags/digests), then pull and redeploy:
docker compose --project-name florabase pulldocker compose --project-name florabase up -d --waitWhat happens during an upgrade
Section titled “What happens during an upgrade”- When the Alembic schema revision changes,
backendautomatically writesflorabase-<from>-to-<to>-<UTC>.dumpinto$BACKUP/pre-upgrade/and verifies it withpg_restore --list. - If the backup folder is missing, unwritable, or verification fails, nothing is migrated.
- Migrations run inside one PostgreSQL transaction. If a migration fails, the database stays at the previous release and
backendwrites$DATA/state/upgrade-failed.envso restart loops never create duplicate dumps. - Image-only updates (same Alembic head) do not write a pre-upgrade dump — your step 2 paired backup is your rollback point.
- Skipping releases directly is refused by the guard: to jump multiple releases, apply each intermediate release in order or restore a paired backup.
Paired backup (database + media)
Section titled “Paired backup (database + media)”Run this block over SSH in bash (not sh/ash — on Synology NAS run bash first, as the script uses Bash arrays) from the directory holding your stack’s compose.yaml (adjust project and backup to a new, non-existing directory):
project=florabasedc() { docker compose --project-name "$project" --file compose.yaml "$@"; }backup='/absolute/path/to/a/new/backup-directory'
( set -e umask 077 mkdir "$backup" dc stop frontend backend dc exec -T db sh -ec ' export PGPASSWORD="$FLORABASE_DB_PASSWORD" exec pg_dump -Fc --no-owner --no-privileges -U "$POSTGRES_USER" "$POSTGRES_DB" ' > "$backup/database.dump" dc run --rm --no-deps -T backend python /app/scripts/attachment_artifacts.py verify dc run --rm --no-deps -T backend python /app/scripts/attachment_artifacts.py archive \ > "$backup/media.tar" files=(database.dump media.tar compose.yaml) cp compose.yaml "$backup/" if [ -f release-manifest.json ]; then cp release-manifest.json "$backup/" files+=(release-manifest.json) fi cd "$backup" sha256sum "${files[@]}" > SHA256SUMS)dc up -d --waitStore encrypted copies of the completed backup directory off the host, and keep database/owner credentials stored separately.
Isolated restore drill
Section titled “Isolated restore drill”Always restore into a new, empty data folder prepared with the one-time folder setup under a distinct stack name — never overwrite a live installation in place.
Create a temporary restore-override.yaml next to the restore stack’s compose.yaml so container names do not collide with your live stack (and change the frontend port in the restore compose.yaml to e.g. 127.0.0.1:8081:8080 if restoring on the same host):
# restore-override.yaml (local only)services: db: container_name: florabase-restore-db backend: container_name: florabase-restore-backend frontend: container_name: florabase-restore-frontend- Start the fresh restore stack (pointing to the new empty data folder, backup folder, new DB password, and without
FLORABASE_OWNER_*variables):
project=florabase-restoredc() { docker compose --project-name "$project" --file compose.yaml --file restore-override.yaml "$@"}dc up -d --wait- Stop the app services and restore both database and media:
dc stop frontend backenddc exec -T db sh -ec ' export PGPASSWORD="$FLORABASE_DB_PASSWORD" psql -XAq -v ON_ERROR_STOP=1 -U "$POSTGRES_USER" -d "$POSTGRES_DB" \ -c "DROP SCHEMA public CASCADE" -c "CREATE SCHEMA public" exec pg_restore --single-transaction --exit-on-error --no-owner --no-privileges \ -U "$POSTGRES_USER" -d "$POSTGRES_DB"' < /path/to/backup/database.dumpdc run --rm --no-deps -T backend python /app/scripts/attachment_artifacts.py restore \ < /path/to/backup/media.tardc run --rm --no-deps -T backend python /app/scripts/attachment_artifacts.py verify- Restart and verify:
dc up -d --waitSign in with the restored credentials, verify your records and original photos, then switch proxy traffic if migrating hosts.