Skip to main content

max / makenotwork

2.0 KB · 47 lines History Blame Raw
1 # Bento app-build controller (bentod) — systemd USER service under the operator.
2 #
3 # bentod is a user service (not system) because it builds the apps and so needs
4 # the operator's environment directly: SSH keys to the tailnet build hosts + the
5 # mbp ops-agent, the app checkouts under ~/Code/Apps, and the _private layer for
6 # signing secrets (secrets_root). A hardened system user can't reach those.
7 #
8 # Install (one-time, no sudo except enable-linger):
9 # mkdir -p ~/.config/systemd/user
10 # install -m 0644 bentod.service ~/.config/systemd/user/
11 # loginctl enable-linger "$USER" # keep it running across logout/reboot
12 # systemctl --user daemon-reload
13 # systemctl --user enable --now bentod
14 #
15 # Watch: journalctl --user -u bentod -f
16 # Deploy a new bentod: build, copy to ~/.local/bin/bentod, then validate the
17 # fresh binary against the live config BEFORE restarting:
18 # ~/.local/bin/bentod --check-config && systemctl --user restart bentod
19 # (no sudo — that's the point of a user service). The unit also runs the same
20 # --check-config as ExecStartPre, so a bad config fails the start rather than
21 # crash-looping.
22 [Unit]
23 Description=Bento app build controller
24 After=network-online.target
25 Wants=network-online.target
26
27 [Service]
28 Type=simple
29 # Validate the config (daemon file + every app's in-repo manifest) before each
30 # start. A binary or schema change that can't parse the live config fails the
31 # unit here instead of crash-looping — the guard a per-app-config move needed
32 # when it bricked bentod for 20h. Same check runs at install (see README).
33 ExecStartPre=%h/.local/bin/bentod --check-config
34 ExecStart=%h/.local/bin/bentod
35 Restart=on-failure
36 RestartSec=5
37 Environment=BENTO_CONFIG=%h/.config/bento/bento-daemon.toml
38 # Loopback bind (default) needs no token. For a tailnet bind, set listen to the
39 # tailnet IP in bento-daemon.toml AND provide BENTO_API_TOKEN here, e.g.:
40 # EnvironmentFile=-%h/.config/bento/bento.env # contains BENTO_API_TOKEN=...
41 StandardOutput=journal
42 StandardError=journal
43 SyslogIdentifier=bentod
44
45 [Install]
46 WantedBy=default.target
47