flybrain/infra/config/fly-sudoers
acamilo 8474d93eb0 infra: flycontrol-edge.service and the FLY_CONTROL_VIA switch
Off by default. 05-deploy validates and writes FLY_CONTROL_VIA; the build
and package ship fly-control-edge; the edge gets the page's cpus. With the
control API on the bus, watchdog check 1 reads flysim's own /healthz and
check 1b restarts only the edge. Runbook: the live switch and rollback.
2026-10-01 23:33:59 +00:00

23 lines
1.5 KiB
Text

# infra/config/fly-sudoers — pushed to /etc/sudoers.d/fly-watchdog, mode
# 0440, validated with `visudo -c -f` before install.
#
# fly-watchdog.service runs as User=fly (docs/design/infra.md section 3:
# "all app units User=fly"), but its remediation is `systemctl restart
# <unit>` and, on the 5-consecutive-failure escalation, a container
# reboot. This is the minimum NOPASSWD surface for exactly what
# bin/fly-watchdog's checks actually restart (flysim, flystage, flycast,
# mediamtx, flypush, and flycontrol-edge when FLY_CONTROL_VIA=bus), plus reboot. No `systemctl stop`, no
# `enable`/`disable`, no arbitrary unit name, and no units this script
# does not itself restart (xvfb, pulse, flystage-web are never touched by
# fly-watchdog's checks, so they are not granted here).
fly ALL=(root) NOPASSWD: /usr/bin/systemctl restart flysim.service
fly ALL=(root) NOPASSWD: /usr/bin/systemctl restart flystage.service
fly ALL=(root) NOPASSWD: /usr/bin/systemctl restart flycast.service
fly ALL=(root) NOPASSWD: /usr/bin/systemctl restart mediamtx.service
fly ALL=(root) NOPASSWD: /usr/bin/systemctl restart flypush.service
fly ALL=(root) NOPASSWD: /usr/bin/systemctl restart flycontrol-edge.service
fly ALL=(root) NOPASSWD: /usr/sbin/reboot
# fly-loop-recover.service (also User=fly): its ladder restarts flysim (granted above) and
# resets to a milestone archive through this one root wrapper, which validates the rung,
# stops/resets/starts flysim and nothing else (infra/docs/loop-recovery.md).
fly ALL=(root) NOPASSWD: /opt/fly/bin/fly-loop-reset