# CB-504 — systemd unit for bridged (Linux). # # The macOS launchd agent (deploy/dev.ltms.bridged.plist) is the supervision target for the # current single-host deployment. This unit exists for the per-host gateways CB-308 introduces, # which will run on Linux. # # Install (user service — bridged drives the user's herdr, not a system daemon): # mkdir -p ~/.config/systemd/user # cp deploy/bridged.service ~/.config/systemd/user/ # # edit ExecStart / WorkingDirectory / Environment below, then: # systemctl --user daemon-reload # systemctl --user enable --now bridged # journalctl --user -u bridged -f [Unit] Description=bridged — claude-bridge message server Documentation=https://git.ltms.dev/lms/claude-bridge/wiki # Ordering only: herdr is a user process and its socket may appear after us. This is advisory — # bridged retries the herdr socket rather than exiting, which is what actually makes a late # socket survivable. Do NOT add Requires=: a herdr restart must not take bridged down with it. After=herdr.service Wants=herdr.service [Service] Type=simple WorkingDirectory=%h/src/claude-bridge/bridged ExecStart=/usr/lib/jvm/temurin-25-jdk/bin/java -jar target/bridged.jar bridged.yaml Environment=HERDR_SOCKET_PATH=%h/.config/herdr/herdr.sock # PATH matters more than it looks (CB-511): bridged propagates its own PATH to every worker it # spawns, so this line decides whether the fleet can run a build at all. systemd does not source a # login shell, so without it the daemon — and every worker — gets a bare default with no JDK/Maven. Environment=PATH=/usr/lib/jvm/temurin-25-jdk/bin:/usr/share/maven/bin:/usr/local/bin:/usr/bin:/bin # Secrets are NOT set here — this file is committed. Put the API/worker tokens in a private # drop-in that systemd reads with restrictive permissions: # systemctl --user edit bridged → [Service] / Environment=BRIDGED_API_TOKEN=... # or point EnvironmentFile at a 0600 file: # EnvironmentFile=%h/.config/bridged/env Restart=on-failure RestartSec=10s # A bad config (e.g. a non-loopback bind without token auth) makes bridged fail fast by design. # Give up rather than restart-loop on a permanent error. StartLimitBurst=5 StartLimitIntervalSec=120 # The daemon reads the repo, writes worktrees, and talks to a Unix socket — it needs no more. NoNewPrivileges=true PrivateTmp=true ProtectSystem=strict ProtectHome=read-write ProtectKernelTunables=true ProtectControlGroups=true RestrictSUIDSGID=true StandardOutput=journal StandardError=journal SyslogIdentifier=bridged [Install] WantedBy=default.target