Skip to content

Updates (OpenBSD)

flyingmonit-update runs every minute from root's cron. It is quiet when there is nothing to do. When there is a newer release – or the same release's build for an upgraded OpenBSD (below) – it:

  1. downloads it and its SHA256.sig, and checks the signature with /etc/signify/flyingmonit.pub – a release that does not match is not installed;
  2. copies the database to /home/flyingmonit/backups/<date>-<old version>/ while FlyingMonit still runs (a consistent copy), and only then stops it;
  3. migrates the database with the new release – only if it brings a new migration – while the old one runs, starts the new release beside it on relayd's other address, waits for its /health, enables it in relayd, waits until relayd's own check has found it up, then takes the old one out of relayd and stops it a few seconds later: FlyingMonit is not down, an open page reconnects once. Without the second address in relayd's table (setup), after an OS upgrade and for a migration that needs it, it stops the old release first and logs how long FlyingMonit was down ("down for 6 s");
  4. when the new release does not answer /health, or relayd does not find it up, it stops it and the old one runs on; when it stopped the old release first, on a failed migration or health check, it starts the old release with the database copy again (the reports of the few seconds between the copy and the stop are lost; the agents send their events again);
  5. installs the new release's own flyingmonit-update and rc.d script – never the key: which key a release is checked with stays your choice;
  6. keeps the 3 newest releases and the 10 newest backups.

It never installs an older version. What it changes or what fails goes to syslog (/var/log/messages) and, through cron, to root's mail. To update now: /usr/local/sbin/flyingmonit-update.

Exit code Meaning
0 Up to date, or updated
1 /etc/flyingmonit-update.conf missing or incomplete
2 The newest version or a file could not be downloaded
3 The signature does not match: nothing installed
4 Unpacking or the migration failed: the old release runs again
5 The new release did not answer /health, or relayd did not find it up: the old release runs again
6 The rollback failed too: FlyingMonit is down, look at it
7 Updated, but the release's own scripts could not be installed

Upgrading OpenBSD

Each release is built for one OpenBSD release (FlyingMonit's Erlang links against the system's libraries), and the registry holds a build for both supported releases. Upgrade OpenBSD as usual:

sysupgrade          # reboots into the new release
sysmerge
pkg_add -u
reboot

Within a minute flyingmonit-update notices that the system is no longer the one the running release was built for (it remembers that in /home/flyingmonit/current/.target) and installs the same version's build for the new release: it copies the database to backups/, stops FlyingMonit, starts the new build and waits for /health – it logs "this system is openbsd-8.0_arm64 now, … was built for openbsd-7.9_arm64". There is no going back to the old build: it does not run on the new system. Check it with rcctl check flyingmonit and tail /var/log/messages.

An installation from before FlyingMonit 0.1.48 does not know its build yet; there, once after the upgrade:

rcctl stop flyingmonit
rm /home/flyingmonit/current
/usr/local/sbin/flyingmonit-update