Backup and restore
Automatic: the service postgres-backup writes a dump to postgres_backups on startup and then every
24 hours and keeps 14 days. In addition a dump is created before every schema migration (the last 5 are kept).
Manual: ./opnexus backup immediately writes manual-<time>.dump.
Full backup (recommended): the dump alone is not enough to rebuild an OPNexus server,
because the secrets live in separate volumes. ./opnexus backup --full [FILE] packs the database
and all secret volumes (firewall credentials, two-factor, VPN and certificate keys,
configuration backups) into one file encrypted with a passphrase (.opxfull). The passphrase
is asked for (or OPNEXUS_BACKUP_PASSPHRASE). On a fresh installation (same or
newer version) ./opnexus restore FILE restores everything: it checks the file, asks for confirmation, stops the
services, creates a safety copy of the current state, restores database and volumes and
restarts. Not included: log collection and measurements. Keep file and passphrase apart from the server.
With --with-env and --with-ca the full backup also includes the .env and the proxy's internal CA
(caddy_data); ./opnexus restore FILE --with-env --with-ca restores them. From the .env the
restore takes everything except the database credentials, the version and the addresses of the target server (POSTGRES_*,
OPNEXUS_VERSION, OPNEXUS_IMAGE_REPO, OPNEXUS_SITES, OPNEXUS_DEFAULT_SNI, FRONTEND_ORIGIN, *_BIND_ADDRESS,
OPNEXUS_GUI_SITES); it shows the adopted names and asks. The saved file then lies completely
next to it as .env.from-backup, the previous one as .env.before-restore. With the CA, browsers that already
trust it also trust the new server. ./opnexus status shows when the last full backup was made.