Skip to content
Kaiov0.8.0

Upgrading

Migrations are compiled into the binary and run at startup. They only move forward: once a newer version has opened the database, an older one may refuse to start or misread the schema, and nothing migrates back down.

So the order matters, and it is the same on every install:

  1. Back up /var/lib/kaio and the binaries.
  2. Upgrade.
  3. Check it came up.

Skipping step 1 is the only way to lose a stack history, and it is the step people skip.

Terminal window
sudo sqlite3 /var/lib/kaio/kaio.db ".backup '/backups/kaio.db'"
sudo tar czf /backups/kaio-$(date +%F).tar.gz -C /var/lib kaio
sudo cp /usr/local/bin/kaio-server /usr/local/bin/kaio-cli /backups/

The binaries are what lets you come back: the installer always fetches the latest release, so it cannot put an older one back.

Copying kaio.db alone while the server runs is not a backup: recent writes sit in the -wal file until a checkpoint. Backup and restore explains what that directory holds and why the three files travel together.

Run the installer again, as root:

Terminal window
curl -fsSL https://kaio-labs.gaidot.net/install.sh | sh

It fetches the latest release, keeps /etc/kaio/kaio.env, replaces both binaries, which carry the dashboard with them, and restarts the service only if it was already running. See Installation for the layout it writes.

Coming from an install before 0.3.8, this run also moves your configuration from /etc/kaio.env to /etc/kaio/kaio.env, unchanged, and leaves a symlink at the old path. It touches nothing in /etc/kaio/monitoring either: the monitoring stack you installed stays as you left it, and a file a release changed and you had edited arrives beside yours as <name>.new rather than over it.

Terminal window
kaio-cli health
kaio-cli stack ls

health reports the version now answering, so it is the quickest confirmation that the new binary is the one serving. stack ls confirms the migration found your stacks.

In a cluster, upgrade the control plane last and check the registry afterwards: a node running an older version still answers, and its reported version is visible in kaio-cli node ls.

The containers Kaio deployed are ordinary Compose projects owned by the Docker daemon, not by Kaio. Stopping, replacing and restarting Kaio leaves them running, and an upgrade never recreates them on its own. What a stack loses during the restart is the live view: metrics, the event stream, and any open log or shell session.

There is no downgrade path for an applied migration, so returning to a previous version means restoring the state it knew:

  1. Put back the binaries you set aside: sudo install -m 755 /backups/kaio-server /backups/kaio-cli /usr/local/bin/.
  2. Restore the /var/lib/kaio backup taken before the upgrade.
  3. Restart on both: sudo systemctl restart kaio.

Step 1 takes the dashboard with it: the UI is compiled into kaio-server, so a rollback cannot leave a newer page talking to an older API.

A backup taken after the upgrade carries the newer schema and will not help. That is the whole reason the backup comes before the upgrade.

Kaio, built by Régis Gaidot