fix(maestro): maestro-web is now a proxy, not a local registry (NAP-231)
ci / rust (push) Successful in 4m36s
ci / rust (push) Successful in 4m36s
Earlier today I picked option 1 from NAP-231's open question (run `maestro-registry` locally on a different port). That was wrong: the user-facing framing is "local web UI", and option 2 — a thin front-end that serves the web bundle and reverse-proxies `/api/*` to whatever registry the daemon is already registered with — is what actually delivers that. What the new crate does: - `crates/maestro-web` ships a single binary `maestro-web`. - It embeds the web bundle the same way `maestro-registry` does (rust-embed against `web/dist/`). - Mounts the bundle at `/` and a reverse proxy at `/api/*` (catch-all). - HTTP proxy via `reqwest` — forwards method, headers (minus hop-by-hop), body, and passes upstream response headers (including `Set-Cookie`) back to the browser. - WS proxy upgrades both sides and shuttles frames with `tokio::select!`. Cookies on the initial `WebSocket` upgrade headers are forwarded so the registry sees the same browser session. - Reads `MAESTRO_REGISTRY` (upstream URL) and `MAESTRO_WEB_BIND_ADDR` (default `127.0.0.1:8888`) from env. - An integration test (`tests/proxy.rs`) stands up a mock upstream, proxies an HTTP request with cookies through, and round-trips a text WebSocket frame to verify the WS path. Installer changes: - Wizard now `cargo install`s `maestro-web` (not `maestro-registry`) when the user opts into the web service. - Unit template switched: `ExecStart=%h/.cargo/bin/maestro-web` plus `Environment=MAESTRO_REGISTRY=<upstream>` + `Environment=MAESTRO_WEB_BIND_ADDR=<bind>`. - New `--web-registry <URL>` flag. Default in interactive mode: read `registry_url` straight out of `~/.config/maestrod/config.toml`, so the proxy lines up with what the daemon is using without further prompting. Non-interactive runs without either of those error out rather than guess. Docs: - `docs/INSTALL.md` updated unit body + flag table. - `CLAUDE.md` repo-layout block now lists `maestro-web`. 148 tests pass workspace-wide (9 new in maestro-web, including the proxy integration test; 15 in installer).
This commit is contained in:
@@ -23,6 +23,7 @@ crates/
|
||||
├── maestro-registry/ # always-on phone book + HTTP API (NAP-213, NAP-215)
|
||||
├── maestro-cli/ # `maestro list/spawn/attach/kill` (NAP-216)
|
||||
├── maestro-installer/ # `maestro-install` wizard: cargo install + systemd (NAP-225)
|
||||
├── maestro-web/ # local web-UI front-end: assets + /api proxy (NAP-231)
|
||||
└── maestro-e2e/ # cross-process integration tests (NAP-217)
|
||||
web/ # browser client (NAP-218, plan 2)
|
||||
```
|
||||
|
||||
Reference in New Issue
Block a user