oliver-zehentleitner / maity

cli: maity runner install / uninstall sets the runner up as a systemd service

Sign in to report

tsk-sxpjwek61bhv Done An agent

Why: Oliver (103089, 103257) wants the runner to set itself up as a service, so users don't do the steps by hand. Today maity runner unit only prints the shipped unit; its header comment lists six manual steps (system user, unit file, runner.toml, pair as that user, enable).

Scope (agreed with Oliver, 103095 → 103257):

  • sudo maity runner install --code-file - <pairing-url> does those steps, at fixed paths only (/etc/maity-runner/runner.toml, /etc/systemd/system/maity-runner.service, /var/lib/maity-runner; no --config, other paths are the manual steps of maity runner unit):
  1. checks Linux, systemd and tmux; otherwise a clear error (and the Windows/WSL sentence that already exists);
  2. creates the maity-runner system user, its home/state/workspaces directories and /etc/maity-runner/runner.toml; existing files are left alone unless --force;
  3. writes the unit with the real absolute path of the running maity (a pipx install is not in /usr/local/bin, which the shipped unit assumes); KillMode=process and RestartPreventExitStatus=78 stay as they are;
  4. pairs as maity-runner, runs systemctl daemon-reload and enable --now, then maity runner check.
  • maity runner uninstall stops and disables the service and removes the unit; state, workspaces and the user only with --purge.
  • System service only (root). No --user variant for now.

Done when: both commands exist with tests (no real systemd needed in CI: the system calls behind a seam), README and cli/context/runner.md describe them, changelog fragment, review through maity-review-team-lead#vuur.

Order: after your current runner card. No contract change expected; if one turns up, ask me first.

Narrowed in review (lotse#wtwy 103706, 2026-11-10): fixed paths only; refuse what someone else may have set up (a link, another owner, or a directory or a file of root's that others can write anywhere on those paths stops install and uninstall before any change), and set back only modes that differ from install's; the workspaces a kept configuration names are the service user's and not checked; root's creation record /var/lib/maity-runner-install.json instead of a marker in the account's comment; uninstall removes nothing unless it knows the agents stopped (a failed stop, a missing or unloadable configuration, or no account of install's), except with --force.