Ship the systemd units, and stop the plan lying about what is done
CI / test (push) Successful in 1m16s

Phase 3 had a block duplicated into itself, including an unchecked
'EndpointSource becomes dynamic' sitting directly under the checked line
saying it was wired. Several phase 5 items had shipped without being ticked.

The units were only ever on the machines and in a scratch directory, which
makes them undocumented operational knowledge rather than part of the project.
KillMode=process in particular is not obvious and not optional: without it
systemd takes the engines down with the agent, turning a thirty-second upgrade
into a model reload on every node.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
Ilker ManapandClaude Opus 5 committed 2026-09-16 10:04:44 +02:00
1 parent 378383dd69
commit 555e4678cb
4 files changed
+92 -15

No files matched your search

+34
View File
@@ -0,0 +1,34 @@
# systemd units
Two roles, two units. Copy the one you need to `/etc/systemd/system/`, put the
matching configuration in `/etc/llmgw/`, and `systemctl enable --now` it.
## The control plane — `llmgw-server.service`
Runs unprivileged. It needs to read its own TLS key, so that file must belong to
the `llmgw` user and nothing else:
```
useradd --system --home-dir /var/lib/llmgw --shell /usr/sbin/nologin llmgw
chown llmgw:llmgw /etc/llmgw/server-key.pem
chmod 0400 /etc/llmgw/server-key.pem
```
`StateDirectory=llmgw` creates `/var/lib/llmgw` with the right owner, which is
where the store belongs. `ProtectSystem=strict` makes the rest of the filesystem
read-only, so anything else it writes to has to be named explicitly.
## The agent — `llmgw-agent.service`
Runs as root, because it launches engines and needs device access.
`KillMode=process` is the line that matters and the reason this file exists
rather than being generated. Without it, systemd kills the whole control group
on stop — including the engines, which hold a loaded model and are serving
traffic. Engines are meant to outlive an agent restart: the router talks to them
directly, and the agent adopts them again when it comes back. Taking them down
with the agent turns a thirty-second upgrade into a full model reload on every
node.
systemd will log `Found left-over process ... in control group while starting
unit. Ignoring.` on the next start. That is the mechanism working, not a fault.
+17
View File
@@ -0,0 +1,17 @@
[Unit]
Description=llmgw node agent
After=network-online.target
Wants=network-online.target
[Service]
ExecStart=/usr/local/bin/llmgw agent --config /etc/llmgw/agent.yaml
# Root, because the agent launches engines and needs device access. Engines
# outlive a restart of this unit and are adopted again on the next start, so
# KillMode must not take the whole process group with it.
KillMode=process
Restart=on-failure
RestartSec=2s
StateDirectory=llmgw-agent
[Install]
WantedBy=multi-user.target
+19
View File
@@ -0,0 +1,19 @@
[Unit]
Description=llmgw control plane
After=network-online.target
Wants=network-online.target
[Service]
ExecStart=/usr/local/bin/llmgw server --config /etc/llmgw/server.yaml
User=llmgw
Group=llmgw
Restart=on-failure
RestartSec=2s
NoNewPrivileges=true
ProtectSystem=strict
ProtectHome=true
PrivateTmp=true
StateDirectory=llmgw
[Install]
WantedBy=multi-user.target