Backup and restore
This page covers the reference installation (deploy/). For a host install, the same three things are needed: a pg_dump of the database, the vault key file, and your configuration. The deb package's paths are in the section on the deb package below.
What a backup holds
| Item | In backup.sh output | Why it matters |
|---|---|---|
The PostgreSQL database (database.dump, pg_dump -Fc) | yes | The tree, settings, users and their sessions, incidents, timeline, audit log, notification history, scan history, and the encrypted credentials. |
The vault master key (vault.key, 32 bytes) | yes, unless --without-key | Without it the credentials in the dump cannot be decrypted. There is no recovery: a lost key means re-entering every credential. |
The template directory (templates.tar, the templates volume) | yes | Device templates you wrote, and those imported from LibreNMS. The imported ones can be imported again; your own cannot. |
.env (as deploy.env) and Caddyfile | yes | The deployment configuration. .env holds the database password. |
Caddy's certificates (caddy-data volume) | no | Caddy obtains or issues new ones. With a public domain this costs one certificate request; with the internal authority, browsers must trust the new root again. |
| The container image | no | Rebuild it from the same source revision, or pull the same tag. |
The probe CA (probe_ca table) | yes, inside the dump | Its private key is sealed with the vault master key, so the dump plus the key keeps every paired probe trusted. See probes. |
| Samples held by remote probes | no | They stay on the probe until it reconnects and replays them, after a restore too. |
The key and the dump must be backed up, but kept apart where you can. The dump alone gives an attacker nothing readable. The dump plus the key gives them every credential. Run ./backup.sh --without-key and copy the key to a separate secret store (a password manager, an encrypted USB stick, a sealed envelope), or encrypt the whole backup directory before it leaves the host. Back the key up once when you install: it never changes unless you rotate it.
Backups are plain files in a directory with mode 0700 containing files with mode 0600. They contain a password and, unless you leave the key out, the key. Treat them as secrets.
Back up
From deploy/, with the stack running:
./backup.sh # to ./backups/probeward-<UTC time>/
./backup.sh --output /srv/backups/probeward-today
./backup.sh --without-key # database and configuration onlyThe script runs pg_dump -Fc inside the PostgreSQL container, which gives a consistent snapshot without stopping anything, and reads the key and a tar archive of the template directory out of the Probeward container. It writes SHA256SUMS for the files. Run it from cron at the interval your recovery point needs, and copy the result off the host.
To fetch the key by hand:
docker compose exec -T probeward cat /var/lib/probeward/vault/vault.key > vault.key
chmod 600 vault.keyThe deb package
The package keeps the same three things in these places, and you back them up by hand or from your own scheduler:
| Item | Where | How |
|---|---|---|
| The database | PostgreSQL | sudo -u postgres pg_dump -Fc probeward > probeward-$(date +%F).dump on the database host. |
| The vault key | /var/lib/probeward/vault/vault.key | sudo cp -p it to a secret store apart from the dumps. It never changes unless you rotate it, so once is enough. |
| The configuration | /etc/probeward/probeward.env | sudo cp -p. It holds the database password. |
The template directory, if you set PROBEWARD_TEMPLATE_DIR | That directory | Copy it with the configuration. Templates imported from LibreNMS can be imported again. |
To restore onto a clean host: install the package, stop the service, put the old key in place (/var/lib/probeward/vault/vault.key, owner probeward, mode 0600, replacing the one the package made), restore the environment file, create an empty database owned by the role, pg_restore --no-owner --role=probeward -d probeward probeward.dump, and start the service. See install for what the package does with the key.
Restore onto a clean install
On the new host, check out the same version of the repository and run
./install.sh. This starts an empty Probeward with its own new key and a new.env. Use the same--domainand ports you want to run with.Copy the backup directory to the host, and the key if you kept it apart.
Restore:
sh./restore.sh --yes backups/probeward-20261128T000000Z ./restore.sh --yes --key /safe/place/vault.key backups/probeward-20261128T000000Z # key kept apartThe script stops Probeward and Caddy, drops and recreates the
probewarddatabase, loads the dump withpg_restore --exit-on-error, writes the key into the vault volume with the owner and mode the server requires, replaces the contents of the templates volume withtemplates.tar(a backup made before templates were backed up has none, and the volume is left as it is), starts the stack and waits for it to be healthy. It insists on--yesbecause it destroys the current data and replaces the current key. It does not touch.envor the Caddyfile: readdeploy.envin the backup for the settings of the old installation and copy what you need.Sign in with a user from the backup. If a user has two-factor login, the same authenticator works: the secret came across in the dump and is decrypted with the restored key.
If the key does not belong to the dump, Probeward refuses to start and says which two keys disagree:
cannot open the credential vault: vault key file /var/lib/probeward/vault/vault.key does not match this
database: the credentials were encrypted under key cea08a696c7ea2e9, the file holds key 8f01ab194a8e6208.
Start with the key file that belongs to this databaseRun ./restore.sh --yes again with the right key; nothing else needs undoing.
After a restore the monitoring runtime starts polling again as soon as the stack is up. Check the timeline: history keeps a gap for the time between the backup and the restore.
Upgrade
An upgrade starts with a backup, and rolling back is a restore of it onto the previous version. Both are described in upgrade.
Rehearsal record: 2026-11-28
Rehearsed on one machine with Docker Compose under a throw-away project name, ports 18080 and 18443, the image built from this repository (probeward:local, version 0.1.0). The monitoring runtime was not part of this build, so the instant controls answered 503; nothing here depends on it.
| Step | What was done | Result |
|---|---|---|
| 1. Install | ./install.sh --http-port 18080 --https-port 18443 | Stack healthy; GET /api/v1/setup answered {"needed":true}. |
| 2. Create data through the API | First administrator admin through POST /api/v1/setup; a second user viewer1 (viewer); TOTP enrolled and confirmed for admin (its secret is stored in the vault); group Servers; device loopback (127.0.0.1); sensors Ping and Probeward HTTP port (tcp_port, port 8080); credentials Core SNMP (snmp_v2c) and Webhook URL (secret); destination Ops webhook using that credential. | All created with 201. The credential list showed only id, name, kind and usage. |
| 3. Restart | docker compose restart | The tree and the administrator's session survived. |
| 4. Back up | ./backup.sh --output backups/rehearsal-2026-11-28 | database.dump 64,591 bytes, vault.key 32 bytes, checksums written, directory mode 0700, files 0600. |
| 5. Destroy | docker compose down -v, rm .env | All four volumes removed. |
| 6. Clean install | ./install.sh again | New database password, new key (the first bytes of the vault key differed from the backed-up one), {"needed":true}. |
| 7. Restore | ./restore.sh --yes backups/rehearsal-2026-11-28 | Stack healthy. |
| 8. Verify | Logged in as admin with the password. | second_factor_required: true. |
| Computed the TOTP code from the secret saved before the backup and sent it. | Accepted: a session was created. This decrypts a vault entry, so the restored key opens credentials stored before the backup. | |
| Listed the tree, credentials and destinations. | Group, device, both sensors, both credentials and the destination were back, with their original ids. | |
| 9. Negative test | ./restore.sh --yes --key <random 32 bytes> ... | Probeward refused to start with the "does not match this database" error above. A second restore with the real key recovered. |
| 10. Tear down | docker compose down -v | All volumes and the network removed. |
Not verified: a notification sent through the restored Webhook URL credential and a poll of the restored sensors, both of which need the monitoring runtime; and restore across two different versions of Probeward.