StatsRaven

DocsRun it

Updating StatsRaven

An update replaces one program. Your data stays in its folder, and the new version brings that folder up to date when it starts. This page covers doing it safely, what changes on the first start, and how to go back.

On this page
  1. The short version
  2. Before you update
  3. Update
  4. What happens on the first start
  5. Check that it worked
  6. When a release is not backward compatible
  7. Go back to an earlier version
  8. If it does not start

The short version#

  1. Read the release in the changelog. If it needs something from you, it says so at the top under Before you update.
  2. Make a backup of the data folder.
  3. Run the install command again, or pull the new Docker image.
  4. Check that it started and that data is coming in.

StatsRaven never updates itself and never checks for updates. You choose when to update.

Before you update#

Read the changelog#

Every release is listed in the changelog, newest first, and in its RSS feed. Most releases need nothing from you. When one does, such as a renamed setting or a changed sender setup, the release shows a Before you update box with exactly what to do. If you skip releases, read that box in each one you skip.

Releases are numbered like 0.2.1:

The last number
Changes for fixes and small improvements, such as 0.2.1 to 0.2.2. These never need anything from you.
The middle number
Changes when a release may need something from you, such as 0.2.2 to 0.3.0. The changelog says what, if anything.

Check your license#

A license covers the releases made while its updates are paid. Settings, License shows the date under Updates until. A newer release still starts and keeps your data, but Settings says it came out after your updates ended. See when updates end.

Make a backup#

Back up the whole data folder. It is the only way to go back to exactly where you were. Stop StatsRaven, copy the folder and start it again. It takes seconds, and senders such as Vector, Fluent Bit and the OpenTelemetry Collector hold their data while it is stopped.

sudo systemctl stop statsraven
sudo tar -czf statsraven-before-update.tar.gz -C /var/lib statsraven
sudo systemctl start statsraven

Keep the backup until you are happy with the new version. Name it after the version you are leaving, so you know which program reads it.

Update#

Terminal
curl -fsSL https://statsraven.com/install.sh | sh -s -- --service

The installer downloads the newest release, checks it, replaces the program and restarts the service. The data folder and /etc/statsraven/statsraven.env are left as they are. The service file in /etc/systemd/system is written again, so keep your settings in statsraven.env rather than in that file.

If you installed only the program, without --service, run the install command without it and restart StatsRaven the way you start it.

Install a given version#

To update to a version that is not the newest, or to stay on one:

Terminal
curl -fsSL https://statsraven.com/install.sh | STATSRAVEN_VERSION=0.2.1 sh -s -- --service

Every release and its files are listed at statsraven.com/download.

Skipping versions#

You can go from any release straight to any newer one. There is no need to install the ones in between: the first start applies every change your folder is missing, in order. Read the Before you update box of each release you skip.

Updating on a schedule#

If a tool such as Watchtower updates your containers, point it at the release line tag, such as 0.2, rather than latest. You then get fixes on their own, and a release that may need something from you waits until you change the tag. To learn of a new release, follow the changelog feed or read statsraven.com/download/latest.json, which names the newest version.

What happens on the first start#

When a new version opens your data folder for the first time, it does this before it takes requests:

  1. Checks the folder's version. If a newer version has already opened this folder, it stops with a message. See going back.
  2. Copies meta.db to meta.db.before-<version>, and removes copies beyond the last three.
  3. Updates meta.db. It adds the tables and columns the new version uses. Your projects, people, settings, charts and chats are kept.
  4. Checks stored events, but only when the release changed how events are stored. It reads every Parquet file once and rewrites those in the old layout, one at a time and safely, so an interrupted start leaves every file whole. On a large install this can take a minute or more.
  5. Writes waiting records. Records received just before the stop are in wal/ and go to storage now. A line this version cannot read is never thrown away: it is kept in wal/unreadable-<time>.ndjson and the log says so.
  6. Opens the port. The app answers within seconds while older data loads in the background. The Bots and API views say they are getting ready until it is done.

The log shows each step that did something:

Log
copied /var/lib/statsraven/meta.db to /var/lib/statsraven/meta.db.before-0.3.0 before updating it
updated the data folder from StatsRaven 0.2.1 to 0.3.0
repaired 214 stored files
recovered 37 records from the write-ahead log
listening on 0.0.0.0:7600

The folder counts as the new version's once step 3 has finished. If the start fails before that, the earlier release still opens the folder as before.

Check that it worked#

  • The version. Settings, License, This build shows it, and so does statsraven --version (in Docker, docker exec statsraven statsraven --version).
  • The log. journalctl -u statsraven -n 50 for the service, docker logs statsraven in Docker. Look for listening on and no errors after it.
  • Data coming in. Tail shows new lines within a minute, and Overview counts today's visits.
  • The license. Settings, License does not say the release is outside your updates.

When a release is not backward compatible#

Your stored data is never the part that breaks. Events, settings, charts and chats are brought up to date in place on start. A release never asks you to export and import your data.

What can change in a way that needs you is how StatsRaven is run or reached: an environment variable, a command, a sender setup, the SQL API or an MCP tool. Such a release raises the middle number of the version, and its Before you update box in the changelog says what changed and what to do, before or after the update.

An update only goes one way. Once a new version has opened the folder, an older version refuses it, because it might misread what the newer one wrote. Going back therefore always means restoring.

Go back to an earlier version#

An older version started on a folder that a newer one has opened stops with:

Log
this data folder was last opened by StatsRaven 0.3.0, which is newer than this 0.2.1.

With a backup#

This puts everything back as it was when you made the backup. Data that arrived after the backup is not in it.

sudo systemctl stop statsraven
sudo mv /var/lib/statsraven /var/lib/statsraven.after-update
sudo tar -xzf statsraven-before-update.tar.gz -C /var/lib
curl -fsSL https://statsraven.com/install.sh | STATSRAVEN_VERSION=0.2.1 sh -s -- --service

Put the version you backed up from where 0.2.1 is. The folder from after the update stays aside until you remove it.

Without a backup#

Use the copy StatsRaven made of meta.db. You keep every event stored since the update, and lose changes to settings, charts and chats made since then. This works only when the release did not change how events are stored. Its Before you update box says when one does; then only a backup takes you back.

Terminal
sudo systemctl stop statsraven
cd /var/lib/statsraven
sudo mv meta.db meta.db.after-update
sudo rm -f meta.db-wal meta.db-shm
sudo cp -p meta.db.before-0.3.0 meta.db
curl -fsSL https://statsraven.com/install.sh | STATSRAVEN_VERSION=0.2.1 sh -s -- --service

In Docker, do the same inside the volume with a short-lived container, as in the backup commands, then start the earlier image.

If it does not start#

Newer than this
The folder was opened by a newer version. Install that version or newer again, or go back.
No space left
The first start needs room for the copy of meta.db and for rewritten files. Free some space or move the data folder to a larger disk, then start again. StatsRaven goes on without the copy if it cannot make one, and the log says so.
glibc
The installer runs the new program once before it replaces the old one, and stops with the reason if it cannot run on this system. Your installed version keeps running.
Anything else
Keep the log and the folder as they are, start your backup on the earlier version if you need it running, and write to us with the log.