feat(server): Linux start/stop via systemd user units - #2
Merged
Conversation
provn server start/stop now works on Linux using a systemd user service unit (~/.config/systemd/user/provn-semantic.service). No root required. Resolves the model path from config, falls back to ~/.provn/models/<name> for bare filenames. Finds llama-server via which, extracts port from the configured endpoint. provn server stop issues systemctl --user stop. The fallback (non-macOS, non-Linux) cfg guard is narrowed from not(target_os=macos) to not(any(macos, linux)) so Windows still gets the manual-start message cleanly.
There was a problem hiding this comment.
Pull request overview
This PR adds Linux support for managing the local “Layer 3” semantic inference server via systemd user units, aligning Linux behavior more closely with the existing macOS auto-start/stop flow while keeping the manual-start fallback for other platforms.
Changes:
- Add Linux-only
provn server start/stopimplementation that writes a user service unit and controls it viasystemctl --user. - Implement Linux-side model-path resolution and
llama-serverdiscovery (which llama-serverfallback). - Update non-macOS/non-Linux messaging to be platform-generic and “llama-server”-specific.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+709
to
+713
| if server_healthy() { | ||
| eprintln!(" {}● already online{} · 127.0.0.1:8080", GREEN, RESET); | ||
| eprintln!(); | ||
| return 0; | ||
| } |
Comment on lines
+748
to
+752
| let port: u16 = cfg.layers.semantic.endpoint | ||
| .rsplit(':') | ||
| .next() | ||
| .and_then(|s| s.trim_matches('/').parse().ok()) | ||
| .unwrap_or(8080); |
Comment on lines
+768
to
+773
| [Service]\n\ | ||
| ExecStart={llama_bin} -m {model_path} --host 127.0.0.1 --port {port}\n\ | ||
| Restart=on-failure\n\ | ||
| RestartSec=5\n\n\ | ||
| [Install]\n\ | ||
| WantedBy=default.target\n" |
Comment on lines
+781
to
+792
| let reload = std::process::Command::new("systemctl") | ||
| .args(["--user", "daemon-reload"]) | ||
| .output(); | ||
|
|
||
| if reload.map(|o| !o.status.success()).unwrap_or(true) { | ||
| eprintln!(" {}✗ systemctl daemon-reload failed{}", RED, RESET); | ||
| eprintln!( | ||
| " {}Is systemd --user running? Try: systemctl --user status{}", | ||
| DIM, RESET | ||
| ); | ||
| return 1; | ||
| } |
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.
Summary
provn server starton Linux writes a systemd user service unit to~/.config/systemd/user/provn-semantic.service, runssystemctl --user daemon-reload+start— no root requiredprovn server stopon Linux runssystemctl --user stop provn-semantic~/.provn/models/<name>llama-serverlocated viawhich; falls back to bare name if not foundjournalctl --user -u provn-semantic -ffor logscmd_servercfg guard narrowed fromnot(macos)→not(any(macos, linux))so Windows still gets the manual-start messageTest plan
provn server startwith model present → service unit written, server startsprovn server startwith model missing → clear error + download instructionsprovn server stop→ service stops cleanlyprovn server status→ pings health endpoint (unchanged)