Add explicit user-service autostart configuration

This commit is contained in:
2026-10-08 23:22:51 +01:00
parent accbe63e39
commit 4697bb4465
10 changed files with 560 additions and 14 deletions
+6
View File
@@ -35,6 +35,12 @@ second background supervisor. Configure optional services separately using norma
OS tools. The old managed installation helper remains only for explicit legacy
data/lifecycle access; it is not the standard installer.
Optional autostart is a separate explicit `pipelines service enable` step. It
uses the OS user manager directly, requires trusted workspace roots, supports a
side-effect-free preview, and captures only documented environment settings.
Uninstallation refuses to remove binaries while its autostart definition remains;
disable the service first. Installation itself still registers or starts nothing.
## Verification limitations
The reviewer checked official stable OpenCode 1.18.35 in isolation and found V2
+37 -3
View File
@@ -45,8 +45,41 @@ selects another database, including an existing one; nothing is imported or move
automatically. `pipelines serve --help` prints the actual defaults on your machine.
Drafts use the OS user cache; `PIPELINES_DRAFT_DIR` overrides that location.
Use your OS's normal service manager if you want autostart. Pipelines does not
install a second supervisor. Native foreground startup is the default.
## Optional autostart
Stop any existing foreground or legacy server first, then explicitly configure
the OS user service:
```sh
pipelines service enable --workspace-root "$HOME"
pipelines service status
```
This starts the server now and at subsequent logins. Linux uses
`systemctl --user`; macOS uses a LaunchAgent in your user `Library/LaunchAgents`.
There is no sudo, Docker dependency, or second supervisor. Choose a narrower root
if possible; repeat `--workspace-root` for multiple trusted directories. `--db`
and `--addr` select the database/listen address, just like foreground startup.
Re-run enable to update the definition and restart with the new settings.
```sh
pipelines service enable --workspace-root "$HOME/repos" --print # preview only
pipelines service disable # stop and remove
```
Setup records the current PATH, HOME, XDG directory overrides, selected OpenCode
executable, and supported ntfy URL/token-file settings in a private service file.
It does not copy provider credentials or the rest of the shell environment.
Use `PIPELINES_NTFY_TOKEN_FILE`, not an inline token. Re-run enable after changing
these settings or moving binaries. Relative database/token-file paths are resolved
at configuration time. Services do not read your shell startup files.
On Linux this is **login autostart**, not automatically boot-without-login.
If needed, explicitly enable lingering using your system's normal administration
policy (`loginctl enable-linger "$USER"`). Pipelines does not change that policy.
macOS LaunchAgents likewise require a user login. Windows autostart is unsupported.
Use `journalctl --user -u pipelines.service` for Linux logs. On macOS inspect
`pipelines service status`; run `pipelines serve` in the foreground for diagnostics.
## OpenCode
@@ -78,7 +111,8 @@ expose an unauthenticated pipeline server or HTTP credentials to untrusted netwo
## Uninstall
Stop the foreground server first, then:
Disable autostart with `pipelines service disable` if configured, or stop the
foreground server first, then:
```sh
pipelines uninstall
+7
View File
@@ -24,3 +24,10 @@ Native generation/assistant completion parsing is regression-tested against a
controlled HTTP server. Full live inference, permission enforcement by real model
tool calls, cancellation during inference, optional Docker deployment, privileged
system-wide copying, and OS service-manager registration are **not tested**.
Autostart regression tests exercise both service-definition formats, scoped
environment capture, escaping, private files, refusal to overwrite unmanaged
files/symlinks, preview without side effects, and lifecycle calls using a mock OS
manager. The installed macOS CLI's preview was validated with `plutil -lint`.
`GOOS=linux GOARCH=amd64 go build ./cmd/...` also passed. Actual launchd/systemd
registration, logout/login restart, and Linux lingering remain **not tested**.