fix: enable systemd lingering for gateway

This commit is contained in:
Peter Steinberger
2026-01-05 18:38:30 +01:00
parent 0fb30db819
commit ad6bec4612
12 changed files with 346 additions and 25 deletions

View File

@@ -155,11 +155,13 @@ See also: `docs/presence.md` for how presence is produced/deduped and why `insta
- KeepAlive: true
- StandardOut/Err: file paths or `syslog`
- On failure, launchd restarts; fatal misconfig should keep exiting so the operator notices.
- LaunchAgents are per-user and require a logged-in session; for headless setups use a custom LaunchDaemon (not shipped).
Bundled mac app:
- Clawdbot.app can bundle a bun-compiled gateway binary and install a per-user LaunchAgent labeled `com.clawdbot.gateway`.
## Supervision (systemd example)
## Supervision (systemd user unit)
Create `~/.config/systemd/user/clawdbot-gateway.service`:
```
[Unit]
Description=Clawdbot Gateway
@@ -168,16 +170,27 @@ Wants=network-online.target
[Service]
ExecStart=/usr/local/bin/clawdbot gateway --port 18789
Restart=on-failure
Restart=always
RestartSec=5
User=clawdbot
Environment=CLAWDBOT_GATEWAY_TOKEN=
WorkingDirectory=/home/clawdbot
WorkingDirectory=/home/youruser
[Install]
WantedBy=multi-user.target
WantedBy=default.target
```
Enable with `systemctl enable --now clawdbot-gateway.service`.
Enable lingering (required so the user service survives logout/idle):
```
sudo loginctl enable-linger youruser
```
Requires sudo (writes `/var/lib/systemd/linger`).
Then enable the service:
```
systemctl --user enable --now clawdbot-gateway.service
```
## Supervision (Windows scheduled task)
- Onboarding installs a Scheduled Task named `Clawdbot Gateway` (runs on user logon).
- Requires a logged-in user session; for headless setups use a system service or a task configured to run without a logged-in user (not shipped).
## Operational checks
- Liveness: open WS and send `req:connect` → expect `res` with `payload.type="hello-ok"` (with snapshot).