Upgrading
An upgrade is: take a backup, pull the new image, recreate the app container, watch the migrations apply. There is no separate migration step to run — the entrypoint does it — and there is no way to undo one, which is why the backup is first and not optional.
Before you start
Take a dump. Backup and Restore has the command and the TimescaleDB caveats. The rollback path for a bad upgrade is that dump; see Rolling back below.
Read CHANGELOG.md for the versions between the one you are running and the
one you are moving to. Entries are written for the person running the instance
and say what they have to do — the 2.6.0 entry, for example, tells you that
what used to be called a region is now a customer, that /api/regions is gone
and answers 404, and that you should rename your customers afterwards because
they still carry the names they were given as regions.
Upgrading from 2.x to 3.0.0
3.0.0 is the Selvara RMM release. It adds a service next to the app, new environment variables and agent settings that are off until you set them, and it renames the product. Do these before the sequence below.
-
Back up the database as described above. The migrations add many tables and cannot be undone.
-
Add
GATEWAY_TOKENto.envbefore pulling the new compose file:echo "GATEWAY_TOKEN=$(openssl rand -base64 48)" >> .envCompose refuses to start without it. Set
GATEWAY_PUBLIC_URLas well if technicians are to open tunnels; see Gateway. -
Pin
SETTINGS_ENCRYPTION_KEYin.envbefore pulling the new compose file. Compose now refuses to start without it, because stored access entry passwords must not depend on the session secret. An instance that never set it has been encrypting withAUTH_SECRET, and the key stays the same when you set the new variable to that very value:grep -q '^SETTINGS_ENCRYPTION_KEY=' .env || \echo "SETTINGS_ENCRYPTION_KEY=$(grep '^AUTH_SECRET=' .env | cut -d= -f2-)" >> .envDo not generate a new value here: everything already stored (SMTP password, TOTP secrets, webhook secrets) is encrypted under the old one. To move to a fresh key later, use the rotation tool.
-
Use the new
docker-compose.yml. It has two new services,gateway(selvara-gateway, with thegateway_datavolume) andapprise(caronc/apprise, which delivers the notification channels). If you keep your own compose file, copy both services and the app'sGATEWAY_URL,GATEWAY_TOKENandAPPRISE_URLfrom the shipped one. Jobs, SSH certificates and tunnels are refused until the gateway runs; without Apprise, notification channels can be saved but nothing is sent. Back upgateway_datafrom now on, together with the database. The app also has a new volume,client_releases, for the installers of the desktop client; copy it andCLIENT_RELEASES_DIRtoo, and back it up as well (see Client Releases). -
Let the reverse proxy pass WebSocket upgrades for
/api/agent/linkand/api/access/terminalas it does for/api/live; see Installation → WebSockets. -
Decide about outbound internet access. Once a day the instance downloads public vulnerability data (OSV.dev, CISA, FIRST, endoflife.date). Package lists never leave it. Where the instance has no internet access, set
VULN_DATA_DISABLED=1; see Vulnerability Data. Every other new variable is described in Configuration. -
Run the sequence below. Existing agents keep reporting and update themselves; see Agents installed by Selvara 2.x.
After the upgrade, four things are yours to switch on, because the upgrade does not guess:
- Hosts. What the dashboard may do on a host is a decision of the host. A
host that updated itself has no
actions, so it is only watched. Its live link starts by itself: the file of a host installed by 2.x has noagent_key, and an agent from 3.0.1 on receives it from the dashboard with its settings (every five minutes, signed with the host's own secret), writes it intoconfig.yamland enrols its host key. Three steps give it the actions you want, without editing files by hand:- The keys. Nothing to do for a host that keeps its file: it asks the
dashboard for
agent_keyandjob_keyby itself and pins the job key on first use; see The job key. A host you reinstall gets both from the install command on the host's page. - The actions, on the host. Add
--actions patch,scriptto the install command, or runselvara-agent configure --actions patch,scripton the host, also from Ansible or a shell loop; see Changing what a host allows. Addtunnel.allowto the file for tunnels. - Or the actions, from the dashboard, for a fleet where touching every
host is not an option. Update the agents (they do it themselves), set
GATEWAY_REMOTE_ACTIONS=truein.envand recreate the gateway, then set the allowed actions per customer, cluster or host under Settings → Agent → Actions. Hosts whose file has noactionskey follow it; a host with a list of its own keeps it. This moves the decision about what runs as root on those hosts to whoever manages the dashboard and its gateway; see Agent Settings for the trade-off.
- The keys. Nothing to do for a host that keeps its file: it asks the
dashboard for
- People. Existing grants start with no permissions. Tick what each person needs on the customer's Users tab; see Users and Permissions. Approval and reason policies, and access policies for SSH certificates, are created per customer.
- Scans. Daily network discovery runs only on the hosts you tick; see Network Discovery.
- Connections. The new Access Entries tool starts empty. Connections can no longer be imported or exported; the import and export calls are gone from the API.
Hosts, folders and private customers
Migrations 0476 to 0482 change how connections are stored. They run with
the others and need nothing from you, but they decide things on the way, and
the migration output says what: read the lines that start with
hosts from connections and system names.
- Connections get hosts. A host can now be a host you only connect to
(kind
remote, status Unmanaged, no agent key). The connections of one customer that point at the same machine are grouped under one such host, named after the machine in lower case without a port. A connection whose host is the name, or the reported hostname, of a host the customer already has is attached to that host and no second host is made. An address alone does not settle it, because the same private address recurs across a customer's sites, so such a connection gets a host of its own. A string that several hosts answer to stays unattached and is listed in the output. - Links stay links. Local VS Code, WSL and the well-known SaaS sites have no host to attach to. They keep their place in their folder.
- The same private address in two folders is two hosts. The second is named
address (Folder). - Folders hold hosts. The folders table is renamed to
folders, and a host of any kind can be filed in one. A host takes the folder its connections shared. A host whose connections stood in several folders is left unfiled, and the output lists where each of its connections stood: that is the only record of it afterwards. - A private area is a customer. Each person's private connections, folders and jump presets move to a private customer of their own, and so do the audit entries about them. An account without the right to connections, or one that no longer exists, keeps its private customer; nobody can open it, and the one of a deleted account is removed after the trash retention.
- Host names are unique inside a customer, whatever the case. Where two
hosts shared a name, the oldest keeps it and the others get
-2,-3; the output names each one. - A host with a kind other than agent, snmp or remote stops the upgrade. The message names the row. Correct it and run the migrations again; nothing was changed.
The rename
The product is called Selvara RMM in everything a person reads: the interface,
page titles, emails, reports and this documentation. Technical
identifiers did not change, so nothing needs editing: package names, the Docker
images and service names (selvara-app, selvara-gateway), environment
variables, paths, the selvara-agent systemd unit and the SelvaraAgent
Windows service, and every configuration key keep their names. The old
monitoring-only desktop app, Selvara RMM App, is gone in 3.0.0; uninstall it and
install the Remote Connection Manager, which also
shows alerts.
Upgrading to 3.2.0
Migration 0483 turns the private customers into ordinary ones. It renames each
(Private – Anna Müller, in the instance language, or the account's e-mail address
for an account without a name) and gives it a code of the form PRIV-ANNAMUELLER,
switches monitored on so that it can hold agents, rules and policies, and lifts
the database rule that refused tunnels in it. Names and codes are editable afterwards
on the customer's page. Nothing for you to do. A rollback restores the earlier internal
names and switches monitored off again.
Upgrading to 3.3.0
Remote desktops in the browser need a new service next to the app. Add it before
pulling the new image, or opening a connection in the browser answers
guacd_unavailable (everything else keeps working).
- Use the new
docker-compose.yml, or copy from it into your own: theguacdservice (guacamole/guacd, no published port), the volumeremote_recordings, its mountremote_recordings:/data/recordingson the app, the app'sGUACD_HOST,GUACD_PORT,REMOTE_BRIDGE_HOSTandREMOTE_RECORDINGS_DIR, andguacdin the app'sdepends_on.REMOTE_BRIDGE_HOSTis the name guacd uses to reach the app, so it has to be the app's service name,app, unless you renamed it. - Let the reverse proxy pass WebSocket upgrades for
/api/access/remoteas it does for/api/live; see Installation → WebSockets. - Back up
remote_recordingsfrom now on, together with the database; see Backup and Restore.
Migration 0492 adds a kind and a connection to the session table; nothing for you to
do. See Remote Desktop.
Every connection has a host
Migration 0493 ends the connections that have no host (the links: local VS Code,
WSL, well-known SaaS sites, and whatever an earlier upgrade could not attach). It runs with
the others and needs nothing from you, but it decides things on the way, so read the lines
that start with connections always hosted: one per connection, naming the host it got.
- A host is found or made for each one, per customer and per address. An address that
one of the customer's hosts answers to by name or by reported hostname takes the
connection. Several hosts answering to it are told apart by the one that is named like
the address, and when none is, the connections get a host of their own, named after the
address. Everything else gets a new host without an agent: one per address, a SaaS site
such as
github.comincluded, and one for all connections to the development server (dev.znbw.de), whatever their type. - Local VS Code and WSL connections go on the customer's local host, a host of its own
kind (
local, stored asLocal, shown as Local computer), made only for customers that have such connections; an existing host that is already calledLocalis left alone and the new one is calledLocal-2. Only VS Code connections hang on it, so another type tolocalhostor with no address, and an address that cannot be read, get a host named after the connection. - Trashed connections are attached the same way. A host that is made only for trashed connections is in the trash with them, so no host appears for something that was deleted.
- Folders. A new host takes the live folder its connections stood in, when they all stood in one; a host that had no folder takes it too. A connection has no folder of its own from now on, so one that stood in a different folder than its host ends up in the host's, and the output says so. A connection that was in a folder that is in the trash no longer records it.
- The database now says that a connection always has a host, that deleting a host deletes
its connections, and that a network device takes none. A host that has no agent can be in the
trash (
systems.trashed_at): deleting one moves it there with its connections, for the trash retention; see Deleting a host. Names are unique among hosts that are not in the trash. - The setting
hosts.saasDomainsis not read any more: SaaS addresses get hosts like any other. - A rollback restores the columns but not which connections were links: they keep the hosts they got, and hosts in the trash are deleted with their notes (their connections stay in the connection trash).
Upgrading to 3.4.0
3.4.0 changes what a host is: a host now owns what it takes to reach it (addresses, web addresses, shares, and how it is reached), and the stored connections become access entries on their host. Read Hosts and Access Entries and Access Entries first if you have not. Several things have to move together:
- Back up the database as described above. Migration
0494rewrites the connection tables, and the deployment never runs a down-migration (see Rolling back). - Update the dashboard and the gateway together. They ship in the same compose images. The
gateway has to understand the new
/v1/desktop/tokenbefore the dashboard sends it; a dashboard with an old gateway answersdesktop_not_allowedfor everything that goes through a host's own agent. See Gateway. - Update the desktop app and the command line at once. There is no compatibility layer: the
routes under
/api/connectionsand/api/connection-jump-presetsare gone, and an app orselvarahelper from before 3.4.0 fails with404ortoken_kind_not_alloweduntil it is replaced. Scripts that call those routes, orselvara tunnel --connection, have to change (/api/access-entries,selvara tunnel --entry; see HTTP API and Command Line). - Roll the agent out through the usual channel (see Agent Rollout). The new agent
(3.2.0) knows the
desktopaction; until a host runs it, opening that host through its own agent is greyed out withagent_outdated. Nothing on the server waits for the rollout. - Allow
desktopwhere it is wanted (below). It is off everywhere after the upgrade.
Migration 0494
One migration does everything, in one transaction, so a failure leaves the schema as it was. It
needs nothing from you, but it decides things on the way, and it prints what it did: a summary line
(hosts own access: N entries converted, ...), the count of every kind of report it wrote, and a
list with host id and name for the kinds that need a decision from you. The reports are kept in the table
access_migration_report and shown on each host's Access tab as dismissable migration notices until a
later release drops the table.
- Entries keep their ids. Every connection row is converted in place. The id is what a stored
password is sealed with, so every password still opens, and favourites, pins, use counts, terminal
sessions, audit entries and
rcm://connect/<id>links keep pointing at it.connectionsis nowaccess_entries, and the per-user tables areaccess_favorites,access_pinsandaccess_usage. - A web connection stays an entry. A host that held only web connections (and none that opened through a
tunnel) becomes a web link host (
weblink): the first connection keeps the host's row and id, and every further one becomes a host of its own in the same folder (reportweblink_split). The folder a connection stood in before 3.3.0 cannot be recovered; the host's folder is used. Other web connections stay web entries on their real host, withhttps://added to an address that had no scheme, which is what the web tool always opened. - The
Localhost is split. Each local VS Code folder and WSL distribution is now a host of kindlocalof its own, in the folder of the oldLocalhost. ALocalhost with no connections is deleted (local_host_removed). - Tags, colour and notes moved to the host. The tags of a host's connections are added to the host's
(at most 50, each at most 80 characters; a longer result is cut,
tags_truncated), its colour is that of the most used connection, and every connection's notes are appended to the host's notes under the connection's name (cut at 50,000 characters,notes_truncated). On a link host the tags, colour and notes are those of its own connection. - Addresses. An address that a connection used and the host did not already answer to is stored as a
manual address of the host, so every SSH, RDP and VNC entry has an address from the host's list. An address
that could not be read into a host name is reported (
address_unnormalized). - Web links and folder links became web addresses and shares of the host (web addresses have since become web entries; see Web entries), under ids made of the
connection's id; a folder link whose
{host}or{user}could not be filled is reported (share_unresolved) and stays copy-only. A web link whose scheme is nothttporhttpsis dropped (web_skipped_scheme), and a web entry with such a URL is kept without an open action (web_entry_scheme). Extra web links of a web link host became hosts of their own (web_link_hosted). - VS Code over SSH becomes a link host. Every VS Code connection to another machine becomes a host of
kind
vscodeof its own, in the folder its old host stood in, with one entry that keeps the connection's id: the SSH address and port, the user, the password, the remote project folder, the icon, the tags and notes, and the favourites, pins and use count. Nothing is merged, so a development server with seventeen projects keeps seventeen hosts and each can be filed in its own folder (vscode_link). SSH connections stay SSH entries on their host. A VS Code connection with no address orwsl+…on a real host becomes alocalhost (vscode_local_moved). SSH options and jump hosts of a VS Code connection are written into the note of its new host like those of an SSH connection. Avscodehost opens in the desktop app only. - Names. A link host takes its connection's name; when the name is taken by a live host of the customer it
gets
(2),(3)(name_adjusted). - Jump hosts and SSH options are gone. They are written into the host's note under
Imported access settings (no longer used), one bullet per connection (
proxy_jump_kept,ssh_options_kept), and the jump presets table is kept untouched for one release (jump_presets_kept). Nothing reads them any more.
Restoring the folders of links
Before 3.3.0 a link (a web address, a local folder or a remote VS Code project) had a folder of its own, and
3.3.0 attached it to a host, which has none per connection. The migration puts a link host in the folder its old
host stood in, which is not always where you had filed it. If you kept a record of the placement, for instance an
export of the connections with their folders as a JSON array of
{connectionId, type, name, customerId, folderId, folderName}, scripts/restore-link-placement.mjs puts the
links back:
docker compose exec -T app node scripts/restore-link-placement.mjs < placement.json # dry run
docker compose exec -T app node scripts/restore-link-placement.mjs --apply < placement.json # writes
It is a dry run unless you pass --apply, which writes everything in one transaction. For each item it finds
the entry by the connection's id and prints one line:
- an entry on a link host moves that host into the folder, if the folder exists, is not in the trash and belongs
to the same customer; otherwise the line says
folder_missingand nothing moves. AfolderIdofnulltakes the host out of its folder; - a web entry that 0493 had attached to a real host gets a new web link host in the folder, named after the item,
and the entry moves to it with its id, so its password and marks stay (
web_unhosted); - an SSH entry stays on its host (
kept_on_host); - an entry that does not exist or is in the trash is skipped with its reason.
The script ends with a summary of the counts per outcome. Run the dry run first and read it.
Reachability
How a host is reached used to be set on every connection. It is now one setting on the host (see
Reachability), and the migration chooses it from the host's live
connections: the way most of them opened, then the one used most recently, then tunnel before agent before
direct. A connection that tunnelled through the host itself counts as agent. A host without live
connections keeps agent if it has an agent and direct otherwise, and a tunnel whose host is no longer an agent
of the same customer becomes direct.
A connection that opened differently from its host's winning way now behaves like the others. That is
by design, and it is reported (reach_conflict, with the way each side opened and the entries concerned).
Check the hosts on the list and set the reachability by hand where the lost way mattered.
Hosts that used a jump host are not mapped. A string such as user@bastion has no reliable counterpart
among the customer's agents. They are listed (proxy_jump_kept), and they stay reachable only as far as
direct reaches until you set a tunnel host on them.
The checklist
After the upgrade, go through what the migration printed, or the notices on the hosts' Access tabs:
| Report | What to check |
|---|---|
reach_conflict | The host's entries used to open in different ways. Set its reachability to the one you want. |
proxy_jump_kept, ssh_options_kept | The values are in the host's note. If the host needs a jump host, set a tunnel host as its reachability. |
desktop_needed | The host reaches through its own agent. Allow desktop for it (below). |
weblink_split | A host with several web connections became several web link hosts. Check their names and folders. |
vscode_link | A VS Code connection became a link host of its own in the folder of its old host. File it where you want it, or restore the folders it stood in before 3.3.0 (below). |
name_adjusted | A host was renamed with a number because its name was taken. |
notes_truncated, tags_truncated | A host's notes or tags were cut to the limit. The full text is in connections_legacy_0494. |
share_unresolved, web_entry_scheme, address_unnormalized | A share, URL or address could not be read; open the host and correct it. |
desktop is off until you enable it
Hosts whose connections used to tunnel through the host itself now have reachability agent. That route is
the agent's new desktop action, which is not allowed by default on any host: until you allow it,
RDP, VNC and web entries of such a host cannot be opened in the browser or through the app's tunnel
(desktop_not_allowed), and the host's Access tab says so (report desktop_needed; the Reachability card
warns while the host's agent lacks the action). Allow it where you want it:
- Roll the agent 3.2.0 out first; an older agent shows
agent_outdated. - Add
desktopto the allowed actions of the hosts: with Settings → Agent → Actions (set for a customer, a cluster or one host, or with Allowed actions in the selection bar of the hosts list), or in the host'sconfig.yamlwithselvara-agent configure --actions …,desktop. There is no bulk shortcut: it is the same setting as for every other action, see Agent Settings. - Start with canary hosts and enable it elsewhere after the soak, as for any agent release.
Read what the action allows before you enable it: a holder of access.tunnel reaches the host's own RDP, VNC and SSH
ports without tunnel.allow covering them; see Security.
What changed for people
- Hosts without an agent that open directly open in the desktop app only. The dashboard cannot dial the customer's network. Set a tunnel host on such a host to open it in the browser.
- SSH works in the browser for hosts that reach through a tunnel host, with a host key confirmation on first use (SSH host keys).
- Viewers no longer see link hosts, and a person with
connection.editcan set tags and colour on hosts that have an agent. - The
connections.*live topics changed names (see Live screens).
A rollback
The deployment does not run down blocks; the rollback of 3.4.0 is the dump you took before
(Rolling back). The old rows stay in connections_legacy_0494, connection_jump_presets_legacy_0494
and access_migration_report for one release; a later migration drops them. If you ran the migration's down
by hand it restores the old shape from those tables and loses what 3.4.0 added: addresses, web addresses, shares and
reachability, tags written after the upgrade, entries created or deleted after it, and SSH sessions in the browser.
Hosts that were split stay split, and notes written onto hosts stay, so a down followed by an up repeats the imported note
sections.
Upgrading to 3.5.0
3.5.0 gives every customer one access policy and moves the rights screens together under
Settings → Access and rights. Migration 0497 changes the schema; the deployment does not
run a down-migration (see Rolling back), so take the backup first.
- Approval and reason are now per customer only. SSH certificate rules used to carry their own
approval required and reason required. The migration sets the customer's switch whenever one
of its rules had it, so a requirement that applied to some accounts or hosts now applies to the
whole customer. This is the stricter direction on purpose. The migration log lists each widened
customer (
customer.policy_changeentries withsource: migrationare written to the Audit Log too), and the old values are kept inaccess_policies_flags_0497. After upgrading, open/settings/rights?tab=policiesand review those customers; switch off what the customer should not require. - A new SSH certificate validity per customer, 8 hours by default, which changes nothing until you lower it.
- Addresses moved. Roles, actions, access policies, access entry icons and usage
have new places; the old addresses redirect, and so do the customer tabs
policiesandusers(nowrights). Bookmarks and links keep working. - Actions follow
actions.manage. Managers without the permission now see the action policies read-only, and operators who hold it at a customer see and edit that customer's entries. - Default permissions can be applied to grants an account already holds; see Default permissions. Admin and viewer accounts no longer show them.
- Hosts have paths, not a reach mode. Migration
0496replaces the reach mode with a tunnel switch. Hosts that reached through a tunnel host keep it and have the switch on; nothing is stored foragentanddirect. The migration log names the hosts that have an agent and were set todirect: from now on the browser opens them through their agent as soon as thedesktopaction is allowed for them. To keep such a host out of the browser, leavedesktopoff for it. See Reachability. - The desktop app opens directly on a click. A host that is only reachable through its agent
(behind NAT) used to open through the agent by default; it now needs the right-click entry
Connect via agent. App 3.3.0 and agent CLI 3.3.0 (
selvara tunnel --path) go together; the app asks for CLI 3.3.0. - Apps and scripts of 3.2.x keep working. A launch without a
pathtakes the path the host had before,PUT /api/systems/{id}/reachabilitystill accepts{ "mode": ... }(deprecated) and answers carry a derivedreach.mode. Update scripts to{ "viaTunnel", "tunnelSystemId" }. - SSH in the browser now uses the stored entry through the host's own agent as well, and the agent terminal is a separate item. Installing or removing an agent no longer changes how a host is reached, and a tunnel host that goes away leaves the host's switch on: choose a new one.
- Customers without a service contract are now Not managed (Nicht betreut), and may have agents.
Migration
0498relaxes the database guards: a not managed customer can own hosts with an agent, enrollment tokens, tunnel targets, access policies and action policies; SNMP devices, rules and schedules still need a managed customer. Nothing changes for existing customers. What you must know: switching a customer to not managed now deletes its history (metrics, alerts, events and reports) after a confirmation instead of removing its agents, and the agents stay. A customer that ended its contract under 3.4.0 keeps the agents it already lost; enroll them again if you want them back. The migration is reversible, but its down step refuses to run while a not managed customer still owns an agent. See Managed and not managed customers.
Upgrading to 3.8.0
3.8.0 moves the database from PostgreSQL 16 to PostgreSQL 18
(timescale/timescaledb:latest-pg18). PostgreSQL cannot open the data
directory of an older major version, so this upgrade is a dump and a restore
into a new volume, and the instance is down while it runs. On an instance with
50 GB of data and four cores, budget half an hour; the restore is most of it.
The usual sequence is not enough here. The new compose file mounts a new
volume, postgres18_data, at the place the pg18 image expects it. Started
with docker compose up -d alone, the database comes up empty and the app
creates a fresh schema in it: every account, customer and host seems gone. The
data is still in the old volume and nothing is lost, but follow the steps
below instead.
# 1. Stop the app. The database stays up for the dump.
docker compose stop app cron
# 2. Dump, and note the TimescaleDB version the database runs.
docker exec selvara-db pg_dump -U monitoring -d selvara -Fc > selvara-pre-3.8.0.dump
docker exec selvara-db psql -U monitoring -d selvara -Atc \
"SELECT extversion FROM pg_extension WHERE extname = 'timescaledb'"
# 3. Stop the old database, keep a copy of the old compose file.
docker compose stop postgres
cp docker-compose.yml docker-compose.yml.pre-3.8.0
# 4. Put the new docker-compose.yml in place, then start only the database.
docker compose pull
docker compose up -d postgres
# 5. Recreate the database with the version from step 2 (here 2.25.1).
docker exec -i selvara-db psql -X -U monitoring -d postgres -v ON_ERROR_STOP=1 \
-c "DROP DATABASE selvara" \
-c "CREATE DATABASE selvara OWNER monitoring TEMPLATE template0"
docker exec -i selvara-db psql -X -U monitoring -d selvara -v ON_ERROR_STOP=1 \
-c "CREATE EXTENSION timescaledb VERSION '2.25.1'" \
-c "SELECT timescaledb_pre_restore();"
# 6. Restore, leave restore mode, refresh the planner statistics.
docker exec -i selvara-db pg_restore -U monitoring -d selvara \
--no-owner --no-privileges < selvara-pre-3.8.0.dump
docker exec -i selvara-db psql -X -U monitoring -d selvara -v ON_ERROR_STOP=1 \
-c "SELECT timescaledb_post_restore();"
docker exec selvara-db vacuumdb -U monitoring -d selvara --analyze-in-stages
# 7. Start everything.
docker compose up -d
docker compose logs -f app
The database is created from template0 because the image installs the newest
TimescaleDB into template1, and a dump restores only into the extension
version it was taken with. On its first start the app brings the extension up
to the version the image ships (TimescaleDB extension at 2.31.0 in the log),
and it does so on every start from now on, so a newer database image takes
effect without a manual ALTER EXTENSION. The pg18 image carries TimescaleDB
2.23.0 and later; a database on an older version runs
ALTER EXTENSION timescaledb UPDATE once on the newest latest-pg16 image
before step 1. Backup and Restore
describes how to try the restore on a throwaway container first and measure how
long it takes.
Do not speed up step 6 with pg_restore -j. A parallel restore loads the
TimescaleDB catalog tables out of order, their foreign keys reject rows, and the
database looks complete while its hypertables are broken; the first retention
job then crashes the server.
A clean restore prints nothing. Check the result: metrics must be listed in
timescaledb_information.hypertables and metrics_5m and metrics_1h in
timescaledb_information.continuous_aggregates, as in
Backup and Restore.
Rolling back needs no restore: the old volume (<project>_postgres_data,
selvara_postgres_data for the shipped compose file) is untouched. Stop
everything, put docker-compose.yml.pre-3.8.0 back, pin the previous app image
and start again; what was written after step 1 is lost. Once 3.8.0 runs well,
remove the old volume with docker volume rm selvara_postgres_data to free the
space.
The sequence
docker compose pull
docker compose up -d
docker compose logs -f app
docker compose up -d stops the old app container and starts the new one. It
does not run them side by side, and you must not make it.
Never run two app containers against the same database during an upgrade.
Migrations run in the entrypoint, before the new container listens on port
3000, so the moment the new container starts it has already changed the schema
underneath anything else that is connected. An older container that is still
running does not degrade — it starts throwing errors on queries that name
columns the migration just renamed. The 2.6.0 migration renames regions to
customers and systems.region_id to systems.customer_id; a 2.5.x container
surviving that rename is broken instantly and loudly.
The compose file protects you from this by pinning container_name: selvara-app, which makes a second replica impossible to start. Do not remove
that pin to get a zero-downtime deploy: this design has no zero-downtime
deploy. The gap is the length of one migration run, which on a normal upgrade
is seconds.
Browsers that hit the gap see the proxy's error page. To show a Selvara page that reloads itself instead, see Installation → A maintenance page during upgrades.
The cron container waits on the app's healthcheck (depends_on: service_healthy), so it will not fire alert evaluations at a half-migrated
database. Leave that dependency in place.
What the logs look like when it worked
Running database migrations...
Skipped: 0001_baseline
Skipped: 0002_metric_series_and_index_cleanup
Applied: 0007_customers_and_server_region
Applied 1 migration(s)
Migrations completed successfully
Configuring TimescaleDB retention...
Retention active: raw 7 days (compressed after 2 days), 5m rollup 30 days, 1h rollup 400 days
Running database seed...
Seeding complete!
Starting application...
Skipped means already applied — the migrator tracks what has run in the
database and only executes the rest. No pending migrations is what a restart
with nothing new to do prints.
Two lines deserve attention:
Migration failed:followed by an error means the script exited 1 and the server was never started. The container will be restarting in a loop. On PostgreSQL the whole migration run happens inside one transaction, so the schema is rolled back to where it was rather than left half-migrated — the old image will still run against it. Stop the container, read the error, and either fix the cause or go back to the previous tag.TimescaleDB setup failed (app will still start):is deliberately non-fatal. The app comes up, but retention and compression may not be configured — which means the metrics table can grow without bound. Do not leave it. Troubleshooting covers the disk case.
Then confirm the instance is actually serving:
curl -s http://127.0.0.1:3000/api/health
docker compose ps
Three version numbers
They live in package.json at the repository root and they move
independently:
| Field | What it tracks | Changelog |
|---|---|---|
version | The dashboard: UI, API, schema, deployment. | CHANGELOG.md, newest first. |
agentVersion | The Go agent under agent/. Bumped only when that binary changes. | Noted under the dashboard release that ships it, as an ### Agent x.y.z section. |
clientVersion | The Flutter desktop client under client/. Written into client/pubspec.yaml by npm run client:version:sync; npm test fails when they differ. | Noted under the dashboard release that ships it. |
They are not meant to match and never have. The client is built by its own GitHub Actions workflow and is not part of the dashboard image. The agent ran ahead for a long stretch because it shipped updates while the dashboard's number sat still.
Images are tagged latest and <YYYYMMDD>-<short-sha> by the build pipeline.
Pin the dated tag in docker-compose.yml if you want upgrades to be a
deliberate edit rather than whatever latest resolved to this morning.
Upgrading the agents
You do not upgrade agents separately. The dashboard image contains the compiled
agent binaries, and /api/agent/version advertises the agentVersion baked
into that image. Agents check it and update themselves, restarting whichever
systemd unit actually started them. So pulling a new dashboard image is what
puts a new agent version in flight.
Whether it goes out to everything at once or one canary per customer first is a setting, not a property of the upgrade. See Agent Rollout if you want to stage it, and hold updates on individual hosts before you pull rather than after.
Agents installed by Selvara 2.x
Agents installed by 2.x sign every request with the instance's
WEBHOOK_SECRET. From 3.0.0 each host signs with a secret of its own, derived
from WEBHOOK_SECRET and the host id, so a secret read off one host proves
that host only. Nothing has to be reinstalled for the change:
- Until a host has switched, the dashboard accepts the instance's secret from it for what monitoring needs: reports, settings, the version check, the inventory upload and the agent download. Registering a host key, enrolling, the live link, jobs and everything else that acts on a host always require the host's own secret.
- A 2.x agent therefore keeps reporting after the dashboard is upgraded and updates itself to 3.0.0 through the usual rollout.
- The 3.0.0 agent finds its own secret in the answer to its next settings
request, writes it into
config.yamlaswebhook_secret(keeping the file's permissions) and signs with it from then on. If it cannot write the file, for example becauseWEBHOOK_SECRETis set in the host's environment, it stays on the instance's secret and says so in its log. - The first request a host makes with its own secret ends the instance's secret for that host: from then on it is refused for that host, and the dashboard no longer hands the host's secret out.
Settings → Agent counts the hosts that still use the shared secret, and a host's page shows which one it is on. Once the count is zero, no host depends on the instance's secret any more. Hold the rollout (see Agent Rollout) only if you want to postpone the switch: a held host keeps working on the shared secret.
The agent's unit no longer sandboxes it
On Linux the agent runs as plain root, without a systemd sandbox, the way the
Windows agent runs as SYSTEM. Units written by earlier releases held the agent
to a read-only host, hidden home directories and a short list of
capabilities (ProtectSystem=strict, ProtectHome=true, NoNewPrivileges=true
and others). That kept breaking what the agent exists to do on a host: apt
could not drop privileges, /var/lib/apt and /etc/ssh were read-only, /root
was hidden from the SSH key inventory. It had been worked around so many times
that it protected little. What limits the agent are the signed jobs, checked
against the pinned job key, the actions the host allows, the fixed list of job
types and the audit log; see
Agent Installation.
Nothing has to be done on a host. The first start of the new agent removes the
sandbox directives from /etc/systemd/system/selvara-agent.service, deletes the
socket-groups.conf drop-in an earlier agent may have written, reloads systemd
and restarts once more, so a host restarts twice after the update: the second
start is the one without the sandbox. The log says
Removed the sandbox from selvara-agent, restarting. A unit the agent cannot
rewrite (one that does not live under /etc/systemd/system) keeps its sandbox
and the log says why. Running the install command again writes the plain unit
as well. Drop-ins you wrote yourself are left alone; remove sandbox directives
from them by hand. Hosts on OpenRC, upstart and Windows never had a sandbox.
Rolling back
There is no automatic down-migration. The migrations do define down blocks,
but nothing in the deployment ever calls them: scripts/migrate.mjs only calls
migrateToLatest(). Starting an older image against a newer database does not
undo anything — it just runs the old code against a schema it does not know.
So the rollback is:
docker compose stop app cron- Restore the dump you took before the upgrade, following Backup and Restore.
- Pin the previous image tag in
docker-compose.yml. docker compose up -d
Everything written between the dump and the rollback is lost — metrics, alerts, events, and anything an operator changed in the dashboard. That window is exactly as long as you let it be, which is the argument for taking the dump immediately before the pull rather than the night before.
If the upgrade is only cosmetically wrong — a page you dislike, a label in the wrong language — do not roll back. A schema that has moved forward is much easier to live with than a restore.
Moving to another machine
An upgrade keeps the server where it is. Moving the instance to a new machine is a restore on the new one plus telling the agents where to go, which the old server can do for them once every agent runs the current version. See Moving to a new server.