Upgrading & rolling back
Upgrading a running instance safely, and rolling back a bad deploy or migration.
This page covers how to upgrade a running instance without losing data if something goes wrong, and how to roll back if it does.
The upgrade procedure
Section titled “The upgrade procedure”-
Snapshot the current, known-good state before pulling anything new:
Terminal window docker compose exec -T web python manage.py create_backup -
Pull the new version, refresh the base images, and restart:
Terminal window git pulldocker compose pull --ignore-buildabledocker compose build --pulldocker compose up -dThe two middle commands fetch the latest PostgreSQL, nginx, and Python base images, so OS and library security fixes arrive with every upgrade. A plain
docker compose up -d --buildkeeps reusing whatever base images are already on the host. If you run the Tailscale profile, add--profile tailscaleto thepullandupcommands. -
If something’s broken, roll the code back first:
Terminal window git checkout <previous-tag-or-commit>docker compose up -d --build -
Then restore the pre-upgrade snapshot from step 1 (the path was printed when you ran
create_backup, or look inBACKUP_DIRfor the most recentredscribe-backup-<timestamp>.rsbk):Terminal window docker compose exec web python manage.py restore_backup /app/backups/redscribe-backup-<timestamp>.rsbk
Rolling the code back alone is sometimes enough, if it’s a bad release with no migration in it. You only need to restore the database once a migration has actually changed the schema in a way the old code can’t run against. Either way, having that pre-upgrade snapshot in hand before you start means you’re never making this call under pressure with nothing to fall back on.
For the full detail on create_backup and restore_backup, including
retention, encryption, the account-reconciliation report restore_backup
prints before it touches anything live, and the automatic safety snapshot
it takes for you right before restoring, see Backup &
restore.
Version tags
Section titled “Version tags”Releases are tagged v<version> (for example v0.2.0-alpha). The
git checkout <previous-tag-or-commit> in step 3 above means exactly that
tag, or any commit you know was working. See Alpha status &
versioning for how RedScribe’s pre-1.0 versioning
works and what to expect from a minor-version bump.