Have a server update itself
Start an update from any computer, know what the server checks before it replaces its programs, and read how the update ended.
A server that runs as a service from the install script's programs can replace them with a newer release itself. marfa update status says so: method is server where it can, and manual where it can't, with the step to take on its host. Upgrade an instance covers every other kind of install.
Start the update
Take a backup first. Starting an update needs instance.maintain:
marfa backups run
marfa update startAn agent at /mcp/admin starts one with marfa_update_server.
What the server checks first
The server changes nothing until the release passes each check:
- Who made it. The server downloads the release's checksum file and asks GitHub, at
api.github.com, for the proof that Marfa's release workflow built this release. The request carries only the digest of the checksum file. The server verifies the proof with the Sigstore keys it was built with. - That the download is whole. It downloads the archive only after the proof passes, and checks the archive against the checksum file and the proof.
- That the release runs here. Each new program must run and report the release, and the new server must accept the instance's settings and open its database.
When a check fails, the running programs stay as they were, and last.reason in marfa update status says why. Two reasons need a step from you:
- GitHub is limiting requests from your address. The reason says to try again in an hour.
- The server is too old to know Sigstore's current keys. It refuses every proof. Install the release with the install script, which makes the same check, then run
marfa server upgrade.
How the update ends
marfa update status reports progress.state settling until the try ends, then last. The old server is kept as .marfa-server.previous, and the new marfa is .marfa.next.
succeeded. Both programs report the new release after the new server has stayed up for 20 seconds. The oldmarfais.marfa.previous.rolled_back. Two early ends, or exit78, and the old release still opens the database. Stopping the service or machine counts no start.failed. A check refused the release and nothing changed, or the old release can't open the database and the new release stays.
When a start is refused
marfa update start answers 409 update_not_ready when no newer release has been found, and 409 update_unavailable when the server can't update itself.
It also answers 409 update_unavailable while the server keeps the record of an earlier update: one that hasn't settled, one that ended with a step left to take on its host, or one whose record can't be read. Nothing changes, and marfa update status keeps showing how the earlier update ended.
The refusal names the release that update was moving to, when the record reads, and the one step to take. That step is to wait for the update to settle, to restart the server's service, to install a release on the server's host, or to remove a record file it names by its full path. Take only the step the message gives, on the server's host.
The rules are in the updates chapter of the contract.