Repository navigation
feat(server): run as a native macOS launchd service - #811
Merged
Merged
Conversation
`solidping service install|uninstall|start|stop` now work on macOS, as on Windows. With sudo, install writes a launchd daemon that starts at boot and runs as root; without sudo, a launchd agent of the current user that starts at login. - The data folder defaults to /Library/Application Support/SolidPing (or ~/Library/Application Support/SolidPing for an agent), created readable by its owner only. config.yml and the SQLite database live there; nothing goes into the world-readable plist. - Logs go to logs/solidping.log in that folder, rotated at 20 MB; Go crash output to logs/crash.log. - launchd restarts the server 5 s after a failed run, not after a stop. - install warns when the binary is still quarantined by Gatekeeper. - Docs: the macOS page uses `service install` and `brew services`, with a note on moving off the old hand-written plist. Spec: specs/done/2026/11/2026-11-08-06-native-macos-service.md Co-Authored-By: Claude Opus 5.5 <[email protected]>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #811 +/- ##
==========================================
+ Coverage 89.21% 89.24% +0.02%
==========================================
Files 1331 1332 +1
Lines 135889 135941 +52
==========================================
+ Hits 121239 121325 +86
+ Misses 14641 14607 -34
Partials 9 9
🚀 New features to boost your workflow:
|
fclairamb
enabled auto-merge (squash)
November 8, 2026 19:24
This was referenced Nov 8, 2026
Merged
fclairamb
added a commit
that referenced
this pull request
Nov 9, 2026
The Linux follow-up to #802 (Windows) and #811 (macOS): `solidping service install|uninstall|start|stop` now work on Linux, through systemd. ```bash sudo mv solidping /usr/local/bin/ sudo solidping service install # system unit, enabled: starts at boot as user `solidping` sudo solidping service start ``` Without `sudo`, the same commands install a systemd user unit of the current user. Spec: `specs/done/2026/11/2026-11-09-01-native-linux-service.md`. ## What changes - **systemd unit.** `install` writes `/etc/systemd/system/solidping.service` (or `~/.config/systemd/user/` without sudo), then `daemon-reload` and `enable`. `start` / `stop` are `systemctl start` / `stop` (stop blocks until the server is gone). `uninstall` is `disable --now`, then it removes the unit. - **Dedicated user.** Unlike the macOS daemon, the system unit does not run as root: `install` creates a `solidping` system account when missing (`useradd --system`, no login, no home). The unit gets `CAP_NET_RAW` (ICMP raw fallback, traceroute) and `CAP_NET_BIND_SERVICE` (ports below 1024) as ambient capabilities, plus `NoNewPrivileges`, `PrivateTmp`, `ProtectSystem=strict` with `ReadWritePaths=<data folder>`, `UMask=0077`. - **Restart on failure only.** `Restart=on-failure`, `RestartSec=5`, `TimeoutStopSec=30`, the same values as the other platforms. - **Data folder.** `/var/lib/solidping` by default (`$XDG_DATA_HOME/solidping` for a user unit), created `0700` and handed to `solidping`. An existing folder is kept, with a `chown` hint if `solidping` does not own it. No secrets in the unit, which is world-readable. - **Logs go to the journal.** journald already rotates and timestamps logs, so `service run` on Linux only enters the data folder and serves to stdout: `journalctl -u solidping`. - **Guards.** `service run` is refused outside systemd (no `INVOCATION_ID`). `install` refuses a host not booted with systemd, a `--name` systemd would reject or that leaves the unit folder, and a data folder path with spaces, quotes or backslashes. `ExecStart` arguments are quoted, and `%`/`$` are escaped. It warns when the `solidping` user can't reach the binary (e.g. it is under `/root`). - `service` is now hidden only on the remaining platforms (BSD): `services are only supported on Windows, macOS and Linux`. - **Docs.** The hand-written unit on the Linux page is replaced by `service install`, with sections on the user unit, `systemctl edit` drop-ins (e.g. `EnvironmentFile=`), migrating from the old unit (`--dir /opt/solidping` keeps its data), updating and file storage. ## Tests - Platform-neutral unit tests: unit rendering (system and user), argument quoting, name and path checks, unit paths, default folder and name. Linux tests: `service run` refused outside systemd, the data folder mode, the binary reachability check. - **By hand in an Ubuntu 24.04 container booted with systemd:** the system unit (user created, folder `solidping 700`, `systemd-analyze verify`, start, `/api/mgmt/health` OK, running as `solidping` with `CapAmb` = `NET_RAW` + `NET_BIND_SERVICE`, stop with the graceful-shutdown lines in the journal, a broken `config.yml` restarted every 5 s with exit code 1, back up after a container reboot, uninstall). Also the user unit with lingering (runs as the user, journal via `--user`), and every warning and refusal above. - **New `linux-service` CI job on `ubuntu-26.04`:** the system unit cycle on a real systemd host (install, verify, enabled, folder owner and mode, start, health, user, stop, journal and DB checks, uninstall). It gates `ci`. - `golangci-lint run` is clean with `GOOS=linux`, `darwin`, `windows` and `freebsd`. 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Co-authored-by: Claude Opus 5.5 <[email protected]>
fclairamb
added a commit
that referenced
this pull request
Nov 9, 2026
🤖 I have created a release *beep* *boop* --- ## [0.45.0](v0.44.3...v0.45.0) (2026-11-09) ### Features * dashboard glance strips, failed sign-in account names, log noise fixes ([#824](#824)) ([659c52c](659c52c)) * **dashboard:** 24h / 7d / 30d availability window, saved per user ([#821](#821)) ([283a28e](283a28e)) * **mcp:** sharpen tool descriptions for Glama scoring ([#825](#825)) ([ca305f1](ca305f1)) * **server:** run as a native Linux systemd service ([#819](#819)) ([8a0cb2f](8a0cb2f)) * **server:** run as a native macOS launchd service ([#811](#811)) ([c6612ea](c6612ea)) * **server:** run as a native Windows service, no NSSM ([#802](#802)) ([c66c947](c66c947)) * **telegram:** explicit /support mode instead of capturing every message ([#820](#820)) ([571607e](571607e)) ### Bug Fixes * **auth:** admit by email address only when the email is verified ([#818](#818)) ([91992fe](91992fe)) * batch of production-log and Slack issues ([#808](#808)) ([580d09c](580d09c)) * **deps:** update github.com/dop251/goja digest to d6eaa50 ([#800](#800)) ([60b7443](60b7443)) * **deps:** update github.com/dop251/goja digest to d8dfb4d ([#810](#810)) ([e11b926](e11b926)) * **deps:** update go dependencies (non-major) ([#806](#806)) ([1c59927](1c59927)) * **deps:** update go dependencies (non-major) ([#822](#822)) ([ec0aebf](ec0aebf)) * **deps:** update module github.com/aws/aws-sdk-go-v2/credentials to v1.20.17 ([#823](#823)) ([27efc51](27efc51)) * **deps:** update module github.com/crewjam/saml to v0.6.3 ([#807](#807)) ([0f06336](0f06336)) * **deps:** update module github.com/wneessen/go-mail to v0.8.2 ([#812](#812)) ([3670206](3670206)) * **oncall:** record on-call override changes in the audit log ([#816](#816)) ([4561f41](4561f41)) * serve robots.txt, indexable on solidping.io only ([#809](#809)) ([3512833](3512833)) * **server:** refuse a pre-existing Windows service data folder others control ([#817](#817)) ([b1832b5](b1832b5)) * **vendorstatus:** drop datadog and atlassian from the catalog ([#814](#814)) ([d3397c5](d3397c5)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The macOS follow-up to #802:
solidping service install|uninstall|start|stopnow work on macOS, through launchd.sudo solidping service install # daemon: starts at boot, runs as root sudo solidping service startWithout
sudo, the same commands install a launchd agent of the current user, which starts at login.Spec:
specs/done/2026/11/2026-11-08-06-native-macos-service.md.What changes
installwrites/Library/LaunchDaemons/io.solidping.plist(or~/Library/LaunchAgents/without sudo).start/stoparelaunchctl bootstrap/bootout.stopwaits until launchd has let the server go. The plist stays, so a stopped service starts again at the next boot, like a Windows service with automatic start.KeepAlive {SuccessfulExit: false}andThrottleInterval5 s: a failed run restarts after 5 s, a clean stop (SIGTERM) does not. The server gets 30 s to close (ExitTimeOut)./Library/Application Support/SolidPingby default (~/Library/...for an agent), created0700.config.ymland the SQLite database live there. NoEnvironmentVariablesin the plist, which is world-readable.enterServiceDir(cmd_service_run.go): rotatedlogs/solidping.logandlogs/crash.log.logs/launchd.logonly captures what fails before solidping takes over its logs.installwarns when the binary still carriescom.apple.quarantine.--namedefault isio.solidpingon macOS, the label the old hand-written recipe used.serviceis still hidden on Linux, where it returnsservices are only supported on Windows and macOS.serviceRunnow takes the command's context on every platform. The Windows behaviour doesn't change.service install, the user-agent variant,brew services, and a migration note for anyone using the old hand-written plist.Companion PR: fclairamb/homebrew-tap#5 adds the
service doblock thatbrew services start solidpingneeds. It works with the current release.Tests
service runis refused outside launchd, and the data folder mode.0700), start,/api/mgmt/healthOK, a second start (kickstart), stop (job unloaded, graceful-shutdown lines in the log), uninstall (plist removed), andservice runrefused from a terminal. With a brokenconfig.yml, launchd restarted it every 5 s (runs = 3, exit code 1).macos-serviceCI job onmacos-15: covers thesudodaemon path, which I couldn't run here. It runs the tests, then a real install,plutil -lint, root-only folder check, start, health, stop, log and DB checks, and uninstall.golangci-lint run ./...is clean, and so is the main package withGOOS=windowsandGOOS=linux.🤖 Generated with Claude Code