Skip to content

Upgrading & rolling back

  1. Snapshot the current, known-good state before pulling anything new:

    Terminal window
    docker compose exec -T web python manage.py create_backup
  2. Pull/build the new version and restart as usual:

    Terminal window
    git pull
    docker compose up -d --build
  3. If something’s broken, roll the code back first:

    Terminal window
    git checkout <previous-tag-or-commit>
    docker compose up -d --build
  4. Then restore the pre-upgrade snapshot from step 1 (path printed by create_backup, or look in BACKUP_DIR for the most recent redscribe-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. Restoring the database is only needed once a migration has actually changed the schema in a way the old code can’t run against. Either way, having the pre-upgrade snapshot in hand before you start means that decision is never made under pressure with nothing to fall back on.

For the full detail on create_backup/restore_backup, including retention, encryption, the account-reconciliation report restore_backup prints before touching anything live, and the automatic pre-restore safety snapshot it takes on your behalf, see Backup & restore.

Releases are tagged v<version> (e.g. v0.1.0-alpha.1) against the VERSION file in the repo root. 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.