show | install | remove | status, --dry-run; optional --disable-powersave (+ --install-iw), --disable-aspm, --reboot-after-min.
Tested read-only on the server (show, install/remove --dry-run, run --dry-run --simulate-fail); install was not run.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
scripts/ops/install-leleka-service.sh (owner runs it with sudo; nothing here was run by an agent):
--install [--no-start] [--force] copies scripts/ops/leleka.service to /etc/systemd/system, daemon-reload, enable, start; refuses when the
state is not prepared, a binary is missing, the user para does not exist, or the lab KAR holder runs
--remove stop, disable, remove the unit (state, logs, models untouched)
--status unprivileged: systemd state, lab mode, the supervisor's status.json (phase, uptime, restarts and reason, health), log tail
--lab on|off STATE/lab-mode: the unit (ConditionPathExists=!) stays down while the GPU belongs to the lab queue
docs/unattended.md: what runs, the exact owner steps (prepare with `leleka up --mode none`, install, use, look, update), lab mode, the fast cold
load (problem, change, measurements), the supervision table (what happens for every failure), logs and disk, security defaults, the soak test
(harness, criteria, the multi-day command), open items. docs/deploy.md section 6 follows the new restart, log and status behaviour.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
`leleka run` restarted a crashed engine twice after a fixed 5 s and then ended the service; a hung engine, a growing log and a client
waiting on a dead engine had no answer. All of it is now in the supervisor and in what `leleka up` writes:
* Restart with backoff (config.rs RestartPolicy backoff_initial_s 5 / backoff_max_s 300, max_engine_restarts 6 in a row, reset after 600 s
of ready): recover_engine() waits 5, 10, 20 ... s, counts a restart that fails (load refused, port taken) as an attempt and retries it
instead of ending the service; only after the last attempt does the supervisor exit 1 and let systemd start everything afresh.
* Hang detector (watchdog.rs, pure and tested; HealthPolicy in leleka.json: interval 10 s, fail 120 s, max_request 3900 s): every 10 s the
supervisor reads GET /metrics of the API (the control plane's own view; the engine's telemetry is not used, the API refreshes it only
between requests). API unreachable 120 s: restart the API. Worker not ready 120 s (the API lost the engine): SIGKILL and restart the
engine. A request active longer than 3900 s (generation_timeout 3600 + 300): the same. A stopped (SIGSTOP) or deadlocked engine ends this way.
* Requests get an error, not a hang: strata.json now carries runtime.stall_timeout_s 600 (no engine event for 10 min during a request cancels
it with an error to the client) and generation_timeout_s 3600 (RequestLimits in leleka.json).
* Bounded logs (logs.rs): every 10 s the supervisor copy-truncates any STATE/logs/*.log past 16 MiB, keeps 3 generations (children keep
their O_APPEND descriptors, nothing is told); <= 16 x 4 x 6 files; one 16 MiB copy per rotation. tail_of reads only the last 256 KiB.
* Status file: started_unix, restarts_total, last_restart_unix/reason, health, log_bytes; rewritten every 30 s as a heartbeat.
* units.rs (and scripts/ops/leleka.service, a test pins the file to the generator for the server layout): StartLimitIntervalSec=0 with
RestartSteps/RestartMaxDelaySec (30 s growing to 10 min), LimitCORE=0 (a 100 GB core dump must not hit the root NVMe), LimitNOFILE,
TasksMax, OOMScoreAdjust=-500 (system scope), journal rate limit, RequiresMountsFor, TimeoutStopSec 180, and ConditionPathExists=!STATE/lab-mode
so the unit stays down while the GPU belongs to the lab queue.
* Tests (fake runtime, no GPU): a reported hang kills and replaces the engine; restarts back off, a start that fails twice and then works is
just a slower restart, three failures in a row end the service with a message; an oversize log is rotated while the service runs; the
existing lifecycle tests (SIGKILL of the engine, SIGTERM drain) still pass. 134 unit tests.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>