Safer self-update: staged next to build/ (two renames, not a copy from RAM), waits for the new revision on /api/health and rolls back to build.old if it doesn't come up, a repeated request is a no-op, maptool-recover puts build/ back after a power cut mid-swap; the dashboard dark under the page's night mode; /can.html: frames in a second column on wide screens, changed bytes highlighted (fading, bits in the tooltip), the node state column a fixed width
CI / check (push) Successful in 21s
CI / deploy (push) Successful in 17s

This commit is contained in:
randy committed 2026-11-30 20:21:29 +01:00
1 parent 27313b3101
commit d58f7efc41
4 files changed
+111 -22

No files matched your search

+27 -4
View File
@@ -201,9 +201,21 @@ mustn't restart it mid-drive. Instead it checks Gitea itself (every
newer commit whose CI passed, a ⟳ button shows in the topbar; a click
writes `data/update/request.json`, `maptool-update.path` starts
`bin/update-maptool.sh` (as root — the container writes `data/` as root),
which downloads that commit's archive from Gitea, swaps it into `build/`
(the previous one stays as `build.old/`), restarts maptool and reports in
`data/update/status.json`; the page reloads on the new revision.
which downloads that commit's archive from Gitea, stages it as
`build.new/` (next to `build/`, the same filesystem — `/tmp` is RAM on the
Pi, a move from there would be a copy), swaps it in with two renames (the
previous one stays as `build.old/`), restarts maptool and waits up to
15 min for `/api/health` to answer with the new revision — if it doesn't
(the image didn't build, the app crashes), it moves the new tree to
`build.bad/`, puts the old one back and restarts again. It reports in
`data/update/status.json`; the page reloads on the new revision. Asked
twice for the same commit, the second run does nothing.
What survives what: a reload or a closed page — the update runs on the
host; a power cut while downloading — `build/` untouched, the button shows
again; a cut between the two renames (milliseconds) — `maptool-recover`
puts `build.new/` (complete by then) or `build.old/` back at boot; a cut
after them — the new tree is in place, maptool builds and starts at boot.
----
# /etc/systemd/system/maptool-update.path
@@ -220,10 +232,21 @@ Description=Update maptool to the commit the app asked for
After=network-online.target
[Service]
Type=oneshot
TimeoutStartSec=30min
ExecStart=/srv/podman/maptool/build/bin/update-maptool.sh
# /etc/systemd/system/maptool-recover.service
[Unit]
Description=Put maptool's build/ back if a power cut fell into an update's swap
Before=podman-compose@maptool.service
[Service]
Type=oneshot
ExecStart=/bin/sh -c 'cd /srv/podman/maptool && [ -d build ] || { [ -f build.new/app.rb ] && mv build.new build || mv build.old build; }'
[Install]
WantedBy=multi-user.target
----
`systemctl enable --now maptool-update.path`. Back by hand:
`systemctl enable --now maptool-update.path maptool-recover.service`. Back by hand:
`mv build build.bad && mv build.old build`, restart.
=== Library sync (both ways, OsmAnd-style)