Upgrade and rollback
An upgrade is one command. It never starts without a fresh backup, keeps what is needed to come back, and leaves a report you can read in the application.
At a glance
Docker
cd liberty-next/release
git pull # the scripts of the new release
./liberty upgrade # to the latest release
./liberty upgrade --tag 7.0.58 # or to a given release (kept in .env)
What the command does, in order:
| Step | Detail |
|---|---|
| 1. Check | Runs doctor. Problems are reported but do not stop the upgrade — an upgrade is often what fixes them. |
| 2. Keep the image | The image now running is tagged locally rollback-<date> so that it can be started again. |
| 3. Backup | backup of every volume and of the apps folder, kept --keep days (30 by default). If the backup fails, the upgrade stops and nothing is changed. |
| 4. Pull and recreate | The new image is pulled and the containers recreated with the recorded compose files — HTTPS and the licensed apps stay in place. |
| 5. Apps and migrations | With --apps <wheel>, the new apps bundle is installed (with its merge plan); then the pending schema migrations are applied. |
| 6. Report | The report is recorded and status is printed. |
Downtime is the time the container takes to restart, usually well under a minute.
Upgrading the licensed apps
./liberty upgrade --apps ./liberty_apps-7.0.58-py3-none-any.whl
Framework and apps are upgraded in one run. To refresh the apps alone, without a new framework image: ./liberty apps <wheel>.
Python install
liberty-ops upgrade # framework to the latest release
liberty-ops upgrade --version 7.0.58 # a given release
liberty-ops upgrade --apps ./liberty_apps-7.0.58-py3-none-any.whl
Same sequence: doctor → backup (the only step that can stop the upgrade) → pipx upgrade (or the pinned version) → the apps wheel → liberty-admin migrate → service restart and wait for /ready → report → status. --no-restart leaves the restart to you; --backup-dest chooses where the backup goes.
Run it as the service user with its environment loaded, as for every liberty-ops command.
The upgrade report
Each upgrade and each rollback records a report: versions before and after, image tag, compose files, backup folder, doctor findings, the result of every step and the migrations applied. It is stored with the configuration (.versions/upgrades/), and on Docker a copy is also written in the backup folder.
Open it in Liberty Next → Deploy → History → Upgrades. Each entry shows its component:
| Entry | Recorded by |
|---|---|
| Stack | ./liberty upgrade, ./liberty rollback, liberty-ops upgrade — the report described above. |
| Framework, Apps | A change of version noticed when the server starts — shown with the release notes of the new version. |
<app> schema | liberty-admin migrate — the migrations applied to an application database. |
framework-schema | Columns the server added to its own tables when a new release needed them. |
Schema migrations
The framework creates and completes its own tables when it starts. The licensed apps' databases change through migrations shipped in the apps wheel:
./liberty upgradeandliberty-ops upgradeapply them;./liberty status,./liberty doctorand the server log at start-up say when some are pending;./liberty migrate --dry-runlists them,./liberty migrateapplies them;- with
LIBERTY_AUTO_MIGRATE=1in.env, the server applies them itself at start-up.
Every run is recorded in Liberty Next → Deploy → History → Upgrades. For a database whose recorded version is ahead of its real tables, liberty-admin migrate --app nomasx1 --stamp <revision> sets the version without running anything, then applies what remains — see CLI.
Rollback
./liberty rollback # asks for confirmation
./liberty rollback --yes
The command starts again the image kept before the last upgrade and restores the backup taken just before it. Everything written since that backup is lost — hence the confirmation. The report of the upgrade is kept, and the rollback gets its own.
On a Python install, liberty-ops rollback reinstalls the previous framework version and restores the backup taken before the upgrade. pipx keeps no copy of the previous apps wheel: pass it with --apps <previous wheel> to downgrade the apps too.
To go back further than the last upgrade: ./liberty restore <backup folder> and ./liberty upgrade --tag <release>.
Docker Swarm
./liberty does not drive a swarm. Take a backup with ./backup.sh, then:
docker service update --image ghcr.io/fblettner/liberty-next:7.0.58 liberty_liberty-next
docker exec -u liberty $(docker ps -qf name=liberty_liberty-next) liberty-admin migrate
docker service rollback liberty_liberty-next # if something is wrong
Or set LIBERTY_IMAGE_TAG in .env and run ./deploy-swarm.sh again.
Versions
| Change | What to expect |
|---|---|
Patch (7.0.57 → 7.0.58) | Fixes and features; the configuration stays compatible; database changes only add tables or columns. |
| A larger step | The release notes say what to check before and after. |
Read the release notes before upgrading: Liberty Next → Document → Release notes shows those of the running version.
Tips
- Pin the release in production (
--tag) and upgrade on purpose, a test server first. - Run
./liberty doctorbefore the upgrade: a problem reported there is easier to fix before than after. - After the upgrade, sign in, open a screen of each application and run a Nomaflow job by hand.
- Keep the backup of the upgrade until the next one has run.