feat: one download address per channel that never changes

https://updates.riverofglorymn.org/stable/latest.deb
  https://updates.riverofglorymn.org/canary/latest.deb

A symlink beside each channel's manifest, pointing at the versioned
package the manifest names. Deliberately not a second record of which
version is current — the manifest stays the only answer to that, and the
publish scripts derive the pointer from it rather than from anything they
know themselves.

The versioned files are never rewritten. A release uploads its package,
then the manifest, then swaps the pointer by rename. Atomic, so nothing
downloads a half-written pointer; and last, so the pointer can lag the
manifest by a moment and can never lead it. A pointer that led the
manifest would offer a package the channel had not published.

Both latest.deb and manifest.json are served no-store on the update
server. Cloudflare sits in front of it and caches .deb by extension, so
without that header a room could be handed the previous release from an
edge for hours. The versioned packages keep no such header because they
are immutable and worth caching.

The server change is one matcher in the Caddyfile's updates block, and it
took three attempts to land for a reason worth recording: the Caddyfile is
a FILE bind mount, so `mv` over it replaces the inode and the container
goes on serving the old one. Two apparently successful reloads changed
nothing. It is written through the mount now, and the host copy is
identical so the next container restart is a no-op. Caddy was reloaded,
never restarted; the church's other sites were not interrupted.

Installing from a channel URL still does not move a machine onto that
channel. CHANNEL in device.conf decides which manifest the updater
follows, and the postinst only appends settings that are missing, so
fetching the canary package by hand to repair a machine leaves it on
stable.

Verified end to end against the live server: both URLs deliver bytes whose
sha256 matches their channel's manifest, both carry the no-store header,
and the versioned package does not.

Co-Authored-By: Claude Opus 5 <[email protected]>
This commit is contained in:
ekklesia
2026-09-20 21:11:35 -05:00
co-authored by Claude Opus 5
parent bf7b959893
commit 886f8a70d2
4 changed files with 121 additions and 0 deletions
+31
View File
@@ -445,6 +445,37 @@ check("the same Trixie gate runs first",
check("and the manifest goes up last",
code.rindex("manifest.json") > code.index("packages/"))
print()
print("7c-iii. the permanent download addresses")
# .../stable/latest.deb and .../canary/latest.deb. One address per channel
# that never changes, and still no second record of which version is
# current: the pointer is a symlink to the package the manifest names.
for channel, script in (("canary", "update_canary.sh"),
("stable", "update_stable.sh")):
text = (root / script).read_text()
code = "\n".join(line for line in text.splitlines()
if not line.lstrip().startswith("#"))
check(f"{script} moves the {channel} pointer",
f"{channel}/latest.deb" in text or "latest.deb" in code)
check(f"{script} points it at the versioned package",
"ln -sfn ../packages/$package_name" in code)
# Atomic, so nothing downloads a half-written pointer, and after the
# manifest, so the pointer can lag it but never lead it — it can never
# offer a package the channel has not published.
check(f"{script} swaps it by rename rather than in place",
"mv -Tf latest.deb.new latest.deb" in code)
# Against the rsync that actually uploads the manifest, not the echo
# at the end that prints its URL.
upload = f"classroom-updates/{channel}/manifest.json"
check(f"{script} moves it after the manifest goes up",
code.index("latest.deb") > code.index(upload))
check(f"{script} refuses to point at a package that is not there",
"test -f ../packages/$package_name" in code)
check("and neither script writes a version anywhere but the manifest",
"latest.json" not in (root / "update_canary.sh").read_text()
and "latest.json" not in (root / "update_stable.sh").read_text())
print()
print("7d. the broker every room shares")
mqtt_unit = (root / "systemd/mqtt/ekklesia-classroom-mqtt.service").read_text()