Skip to content

feat(server): Linux start/stop via systemd user units - #2

Merged
ashvinctrl merged 1 commit into
mainfrom
feat/linux-server
Jun 2, 2026
Merged

feat(server): Linux start/stop via systemd user units#2
ashvinctrl merged 1 commit into
mainfrom
feat/linux-server

Conversation

@ashvinctrl

@ashvinctrl ashvinctrl commented Jun 2, 2026

Copy link
Copy Markdown
Owner

Summary

  • provn server start on Linux writes a systemd user service unit to ~/.config/systemd/user/provn-semantic.service, runs systemctl --user daemon-reload + start — no root required
  • provn server stop on Linux runs systemctl --user stop provn-semantic
  • Model path resolution: uses config value as-is if absolute or exists on disk; otherwise looks in ~/.provn/models/<name>
  • Port extracted from the configured endpoint URL
  • llama-server located via which; falls back to bare name if not found
  • Failure messages point to journalctl --user -u provn-semantic -f for logs
  • Fallback cmd_server cfg guard narrowed from not(macos)not(any(macos, linux)) so Windows still gets the manual-start message

Test plan

  • CI build passes on Linux runner
  • provn server start with model present → service unit written, server starts
  • provn server start with model missing → clear error + download instructions
  • provn server stop → service stops cleanly
  • provn server status → pings health endpoint (unchanged)
  • macOS build unaffected (cfg-gated)

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.
@ashvinctrl
ashvinctrl merged commit ecbc07b into main Jun 2, 2026
1 check passed
@ashvinctrl
ashvinctrl requested a review from Copilot June 10, 2026 08:45

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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/stop implementation that writes a user service unit and controls it via systemctl --user.
  • Implement Linux-side model-path resolution and llama-server discovery (which llama-server fallback).
  • 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 thread provn-cli/src/main.rs
Comment on lines +709 to +713
if server_healthy() {
eprintln!(" {}● already online{} · 127.0.0.1:8080", GREEN, RESET);
eprintln!();
return 0;
}
Comment thread provn-cli/src/main.rs
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 thread provn-cli/src/main.rs
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 thread provn-cli/src/main.rs
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;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants