feat(maestro): optional maestro-web systemd unit in installer (NAP-231)
ci / rust (push) Successful in 2m9s

After the daemon-unit step, the wizard now offers a second user unit
(`maestro-web.service`) that runs `maestro-registry` on 127.0.0.1:8888
so the web UI is reachable in a browser locally.

Decisions:

- The unit runs `maestro-registry` directly — the web bundle is already
  embedded in that binary, so a separate `maestro-web` binary would be
  pure cost. `Description=` and the unit filename make the user-facing
  framing clear.
- `Wants=maestrod.service` + `After=` (not `Requires=`): the registry
  process doesn't actually need the daemon to start; the web UI just
  has nothing to show without one. Soft dependency expresses that.
- Default loopback bind is `127.0.0.1:8888` to make it obvious which
  port is the local UI vs a separately deployed registry on `:8080`.

Wizard surface:

- New prompt (default *no*) after the daemon-systemd step.
- New flags: `--no-web`, `--web-bind <addr>`, `--web-exec-start <path>`.
- Skipped automatically when systemd is absent or `--no-systemd` is set.
- The re-run/update path mirrors the daemon flow: refresh the unit,
  daemon-reload, restart instead of start.
- `maestro-registry` is only `cargo install`ed when the user opts in,
  keeping the no-web install footprint unchanged.

docs/INSTALL.md gets the new flags + a full sample unit body.
This commit is contained in:
2026-05-26 08:47:33 +00:00
parent 91f252b4e2
commit 2aa2d3e20d
4 changed files with 252 additions and 7 deletions
+34 -1
View File
@@ -43,8 +43,13 @@ The wizard:
3. On systemd hosts, optionally writes a user unit at
`~/.config/systemd/user/maestrod.service`, reloads systemd, and offers to
enable + start it.
4. On systemd hosts, also offers a **local web UI** unit
(`~/.config/systemd/user/maestro-web.service`). When accepted, this also
`cargo install`s `maestro-registry` and runs it bound to `127.0.0.1:8888`
(override with `--web-bind`). Skip with `--no-web` (or just answer "n"); a
remote registry deployment is the alternative.
Both binaries land in `~/.cargo/bin` — make sure that's on your `$PATH`.
Binaries land in `~/.cargo/bin` — make sure that's on your `$PATH`.
## Flags
@@ -57,6 +62,9 @@ Both binaries land in `~/.cargo/bin` — make sure that's on your `$PATH`.
| `--exec-start <path>` | Override the systemd unit's `ExecStart` (default `~/.cargo/bin/maestrod`). |
| `--no-systemd` | Skip the systemd step even if detected. |
| `--no-configure` | Skip the `maestrod configure` step. |
| `--no-web` | Skip the optional local web-UI unit + `maestro-registry` install. |
| `--web-bind <addr>` | Loopback bind for the web UI (default `127.0.0.1:8888`). |
| `--web-exec-start <path>` | Override the web unit's `ExecStart` (default `~/.cargo/bin/maestro-registry`). |
| `-y`, `--yes` | Non-interactive: install binaries + drop systemd unit + reload + enable, but **don't** auto-run `configure` or auto-start the unit (those need real config). |
## What the systemd unit looks like
@@ -87,6 +95,31 @@ systemctl --user status maestrod
journalctl --user -u maestrod -f
```
The optional `maestro-web.service` looks like:
```ini
[Unit]
Description=Maestro local web UI (maestro-registry on 127.0.0.1:8888)
Documentation=https://git.naps.pt/naps62/maestro
After=network-online.target maestrod.service
Wants=maestrod.service
[Service]
Type=simple
Environment=MAESTRO_REGISTRY_BIND_ADDR=127.0.0.1:8888
ExecStart=%h/.cargo/bin/maestro-registry
Restart=on-failure
RestartSec=5
[Install]
WantedBy=default.target
```
`Wants=maestrod.service` (not `Requires=`) — the registry process is
technically independent of the daemon, but the web UI has nothing to show
without one connected, so we order this after `maestrod` and politely
encourage it.
## Running the wizard without the bootstrap script
If you'd rather skip the script: