feat(m4): LAN playtest run script (devbox run serve) (#80)
One command builds the client dist and server binary, then starts the loopback server behind the DESIGN 11.1 TLS/HTTP2 nginx on the detected LAN address. State, GM key and certificate persist under run/lan so a table and a phone's trust survive Ctrl-C/restart; the certificate is regenerated when the address changes. Prints the URL, GM key and Android/laptop trust steps. tools/nginx.mjs and tools/tlsdev.mjs gained the bind/SAN knobs the LAN needs (test defaults unchanged). tools/serve.test.mjs proves h2 + verified TLS on /healthz and /, POST /join, a /ws upgrade on the LAN address, loopback-only server binding, and identical key/cert after a restart.
This commit is contained in:
@@ -6,8 +6,9 @@ The server decides what each player sees — line of sight, explored area, token
|
||||
modified client cannot reveal anything its player is not entitled to. No accounts, no external
|
||||
database, one scene, no RPG rules or dice.
|
||||
|
||||
Status: the client (M4) is built; the manual phone playtest is still pending. The NixOS
|
||||
deployment module is M6 and not written yet — today you run the binary behind your own TLS nginx.
|
||||
Status: the client (M4) is built; `devbox run serve` puts a table on the LAN for the manual phone
|
||||
playtest. The NixOS deployment module is M6 and not written yet — for a permanent install you still
|
||||
run the binary behind your own TLS nginx (the manual path below is the fallback).
|
||||
|
||||
---
|
||||
|
||||
@@ -20,7 +21,40 @@ deployment module is M6 and not written yet — today you run the binary behind
|
||||
- An HTTPS site in front of it. The session cookie is `Secure`, so plain HTTP will not keep you
|
||||
signed in. The server itself always binds `127.0.0.1`; nginx is the only public face.
|
||||
|
||||
### Build it once
|
||||
### Start a LAN playtest (one command)
|
||||
|
||||
From the repo root, inside devbox:
|
||||
|
||||
```sh
|
||||
devbox run serve
|
||||
```
|
||||
|
||||
It builds the server binary and the client, starts a TLS + HTTP/2 nginx on the laptop's LAN address
|
||||
in front of the server (the server itself stays on `127.0.0.1`), and prints:
|
||||
|
||||
- the `https://<lan-ip>:8443` URL to open on the phone and the laptop,
|
||||
- the GM key (created on first run; an existing key is printed, never replaced),
|
||||
- the certificate-trust steps for Android Chrome and for a laptop (Linux/macOS/Firefox).
|
||||
|
||||
Ctrl-C stops nginx and the server and releases the port; the next start works. State (`state.db`,
|
||||
`tiles/`), the GM key and the certificate live under `run/lan` and are **not** wiped, so a session
|
||||
survives a restart and a phone that trusted the certificate does not have to trust it again.
|
||||
|
||||
| setting | env | default |
|
||||
|---|---|---|
|
||||
| LAN address nginx binds | `FFF_VTT_LAN_HOST` | detected LAN IPv4 (`ip -4 route get 1.1.1.1`) |
|
||||
| nginx TLS port | `FFF_VTT_LAN_PORT` | `8443` |
|
||||
| state directory | `FFF_VTT_STATE_DIR` | `run/lan` |
|
||||
|
||||
The certificate's SAN is the LAN address. If the laptop's address changes, `serve` regenerates the
|
||||
certificate (and prints the trust steps again). This is the playtest path, not the M6 deployment:
|
||||
no systemd unit, hardening or backups.
|
||||
|
||||
### Manual fallback: build it once
|
||||
|
||||
Everything below is what `devbox run serve` automates; use it when you need to arrange the
|
||||
processes yourself (or to see the paths involved).
|
||||
|
||||
|
||||
From the repo root, inside devbox:
|
||||
|
||||
|
||||
Reference in New Issue
Block a user