flybrain/infra/units/fly-runtime-fallback.service
acamilo 1d29ab1ff8 infra: persistent session-to-legacy fallback, signal-safe fly-runtime, MALLOC_ARENA_MAX=2
The fallback used to live only inside one 'fly-runtime session' invocation. The session
drop-in now carries OnFailure=fly-runtime-fallback.service and a 3-starts-in-10-minutes
start limit, so a session binary that will not stay up puts flysim.service back on legacy
after a reboot, a watchdog or loop-recover restart or a deploy. 'fly-runtime fallback'
removes the drop-in, daemon-reloads, restarts on legacy, writes /run/fly/runtime-fellback.json
and a journal line; it is locked, idempotent and keeps the drop-in if legacy cannot start.
fly-runtime traps INT/TERM/HUP and any failure during a switch and rolls back to the
previous state. Session drop-in and flysim-session.service set MALLOC_ARENA_MAX=2.
05-deploy keeps the chosen runtime (operator decision: session stays, trust gates),
refreshes the drop-in in place, and says so; the runbook documents all of it.
lint.sh drives the fallback, the interrupts and the deploy policy against a fake systemctl.
2026-09-30 00:11:25 +00:00

18 lines
1.2 KiB
Desktop File

# infra/units/fly-runtime-fallback.service — pushed to /etc/systemd/system/.
#
# The persistent fallback from the session runtime to the legacy loop (SERVE-01 review, C1).
# It is never enabled and in no target: the drop-in that `fly-runtime session` writes on
# flysim.service (10-runtime.conf) carries `OnFailure=fly-runtime-fallback.service` together with
# StartLimitIntervalSec=600 and StartLimitBurst=3, so three starts of flysim.service on the
# session binary inside ten minutes -- from any cause, and from any caller: a reboot, the
# watchdog, fly-loop-recover, a deploy -- run this unit once. `fly-runtime fallback` removes the
# drop-in (which removes this OnFailure= too), daemon-reloads, restarts flysim.service on the
# legacy binary and writes /run/fly/runtime-fellback.json plus a journal line (tag fly-runtime).
# It is idempotent and refuses to act without an executable legacy binary. Runs as root.
[Unit]
Description=fly-runtime-fallback: flysim.service failed on the session runtime, back to legacy
# Its own start limit stays the default; a fallback that has already happened is a no-op.
[Service]
Type=oneshot
ExecStart=/opt/fly/bin/fly-runtime fallback