Command line tool (opnexus)
The opnexus command line tool updates, rolls back, backs up and moves an OPNexus installation and manages its high availability. It is a Bash script that ships in the release bundle next to docker-compose.yml and needs Docker with Compose v2.
Running it#
bash
cd /opt/opnexus-<version> # the folder with docker-compose.yml and .env
./opnexus statusFrom any other folder, point it at the installation: OPNEXUS_DIR=/opt/opnexus-<version> ./opnexus status. Output is in English or German: OPNEXUS_LANG=de or en decides, otherwise the system locale (LANG). On Windows and macOS see Installation on Windows and macOS.
Where each command is explained#
| Command | Guide |
|---|---|
update, rollback, status | Updating OPNexus |
updater enable, updater disable | One-click updates |
backup, backup --full, restore | Backup and restore |
migrate-host | Migration and emergency (cold standby) |
ha init, ha status, ha promote, ha resync, ha sync, ha update | High availability (warm standby) |
cert status, cert check, cert install, cert remove | Network access and TLS |
password | First start and password |
export, apply | Configuration as code |
Exit codes#
update:0running on the new version,3the update failed and was rolled back cleanly,1any other error.apply:0ok or no differences,2differences (with--dry-run),3file invalid,4blocked or outdated,1error.
Command reference#
This is the tool's own help text of release 1.42.3, exactly as ./opnexus help prints it:
text
opnexus — update, rollback and backup for an OPNexus installation from
ready-made release images (see README, "Release images & CI").
opnexus status Version, containers, database revision
opnexus update [VERSION] Pull new images, switch, wait until "healthy";
rolls back automatically on failure
opnexus rollback Undo the last update
opnexus updater enable Enable the updater for "one-click updates"; with
rootless Docker the socket path is detected and
written to the .env as DOCKER_HOST_SOCKET
opnexus updater disable Disable the updater and remove the container
opnexus backup Immediate backup of the OPNexus database
opnexus backup --full [FILE] [--with-env] [--with-ca]
Full backup: database AND all secrets (firewall
credentials, 2FA, VPN/certificate keys, configuration
backups) in one encrypted file (.opxfull). The
passphrase is asked for (or OPNEXUS_BACKUP_PASSPHRASE).
Optionally also the .env and the proxy CA (for a move).
opnexus restore FILE [--with-env] [--with-ca] [--yes]
Restore a full backup (overwrites the database and
secrets of this installation)
opnexus migrate-host TARGET [--dir PATH] [--yes]
Move to another server (ssh TARGET, OPNexus is already
installed there): stop the source, back up, restore at
the target, verify. See the handbook, "Migration".
opnexus ha init PARTNER --vip IP/LEN [--node-ip IP] [--peer-ip IP] [--node NAME] [--peer-node NAME]
[--peer-dir PATH] [--vip-dev INTERFACE] [--yes]
Set up a warm standby (Postgres replication over TLS, VIP, secrets sync).
opnexus ha status Role, epoch, replication lag, slot, last sync of both nodes
opnexus ha promote [--force] [--yes]
(on the standby) stop the partner (fencing), make this node primary
opnexus ha resync [--yes] (on the old primary/standby) rebuild this node as a standby
opnexus ha sync (on the primary; runs every 5 minutes via cron) secrets, proxy CA, .env to the standby
opnexus ha update [VERSION]
Update both nodes in the right order (standby first, then primary)
See docs/HANDBOOK.md, "High availability".
opnexus cert status [--json] Web certificate of the proxy: source, addresses, expiry
opnexus cert check --cert FILE --key FILE check without changing anything (JSON)
opnexus cert install --cert FILE --key FILE [--yes]
Check an own certificate (PEM, key without a passphrase), install it, restart
the proxy; if the proxy does not serve it, everything is rolled back
opnexus cert remove [--yes]
Remove the own certificate (back to the internal CA)
opnexus password [NAME] Set a new random password for the admin and
show it (--yes: without confirmation)
opnexus export [--out DIRECTORY] [--kinds a,b]
Configuration as code: all central objects as
YAML (opnexus-config.yaml), without credentials/keys.
opnexus apply FILE [--dry-run] [--prune] [--yes] [--json]
Check the file and apply it to the drafts. Shows the
plan first. Never writes to firewalls; rollout happens
afterwards as usual via preview → deploy.
Exit: 0 ok/no differences, 2 differences (--dry-run),
3 file invalid, 4 blocked/outdated, 1 error.
opnexus status --porcelain State as key=value lines (for the updater)