Language

Upgrade Guide

What to record before you start, why a failure can roll the database back automatically, why rollback moves the current three files away first, and the item-by-item checklist to verify afterwards.

This page is meant to be followed step by step: what to run for one site upgrade, what to look at, and when to stop and roll back. The conceptual side lives in Licensing and Delivery; here it is only operations.

Before you touch anything (five minutes, do not skip)

Write down the current state first, because when you roll back you need to know "what it was": the current version number (the VERSION file in the install directory, or the system information in the console), what each tier of /healthz concludes right now, and whether the last 200 lines of the log contain any errors. Then check the disk: an upgrade starts by making a timestamped backup (the binary, VERSION, the database plus its WAL and shared-memory files), and when there is not enough space the backup fails — after the service has already stopped, which is exactly the worst moment.

Confirm one more thing: this machine's system clock is correct. Licensing and TLS both read the clock; if the skew is large, the upgrade can be blocked by a "clock error" and you will think the new version is broken.

The normal path

Run the upgrade script. It works in this order: stop the service → back up → replace the binary and VERSION → start the service → health check. Downgrades are refused by default (migrations are not backward compatible, and putting an old binary on a new database usually fails to start at all).

Failure handling is automatic: any non-zero exit between "the old database has been copied into the backup directory" and "the health check passed" takes the same rollback path — the binary, VERSION and the database are all put back together, and the service is started again. What this covers is not only "failed to start" and "health check did not pass", but also a full disk while writing the binary or the version file, wrong permissions, and a missing file in the package — those used to be a gap where the service simply stayed stopped.

Rollback is not an in-place overwrite: it moves the current three files away first, then puts the backed-up copies back. The reason is concrete — the backup was taken after the service stopped and contains no WAL; if you only overwrite the database file, the WAL left behind by the failed version will "restore" the old database into the new structure, so rollback reports success while writes still do not come back.

On an older machine (the system crypto tools are too old and cannot verify signatures) the only upgrade path is the install script with the allow-reinstall flag. It likewise copies the database after stopping the service, puts the database back on failure, and does not disable the service unit — it was already serving before the script ran, so disabling it would mean "after a failed upgrade, not even the old version serves".

After the upgrade, verify item by item (use this list)

In order, each item answers "passed or not" on its own:

  1. every tier of /healthz — note that migrations showing pending on an upgraded older database is a common shape, not a failure;
  2. the public home page + any detail page + one foreign-language page (the foreign-language page verifies the language routing and the translation projection at once);
  3. console login, with no startup error of the "the backend will not attach" kind;
  4. make one content edit and see it on the front end (content edits take effect immediately, no publish click needed);
  5. change one site setting and press publish, confirming the snapshot advanced;
  6. visitor customer service: the floating window opens, and asking for a human creates a conversation;
  7. the certificate status screen reports no error, and the current certificate is still within its validity period;
  8. the log contains no plugin start failed and no repeated restarts (the service unit sets an explicit restart rate limit: too fast floods the log, too slow lets one transient blip pin the service dead).

When a rollback needs a human decision

All the script can judge is "did the health check pass". It cannot judge "the upgrade succeeded but some feature now behaves differently" — that needs you to actually look at items 3, 4 and 5. If you do roll back, remember: back up the post-upgrade database once more first, otherwise the rollback overwrites it and the scene of "what actually happened on the new database" is gone.

Three migration semantics (they decide whether you should roll back)

Editing the body of a migration that has already been applied does not re-run it — migrations are recorded by "module + version number". A version number, once used, belongs to that migration, so adding structure can only be numbered above the highest number the old chain used. Missing structure is something only a real run of an old database under the new binary reveals; each module's own tests use a freshly created database, whose structure is always complete. Before going live it is worth running one "old database + new binary" upgrade rehearsal and one "backup → restore" rehearsal.

A recommendation on upgrade frequency

Do not chase the newest. Security fixes come first — a patch-level update of the toolchain can carry fixes for server-side, externally triggerable vulnerabilities, and this deployment shape is a single process connecting directly over TLS, with nobody else taking the hit for us. Feature releases are worth reviewing quarterly, unless you happen to need what one fixes. Before each upgrade, count in how long the previous version ran stably.