feat(#1906): non-root weston gui on a fixed vnc port
This commit is contained in:
parent
5caec9c1a9
commit
3d2e0ef561
5 changed files with 127 additions and 80 deletions
|
|
@ -253,18 +253,27 @@ compositor with the VNC backend, surfaced as
|
|||
`/screen/ws` WebSocket relay (`docs/web-ui/agent.md::Per-agent endpoints`)
|
||||
connects to the compositor at `127.0.0.1:<vnc_port>`.
|
||||
|
||||
- **Port allocation**: deterministic FNV-1a of the agent name
|
||||
(read from `/etc/hostname`, leading `h-` stripped) mapped into
|
||||
`[15900, 16799]`. Mirrors the agent web-UI port pattern from
|
||||
`docs/gotchas.md::Web UI ports collide on hash` — same FNV-1a
|
||||
constant, different range. The compositor's startup script writes
|
||||
`/etc/hyperhive/gui.json = {"vnc_port":N,"auth":"none","wayland_display":"wayland-0"}`
|
||||
so the harness reads the port at runtime; no nix-side / harness-side hash
|
||||
duplication.
|
||||
- **Port allocation**: a **fixed** port (`hyperhive.gui.vncPort`,
|
||||
default 5900). No per-agent hashing: network isolation is
|
||||
unconditional (each agent has its own netns — see
|
||||
`docs/network.md#container-isolation`), so the VNC port is
|
||||
container-local and can't collide across agents. The harness learns
|
||||
the port from the `HIVE_GUI_VNC_PORT` env var (set on the harness
|
||||
service when `gui.enable`) — no marker file, no runtime hash. (Unlike
|
||||
the agent **web-UI** port, which is still an FNV-1a hash because those
|
||||
listen on the shared host stack — see `Web UI ports collide on hash`.)
|
||||
- **Non-root, shared user session**: weston runs as the agent's own
|
||||
user (`hyperhive.user.name`, the same user hive-ag3nt runs as), not
|
||||
root, so the GUI and the agent share one session. The runtime dir is a
|
||||
fixed `/run/gui` (systemd `RuntimeDirectory=gui`, `0700`,
|
||||
`RuntimeDirectoryPreserve=yes` so it survives weston restarts for the
|
||||
wayland client sharing the `/run/gui/wayland-0` socket). Wayland
|
||||
clients in the agent's config (e.g. bitburner electron) must run as the
|
||||
same user with `XDG_RUNTIME_DIR=/run/gui`.
|
||||
- **Fixed Wayland socket name (`--socket=wayland-0`)**: weston is
|
||||
launched with `--socket=wayland-0` so the socket path is
|
||||
deterministic. `harness-base.nix` exports `WAYLAND_DISPLAY=wayland-0`
|
||||
and `XDG_RUNTIME_DIR=/run/user/0` as global system environment
|
||||
and `XDG_RUNTIME_DIR=/run/gui` as global system environment
|
||||
variables (gated on `hyperhive.gui.enable`) so every systemd service
|
||||
in the container inherits them. Without this, services starting
|
||||
Wayland clients could not find the compositor — libwayland falls
|
||||
|
|
|
|||
|
|
@ -355,9 +355,9 @@ shaped).
|
|||
land on the right pixel regardless of CSS scale.
|
||||
- `GET /screen/ws` — raw RFB byte relay: proxies WebSocket
|
||||
frames to the weston VNC server at `127.0.0.1:<vnc_port>`.
|
||||
Transparent to any RFB variant. VNC port comes from
|
||||
`/etc/hyperhive/gui.json` (written by the weston startup
|
||||
script in `weston-vnc.nix`).
|
||||
Transparent to any RFB variant. VNC port comes from the
|
||||
`HIVE_GUI_VNC_PORT` env var (a fixed port set on the harness
|
||||
service when `hyperhive.gui.enable`; see `weston-vnc.nix`).
|
||||
|
||||
Bus events (new vocabulary on `/events/stream`):
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue