Generated from
corpus/lines/software/units/sw.ops.socket-activation.md. Do not edit by hand — runpython scripts/generate-corpus-docs.py.
sw.ops.socket-activation¶
Status: draft (recovered)
Sources: 07 - Runtime/AGENTS.md
Guardrails¶
Default to lowest resident RAM that still handles requests reliably.
| Service type | Default | Exception |
|---|---|---|
| Static website/app | nginx only | — |
| HTTP API / web backend | systemd socket activation | always-on only if cannot inherit socket, has real background work, or needs live channel |
| MCP HTTP server | socket activation when supported | Keep warm if clients need long-lived sessions / streaming and socket inheritance is impossible |
| Worker, queue, scheduler, tunnel, VPN, reverse proxy, DB | always-on | — |
| OpenClaw gateway | always-on | Interactive agent gateway |
Socket-activated rules¶
.socketownsListenStream=127.0.0.1:<port>.- Service is started by the socket—not
WantedBy=multi-user.target. - Enable socket, disable service unit for idle-cold posture.
Restart=on-failure(notalways) so manual stop of idle backend sticks.- nginx: proxy real routes; junk paths local 404 so bots don’t wake cold services.
- Deploy: restart service only if active; keep socket active.
- Health checks may wake cold services; stop again after smoke if steady state is cold.
- Socket activation alone does not stop after idle—need app idle shutdown or documented reaper if required.
Prohibited¶
- Defaulting HTTP backends to always-on without documented reason
- Putting application source under
07 - Runtime/(build in Software Pipeline)