M4: LAN playtest run script (devbox run serve) #80
Notifications
Due Date
No due date set.
Blocks
#77 M4: real-phone playtest gate (Note 10, 60 fps)
SirStone/FFF_vtt_frozen
Reference: SirStone/FFF_vtt_frozen#80
Reference in New Issue
Block a user
Part of #63
Goal
One
devbox runcommand that puts the real table on the LAN, so a phone can join without hand-assembling nim + nginx + a certificate. Todaydevbox.jsonhas onlytest,e2e,client-test,mutationandbench; README documents the manual path (build the server, write an nginx config, generate a cert).tools/nginx.mjsandtools/tlsdev.mjsare test-only: loopback ports, three-day loopback-SAN certificate, per-run temp state dir — unusable for a phone on the LAN.Target:
devbox run serve(name may change) that the owner can start on the laptop and hand a URL to the phone.Acceptance criteria
devbox run <script>builds clientdistand the server binary, then starts the server and a TLS+HTTP/2 nginx in front of it with the §11.1 vhost shape (/static dist with SPA fallback,/join,/ws,/tiles/, internal/_tiles/).localhost/127.0.0.1)./and/join, and a WS upgrade on/wssucceeds, on the LAN address (not loopback only). Onedevbox run testaddition or its own script, but it must run in the gate.devbox run test,devbox run client-test,devbox run e2egreen on a clean checkout, no test weakened or skipped.Proven at
The new devbox script + a black-box smoke harness (h2/TLS/WS on the LAN address); README updated.
Notes
tools/tlsdev.mjsis the reference for cert generation but its SANs and 3-day lifetime are test-only; either parameterise it or keep a separate dev variant, without turning it into a test-only dependency inversion.Implemented in
3567058(rebased on top of #78/#79).devbox run servebuilds the client dist andrun/fff-vtt, then starts the DESIGN 11.1 vhost (nginx TLS+h2) on the detected LAN IPv4 (FFF_VTT_LAN_HOSToverride,0.0.0.0allowed) in front of the loopback server. State, GM key and certificate persist underrun/lan(FFF_VTT_STATE_DIR,FFF_VTT_LAN_PORT=8443): restart reuses the same DB/key/cert; a changed LAN address regenerates the cert and reprints the trust steps. Startup prints URL, GM key and Android Chrome / Linux / macOS / Firefox trust steps; SIGINT stops nginx then the server and releases the port.Shared helpers:
tools/tlsdev.mjsnow takes SAN/lifetime/subject (test defaults unchanged,.cert-optsstamp triggers regeneration when the address changes);tools/nginx.mjstakes bind host/server name/cert dir;tools/withserver.mjsaccepts a prebuilt binary. New:tools/lanserve.mjs(stack),tools/serve.mjs(CLI/printing/shutdown),tools/serve.sh(build+exec),tools/serve.test.mjs(indevbox run test).Smoke proof on the LAN address (not loopback): verified TLS + ALPN h2 on
/healthzand/, POST/joinwith the GM key (303 +fff_session),/wsupgrade (hello+walls), nginx holds<lan-ip>:8443while the server listens only on127.0.0.1; stop releases the port; restart yields the same GM key and byte-identical certificate./uses the same stub dist asvhost.test.mjs(the real Vite build is covered by client-test/e2e); manualdevbox run servewas also smoke-tested against the real dist.Gates on the rebased tree:
devbox run test162 passed,devbox run client-test173 passed,devbox run e2e27 passed. README now leads withdevbox run serveand keeps the manual nim+nginx+cert path as a fallback.