Upgrade to a new release
Before you begin
- You need
- Shell access to the host, as a user who may use Docker
- The new release's bundle, and a recovery key for the backup it takes
./mockhub upgrade moves an installation to a new release. It checks everything it can before anything stops, then takes a complete backup and installs the release in the same maintenance window.
-
Unpack the new release’s bundle beside the installation, not over it, for example in
/opt/mockhub-releases/. -
Run, from the installation directory:
Terminal window ./mockhub upgrade /opt/mockhub-releases/mockhub-v1.4.0-amd64 -
If it stops because the new release needs a setting with no default, set it in
.envand run the same command again. Nothing has changed yet.
Before anything stops
Section titled “Before anything stops”upgrade refuses, with nothing changed, unless:
- The kernel, and the Docker Engine and Compose versions, meet the new release’s requirements, which its verified bundle names.
- The app is running and answers, so the licence can be read.
- On an installation under a licence, the licence’s support period, Updates until on Admin → Licence, covers the new release’s date.
- The bundle’s signature verifies with a key in
keys/, and every file matches its manifest, before anything of it runs. - The bundle is for this host’s architecture, is not the installed release, and lists the installed release among those it upgrades from.
- Its images load from the bundle, or are pulled for a bundle without them unless
--no-pullis given, and each matches its recorded ID. - Its compose file works with this
.env, and its edge configuration is valid. - There is room for a backup.
Settings the new release adds are taken from its env.template, and the new secrets it needs are generated. The installed release’s files are kept in releases/, the last three.
The window
Section titled “The window”MockHub is unavailable from here until the upgrade ends:
- The scheduler stops, ingress closes behind a maintenance page, the app stops, the queues drain and the workers stop.
- A complete backup is taken and verified, as
./mockhub backuptakes one. If it fails, nothing has changed: the installed release reopens and the upgrade ends. - The new release’s files replace the installed ones, and its own script continues: database migrations, the release’s tasks (the packaged plans, the stored credentials, every project’s mocks on WireMock), the app and the workers, checks behind the closed ingress, ingress opened, checks through the public listener, and the scheduler last.
Result
Section titled “Result”The installation runs the new release, and state/upgrade-history has a line for the upgrade. The backup the window took is a complete recovery set like any other.
If a step fails
Section titled “If a step fails”Every step is recorded in state/upgrade. A step that fails before ingress opens leaves ingress closed, so nobody uses a half-upgraded installation. Just before ingress opens, upgrade records that the new release may serve traffic from then on, and keeps ingress closed if it cannot record it. Two checks come after that point:
- The check through the public listener: if it fails, ingress closes again.
- The scheduler: if it fails, MockHub keeps serving, but no scheduled job runs.
After either, the new release may have taken writes. The message, and ./mockhub status until the upgrade ends, say which step stopped and why, whether ingress is open, whether the new release may have served traffic and since when, and which backup the upgrade took. Then:
-
Fix the cause and resume. Every step after the backup is safe to repeat, and migrations and release tasks that finished are not run again:
Terminal window ./mockhub upgrade --resume -
Roll back, if ingress never opened. The previous release’s files come back from
releases/, and the upgrade’s backup is restored with them,.envincluded:Terminal window ./mockhub upgrade --rollback --kit-key ~/mockhub-kit.key -
Roll back after the new release may have served traffic, only once you have decided with the people using the installation to lose what was written since. Restoring the backup discards every write made after it, so a plain
--rollbackis refused at this point and nothing changes. Name the backup the refusal prints:Terminal window ./mockhub upgrade --rollback --kit-key ~/mockhub-kit.key --restore-point 20261125T030000Zstate/upgrade-historyrecords that choice, who made it and since when the release may have served traffic, without the key.
A release task that failed leaves its report, with its output, in state/upgrade-tasks.json. install and backup refuse while an upgrade is unfinished.
Limits
Section titled “Limits”- Every upgrade is downtime: the drain, a full backup and the new release’s start, in one window.
- Releases cannot be skipped past what a release upgrades from. Its manifest lists the releases it accepts; upgrade through an intermediate release when yours is not among them.
- The licence’s support period bounds the releases, never the running installation: a licence whose support period has ended keeps the installed release running, and
upgraderefuses a release dated after it until a renewal is installed. - A rollback restores the backup, not just the files: it is the only way back across a database migration, and it loses whatever the new release took in after ingress opened.