Appearance
Upgrade and roll back Since v0.2
You upgrade by installing the newer package over the old one. Before the service restarts on the new binary, the package writes a verified backup of the old store. The new binary then migrates the store forward. Going back uses that backup.
Supported: from a released version to a newer one. v0.1.0 to v0.2 is the first tested path. Not supported: downgrading in place, because the store is migrated forward only and an older binary refuses a newer store by design. Upgrading from a development build is refused unless you accept the risk with -allow-unreleased.
Before you begin
- Role: shell access with
sudoon the node. - The new package, and (for the check) its binary extracted with
dpkg-deb -x. - Free disk space for the backup.
Check the upgrade
waap upgrade check changes nothing. It reports the store schema and the release it came from, the schema the new binary migrates to, and whether the new binary can read the configuration file and the active version in the store (unknown keys are named). It also reports free disk space for the backup and, on a running pair, the peer's version.
sh
sudo -u waap waap upgrade check -config /etc/waap/waap.yaml -data-dir /var/lib/waap -to /tmp/new/usr/bin/waapIt refuses unsupported jumps with exit code 1 and one REFUSED: line per reason. Without -to the check uses the waap it runs from. Run it as the service user or as root.
Flags
| Setting | What it does | Default | Allowed values | Applies in |
|---|---|---|---|---|
-config | The configuration file the service runs with. | none | file path | check, run |
-data-dir | The data directory. | /var/lib/waap when it holds a database, else data | directory | check, run, rollback |
-backup-dir | Where the pre-upgrade backup goes. | <data-dir>/backups | directory | check, run |
-to | The new binary to check against. | the running binary | file path | check, run |
-allow-unreleased | Accept a store written by a development build. | off (env WAAP_UPGRADE_ALLOW_UNRELEASED=1 sets it) | on, off | check, run |
-backup-only | Write the backup and stop. This is what the package hook runs. | off | on, off | run |
-passphrase-file | Read the backup passphrase from this file. | generated into <backup>.key | file path | run, rollback |
-events | Include security events in the backup. | auto | auto, yes, no | run |
With auto, events are included up to 512 MiB of database and left out above that.
Upgrade a package install
sh
sudo apt install ./waap_0.2.1-1_amd64.deb
# RHEL family: sudo dnf install ./waap-0.2.1-1.x86_64.rpmThe package's post-install step runs waap upgrade run -backup-only as the waap user before anything restarts on the new binary. The new binary reads the old store without migrating it, writes /var/lib/waap/backups/pre-<version>-<time>.waapbak in the old version's format and reads it back to verify it. The passphrase goes to <same name>.waapbak.key (mode 0600). Then the service restarts and the new binary migrates the store, forward only, in one transaction per migration. Configuration edits are kept. Installing the same package again changes nothing.
A failed check or backup blocks the start
If the check or the backup fails, the install stops with a message. The service is not restarted, the store is untouched, and the file /var/lib/waap/upgrade-blocked is left behind. waap.service, waap-control.service and waap-inspect.service refuse to start while it exists, also after a reboot, so the new binary never migrates the store without a backup.
To clear the block, fix the cause first.
.deb: dpkg stops with an error. Fix the cause, then runsudo dpkg --configure waap..rpm: rpm printswarning: %post(waap-...) scriptlet failed, exit status 1and exits 0, with the new files in place. Fix the cause, then run the backup by hand, which removes the block, and start the service.
sh
sudo -u waap waap upgrade run -backup-only -config /etc/waap/waap.yaml -data-dir /var/lib/waap
sudo systemctl start waapUpgrade without a package
For a tarball install or a manual upgrade, stop the service and run the same command without -backup-only. It writes the backup, then migrates.
sh
sudo systemctl stop waap
sudo -u waap waap upgrade run -config /etc/waap/waap.yaml -data-dir /var/lib/waapRoll back
Rollback needs the old version's binary, because the old binary restores the old store format. Get it from the old package with dpkg-deb -x waap_<old>.deb /tmp/old; it is /tmp/old/usr/bin/waap.
sh
sudo systemctl stop waap
sudo -u waap waap upgrade rollback -data-dir /var/lib/waap -old-binary /tmp/old/usr/bin/waap
sudo apt install ./waap_<old>.debrollback finds the newest pre-*.waapbak in <data-dir>/backups (or the file you give with -backup), and reads its passphrase from the .key file (or -passphrase-file). It moves the current waap.db and traffic.db to <data-dir>/rolled-back-<time>/, which it keeps and never deletes. Then it runs the old binary's restore into the fresh data directory. If the restore fails, the moved files are put back. -dry-run prints the plan.
What you lose
New events and configuration versions made after the upgrade are not in the old store. They stay in rolled-back-<time>/. Remove that directory when you are sure.
A manual rollback is the same three steps: stop the service, move waap.db* and traffic.db* aside, run old-waap restore -i pre-....waapbak -data-dir /var/lib/waap (the passphrase is in the .key file), then install the old package.
Upgrade a high-availability pair
Upgrade one node at a time: the standby first, switch over, then the other node.
- Nodes may run different patch versions and one minor version apart (v0.1 and v0.2).
- A node that is newer than its peer by more than one minor version refuses to replicate and says why. The HA status shows the error and a system event is recorded.
- An older node does not follow a newer one. It reports that it must be upgraded.
Fix both cases by upgrading the older node to within one minor version.
Limits
| Limit | Value |
|---|---|
| Downgrade in place | Not supported; use the backup and rollback. |
| Events in the pre-upgrade backup | Included up to 512 MiB of database (-events auto). |
| Version distance in a pair | One minor version. |
Troubleshooting
The service does not start after an upgrade and upgrade-blocked exists. Cause: the pre-upgrade check or backup failed. Check: ls /var/lib/waap/upgrade-blocked and the package output. Fix: remove the cause, then run waap upgrade run -backup-only as above.
An old binary refuses the store. Cause: the store was migrated by a newer version. Fix: use waap upgrade rollback; do not point the old binary at the new store.
A pair node refuses to replicate. Cause: more than one minor version apart. Check: System > High availability. Fix: upgrade the older node.