OPNexus Deutsch Install

← Back to home

opnexus – the command-line tool

With opnexus you update OPNexus with one command, roll back when something goes wrong and back up the database – without hand-editing containers or the database.

Overview

opnexus is a Bash script for installations that run from ready-made release images. It sits next to the docker-compose.yml in the release bundle and knows these commands. status, update, rollback, backup and password are described in detail below; for the others the manual has what you need:

CommandWhat it does
opnexus statusShows the version, the services and the database revision.
opnexus update [VERSION]Pulls new images, switches, waits for “healthy” and rolls back automatically if something fails.
opnexus rollbackUndoes the last update, including the database when needed.
opnexus backupWrites a database backup right away.
opnexus password [NAME]Sets a new random password and shows it once.
opnexus backup --full / opnexus restore FILEA full backup of the database and all secrets in one encrypted file, and restoring it.
opnexus migrate-host TARGETMove to another server that already has OPNexus installed: stop the source, back up, restore at the target, verify.
opnexus ha …Set up and operate high availability (warm standby), e.g. ha prepare, ha init, ha status, ha promote, ha update.
opnexus export / opnexus apply FILEConfiguration as code: export central objects as YAML; check a file and take it over into the drafts (--dry-run for CI). Never writes to a firewall.

On Windows and macOS the script does not run directly (it needs Linux tools). Run it from its Docker image there, in the OPNexus folder: docker run --rm -it -v /var/run/docker.sock:/var/run/docker.sock -v "$PWD:/project" ghcr.io/opnexus-dev/opnexus-updater:latest opnexus status (PowerShell: ${PWD} instead of $PWD). Details in the guides for Windows and macOS.

Where the images come from and how to verify them

Source code, tags and release bundles are on GitHub; the finished images are in the GitHub Container Registry (GHCR). A second registry holds copies with identical digests as a fallback.

WhatWhere
Source code, tags, changelog, manualgithub.com/OPNexus-dev/OPNexus
Release bundle (compose file, opnexus, cosign.pub)GitHub Releases
Images (default, amd64 and arm64)ghcr.io/opnexus-dev/opnexus-backend, -frontend, -proxy, -updater
Fallback registry, identical digestsgit.opnexus.dev/opnexus/opnexus-…
Version tracks1.42.3 (fixed), 1.42, 1, latest

Every image is built once, signed with cosign and then copied to the second registry with an identical digest: the same version has the same digest and signature in both registries. opnexus update verifies the signature before switching as soon as cosign is installed. By hand:

cosign verify --key cosign.pub --insecure-ignore-tlog=true ghcr.io/opnexus-dev/opnexus-backend:1.42.3

This needs cosign 3 or newer. With cosign 2.x the message is no signatures found, even for a validly signed image: check cosign version first and update if it shows 2.x. If it shows 3.x and the message stays, the image has no valid signature, so do not use it. opnexus update stops with cosign 2.x without changing anything.

You will find the public key cosign.pub in the release bundle and in the repository. To use the second registry, set OPNEXUS_IMAGE_REPO=git.opnexus.dev/opnexus in your .env.

Requirements

cd /opt/opnexus-1.42.3
./opnexus status

status

Shows what is running and, if there is one, the last update that can be rolled back.

$ ./opnexus status
Image-Repo:        ghcr.io/opnexus-dev
OPNEXUS_VERSION:   1
Laufende Version:  1.42.3
DB-Revision:       0036
backend: healthy
frontend: healthy
proxy: running

OPNEXUS_VERSION is the “track” the installation follows: a fixed version (1.42.3), a minor track (1.42), a major track (1) or latest. The labels in the output are in German, the tool's output language.

update

./opnexus update            # follow the track chosen in .env
./opnexus update 1.42.3     # fixed version
./opnexus update 1.42       # newest 1.42.x

How it runs, step by step:

  1. Read the state. If the backend is not running or does not answer, the tool stops – repair first, then update.
  2. Pull the images. Nothing changes on the running system meanwhile. If the pull fails, nothing was changed.
  3. Remember the old state (file .opnexus-update-state) so a rollback knows where to go.
  4. Switch. OPNEXUS_VERSION is set in .env, then docker compose up -d --no-build runs. If the new version needs a database migration, the backend backs the database up itself first (pre-upgrade-….dump).
  5. Wait until backend, frontend and proxy are healthy (240 seconds at most).
  6. On failure the tool shows the backend log and rolls back automatically.

Read the changelog before updating. An update usually takes only the services' restart; the web interface is briefly unavailable.

rollback

./opnexus rollback

Puts the installation back to the state before the last update: onto exactly the image tag that was set before.

Important: log history and resource measurements are not part of the backups and are empty after a database rollback. Everything else – hosts, rules, users, audit history – is back to its state before the update. Only one step is rolled back (the last update).

backup

./opnexus backup

Writes a backup as manual-<time>.dump into the Docker volume postgres_backups. The data of the two large tables (firewall logs and resource measurements) is deliberately left out, otherwise the dump would be huge; all settings and the change history are included. A companion container also writes automatic backups into the same volume on a regular basis.

docker compose exec postgres-backup ls -l /backups

password

./opnexus password            # set a new password for the admin
./opnexus password anna       # for a specific user
./opnexus password --yes      # without the confirmation

Sets a new random password, shows it once and ends all sessions of the account. Meant for a fresh install (the password generated on first start appears in the log only once) and for a forgotten admin password.

Configuration

SettingEffect
OPNEXUS_DIRFolder with docker-compose.yml and .env, if not the script's own.
OPNEXUS_UPDATE_TIMEOUTSeconds to wait for “healthy” (default 240).
OPNEXUS_NO_AUTO_ROLLBACK=1No automatic rollback after a failed update; the state stays for analysis, manually: opnexus rollback.
.env: OPNEXUS_IMAGE_REPO, OPNEXUS_VERSIONRegistry and track of the installation.
.env: POSTGRES_USER, POSTGRES_DB, POSTGRES_PASSWORDDatabase access for backup and rollback (default user and database: opnexus).

Safeguards

Troubleshooting

The tool prints its messages in German. The most common ones:

MessageWhat to do
“OPNEXUS_IMAGE_REPO ist in .env nicht gesetzt”The installation does not run from release images. Either switch to release images or update locally with git pull && docker compose up -d --build.
“Pull fehlgeschlagen — nichts wurde verändert”Is the registry reachable? Does the version exist? Then simply try again.
“Backend läuft nicht oder antwortet nicht”Repair first (docker compose logs backend), then update.
“Update nicht gesund geworden”The backend log follows; the tool rolls back by itself. With OPNEXUS_NO_AUTO_ROLLBACK=1 the state stays for analysis.
“Kein Update-Zustand … nichts zurückzurollen”A rollback only works after an opnexus update (it needs the state file that update created).
“Datenbank wurde migriert, aber es gibt kein pre-upgrade-Backup”The backup before the migration is missing (for example because of SKIP_MIGRATION_BACKUP). The backend stays stopped; intervene manually. Your own opnexus backup helps in future.

Limits

More help

If the only admin is locked out without an authenticator and without recovery codes, this command switches off two-factor sign-in for one account on the server (it needs shell access to the server):

docker compose exec backend python -m app.reset_2fa USERNAME

The full guide is in the handbook and the README (section “Release images & CI”).