Files
openbot/scripts/hosting/openbot-update.timer
T
NBandClaude Opus 5.5 42c9b23f35 Update hosted servers to the newest release at the next start (#1184)
* Update hosted servers to the newest release at the next start

A timer stages a newer release while OpenBot runs. At the next boot, before OpenBot starts, a
service copies it into place. The updater reads the manifest of the Linux desktop updater, checks
the SHA-512, and never moves a server to an older version.

boat saves /opt by the changed paths, and it drops the files of a directory that `mv` moves.
So a release gets to /opt only as a copy of each file, with markers for a copy that a stop
interrupts. The updater also waits for boat's lazy restore after a resume.

provision.sh uses the same steps, and the Linux build contains scripts/hosting, so a new release
can update the server scripts, units and packages.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* Do not stop a hosted server in use for a plan change

A resize stops the server. The Worker now waits until the server sent no
activity report for 7 minutes. A server that stops for no use gets the
new machine at its next resume.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* Make hosted updates recover from a failed apply

- apply waits for the disk restore only when an update is staged, so
  OpenBot does not start late at each resume.
- The markers stay until the hosting files are installed, so a failure
  is done again at the next boot. stage does nothing until then.
- stage checks all hosting files and stops when the installed version is
  not known. provision.sh does not downgrade.
- Finish an interrupted dpkg run before apt. Longer apply timeout.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* Claim a hosted server resize before the boat stop

The cron reads its rows first and then stops each server in sequence.
Activity that came in after the read did not stop the resize. The
resize now sets the row to stopping only when the server had no use in
the last 7 minutes, and a 409 from boat sets it back to running.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-30 08:25:01 +02:00

13 lines
349 B
SYSTEMD

# A hosted server runs only while it is in use, so the first check comes soon after each start. The
# delay counts from the start of the timer: boat resumes a server on a machine that booted before.
[Unit]
Description=Check for an OpenBot update
[Timer]
OnActiveSec=5min
OnUnitActiveSec=6h
RandomizedDelaySec=5min
[Install]
WantedBy=timers.target