Database engine versions
A newer engine version runs beside the old one, and databases move to it one at a time, by their owners or by you, until the old version holds nothing and its package can be removed.
Each version of an engine is a server of its own, in its own package, on its own address:
| Package | Server | Address |
|---|---|---|
elpan-userdb-mariadb-12 | mariadb-12 | 10.91.3.101 |
elpan-userdb-mariadb-13 | mariadb-13 | 10.91.3.105 |
elpan-userdb-postgres-18 | postgres-18 | 10.91.3.102 |
elpan-userdb-postgres-19 | postgres-19 | 10.91.3.104 |
Accounts' applications don't see these addresses. They connect to a
database by its hostname, <owner>_<name>.db.internal, which the panel
points at the server the database is on and moves when the database moves.
Add a newer version
Install its package, as root:
dnf install elpan-userdb-mariadb-13
dnf install elpan-userdb-postgres-19
Nothing installs one for you: elpan-userdb recommends no MariaDB or
PostgreSQL server, so updating it brings no new version in. The new server
starts on install, and the panel sees it at once:
elpanctl database server list
From then on, new databases go on the newest version of each engine: the account's create form, its API and its MCP tool offer only that one, unless you offer an older one too, and web application installs always use it. The databases already on the older version stay there, and keep working, until they are upgraded. Nothing moves by itself.
database server list shows, for each server, whether new databases can go
on it (Offered), the databases on it (Databases), the copies an
upgrade to it is filling (Upgrading In), the old copies upgrades left on
it (Retired Copies), and the newest newer server of its engine
(Newer).
install.sh --with-databases= takes the engines to install,
e.g. mariadb-13,postgres-19,valkey-9. Installing only the newest version
of an engine is enough for a new server.
Offer an older version for new databases
Some account holders need a given version: an application certified on MariaDB 12 or PostgreSQL 18, or a dump that must restore on the same major version. To let them create databases on an older server as well as on the newest, write a file named after that server, as root:
echo '{ "offer": true }' > /etc/elpan/userdb/mariadb-12.json
echo '{ "offer": true }' > /etc/elpan/userdb/postgres-18.json
It applies to every account on the server, from the next page load. The
create form then shows the older version as a card of its own, described as
an older version to choose only when the application needs it; the API and
the MCP tool accept it, and database server list shows Offered as
Yes, by administrator. The newest version stays the default: the
form lists it first, and elpanctl database create <owner> postgres <name>
and web application installs still use it. A database created on the older
version is offered the upgrade like any other.
The panel reads the file as root, so an ordinary root-owned file works,
at 0600 or 0644: /etc/elpan/userdb stays 0700 root:root, and nothing
needs to be made readable to the panel. The panel reads only offer from
it, and nothing in it changes the server's address, port or image. A
disabled server is never offered, whatever its file says.
Reading the file as root needs an elpan-panel newer than 1.1.135. A file
that isn't valid JSON, or whose offer isn't true or false, is ignored,
with a warning in the panel's log, and Offered stays No, so check it
with elpanctl database server list after writing the file.
To stop offering it, remove the file. The databases already created on it stay there.
How an upgrade works
An upgrade moves one database to a newer server of its engine on the same server:
- Preflight. Refused, with every reason, when a PostgreSQL database
uses an extension the newer server doesn't provide, when there isn't room
for a second copy (twice the database's stored usage free under
/var/lib/containers/storage), when the database is read-only (a move is copying it), or when its owner isn't active. - Prepare. The database and its login are made on the newer server, with the same name and password.
- Freeze. The database becomes read-only: reads work, writes are
refused, and its open sessions are ended. PostgreSQL sets
default_transaction_read_onlyon the database, so a write fails as a read-only transaction; MariaDB leaves the login onlySELECTon it, so a write fails as a permission error (INSERT command denied). - Copy. It's dumped with the newer version's
pg_dump(ormariadb-dump) and restored into the new copy as the database's own login, straight through a pipe. Nothing is written to disk. - Verify. Every table's row count must match on both sides.
- Switch. The new copy becomes the database, writable; the old one is kept, its login disabled, and the hostname moves to the new server.
A failure before the switch undoes the upgrade: the new copy is dropped and the database is writable on its old server, as it was. The job records the database server's first error. The switch is never undone.
Upgrades run in the background, one at a time on a server, in
elpan-panel-dbupgrade.service. The others wait as queued. A job whose
worker died is taken up again from its last finished step, at most three
times.
The read-only window lasts from the freeze to the switch. For the databases of a typical site it's seconds; for a large one, minutes.
While a database is upgrading, it can't be removed (by its owner, by you, by an account deletion, which waits for the upgrade), restored, given or received by a move, and its password and access mode can't be changed.
Upgrade a database
An account holder upgrades their own databases from the database's page, which offers the newer version and explains the read-only window, or through the API and MCP tools. See Upgrade a database in the account docs.
You can upgrade one for them:
elpanctl database upgrade run <owner>_<name> --dry-run
elpanctl database upgrade run <owner>_<name>
--dry-run shows the target and every reason it would be refused, and does
nothing. Without it, the upgrade is queued for the worker; --sync runs it in
your shell instead and prints each step. --to <server> picks a target other
than the newest newer server.
The account holder gets a notice in their system mailbox when an upgrade you started has finished or failed, as for one they started themselves.
Upgrade a whole server
To move every database off an old version:
elpanctl database upgrade server mariadb-12 --to mariadb-13 --dry-run
elpanctl database upgrade server mariadb-12 --to mariadb-13
elpanctl database upgrade server postgres-18
It queues one upgrade for each database on the old server, to the newest
newer server of its engine or to --to <server>, and reports the ones it
refused with their reasons. While you still
offer the old server for new
databases it warns that account holders can go on creating them there. --account <username> limits it to one account. The upgrades run one
at a time; run the command again later for the databases that were refused
once their reason is gone.
Follow them, and call one off before it has switched:
elpanctl database upgrade list
elpanctl database upgrade list --all
elpanctl database upgrade abandon <upgrade id, or the database>
list shows the upgrades under way, with their step, the bytes copied and
who asked; --all adds the ended ones, with a failed one's error.
The old copy
After the switch the old copy is kept for 7 days, its login disabled, then dropped by an hourly sweep. Its server's Retired Copies count includes it.
The panel has no revert: once a database has switched, it stays on the newer
server. Within the 7 days the old copy's data is still on the old server, so
you can read it there as the engine's administrator, e.g. to recover a table
by hand. After database upgrade retire --all, or after the 7 days, it's
gone.
To drop the old copies before their time, e.g. to remove the old version sooner:
elpanctl database upgrade retire --all
Without --all it drops only the copies whose 7 days are over, as the hourly
sweep does.
Remove an old version
If you offer the old version for new databases, remove its file
(e.g. /etc/elpan/userdb/mariadb-12.json) first, so that no new database
lands on it while you move the others off. An old version can go once database server list shows 0 for its
Databases, Upgrading In and Retired Copies, or once
database upgrade server <old> --dry-run finds no database left and
database upgrade retire --all has dropped the old copies. Then, as root:
dnf remove elpan-userdb-mariadb-12
dnf remove elpan-userdb-postgres-18
The panel never removes a package itself. Remove one only when nothing is left on it: a database still on a removed server stays in the panel but reaches nothing, and its page says its server is offline.
Telemetry
Each MariaDB and PostgreSQL server has its own collector receiver: the
mariadb-userdb and postgres-userdb jobs carry a userdb_instance label
(mariadb-12, mariadb-13, postgres-18, postgres-19), so a dashboard
shows both versions side by side, and the old one disappears with its
package. The upgrade worker is reported as its own pool in
elpan_worker_stale{pool="dbupgrade"}, and its queue in the messenger
backlog metrics as dbupgrade. See Telemetry.