Updating OPNexus
An update replaces only the code; the data stays in the volume, the configuration in
the .env.
With opnexus (a single Bash file, needs only Docker; in the directory with
docker-compose.yml and .env, or set OPNEXUS_DIR=…):
| Command | Effect |
|---|---|
opnexus status | version, database revision, state of the containers |
opnexus update [VERSION] | pulls the new images before anything is touched, switches, waits until everything is "healthy", otherwise automatic rollback |
opnexus rollback | restores the version and, if the update migrated the database, the database from the backup before the update |
opnexus backup | immediate database backup |
opnexus password [USER] | set and display a new random password |
status, update and rollback need release images (OPNEXUS_IMAGE_REPO
set); backup and password work in any installation.
The output language of the tool follows OPNEXUS_LANG (de or en), otherwise your locale (LC_ALL, LANG):
German with a German locale, English otherwise.
OPNEXUS_VERSION in the .env is the track: 1.16.0 pins exactly, 1.16 follows
patch releases, 1 follows all 1.x. Without an argument opnexus update fetches the newest
version of the track, with an argument the track is switched. After a rollback the
version is pinned to the old state.
The Compose file comes along (from 1.34). opnexus update also adopts the docker-compose.yml of the target release
so that new service settings arrive. It comes from the signed updater image (only with cosign and
cosign.pub, like the CLI itself). The previous file stays as docker-compose.yml.bak-<version>, a
rollback puts it back. If you have customised the file yourself (it differs from the one last adopted), it stays
unchanged; the new version then lies next to it as docker-compose.yml.new. Your own customisations therefore belong
in a docker-compose.override.yml in the same directory: Compose reads it automatically, and updates can
keep replacing the main file. On the first update with this function no checksum is known yet; then
it is replaced and diff docker-compose.yml.bak-<version> docker-compose.yml shows what changed.
OPNEXUS_NO_COMPOSE_REFRESH=1 switches the adoption off.
Rollback with database restore means: everything is back to the state before
the update, whatever was written afterwards is gone, and log history and
measurements are empty. Beforehand the tool creates a safety copy of the current
state (pre-rollback-….dump), checks that the backup is readable and restores
the copy on an error. If the update did not change the database,
nothing is restored. OPNEXUS_UPDATE_TIMEOUT (seconds, default
240) extends the waiting time for long migrations, OPNEXUS_NO_AUTO_ROLLBACK=1
switches off the automatic rollback.
Changing the registry (by hand only). Existing installations stay with the registry that is in their .env
(OPNEXUS_IMAGE_REPO); neither opnexus update nor a rollback, a restore or a bundle ever changes it.
Whoever wants to switch from git.opnexus.dev/opnexus to ghcr.io/opnexus-dev (or back) does so separately from a
version update and first verifies the signature of the running version in the new registry:
opnexus status # note the running version
cosign verify --key cosign.pub --insecure-ignore-tlog=true \
ghcr.io/opnexus-dev/opnexus-backend:<running version> # same digest as in the old registry
sed -i 's|^OPNEXUS_IMAGE_REPO=.*|OPNEXUS_IMAGE_REPO=ghcr.io/opnexus-dev|' .env
docker compose pull && docker compose up -d --no-build # same images; Compose may recreate backend, frontend and proxy (short interruption)A rollback starts the previous version with docker compose up --no-build; if its image is missing locally, Compose pulls it from
the registry in the .env. After a switch the previous version must therefore be there too; check this with the same
cosign verify for the previous version before you switch. If a tag is missing, an update aborts with "Pull failed —
nothing was changed", a rollback would fail.
Installations built from source are updated with
git pull && docker compose up -d --build.
Schema migrations run when the backend starts: if the database is behind the code version, a dump is created first; if it fails, no migration happens and the start aborts with a clear message. Then the migration runs in one transaction, an error rolls everything back. If a newer version has already migrated the database, older code does not start (start the newer version or restore a backup). There is no schema downgrade, the way back is the backup. Installations up to 1.8.x go to 1.9.x first.