English | 简体中文
This local entrance simulator gives device developers and venue staff a browser view of four synthetic gates. It models barcode scans, turnstile motion, lights, device connections, power and the venue network. It implements Gatepost's device simulator protocol.
Install Docker, then run from this repository:
scripts/venue.sh up --gatepost ../gatepost --ref 2b4843b --mode devices
scripts/venue.sh status
scripts/venue.sh downThe script builds gated in a detached temporary worktree, starts the standalone entrance at http://127.0.0.1:28080, and removes the worktree with down. For a revision with the hub, use --ref main. For the Gate 3 crash scenario, build the revision before the fix in a separate detached worktree and pass --gate3-crash DIR; down includes compose.gate3-crash.yaml in cleanup. GATEPOST_REF=main scripts/e2e-gatepost.sh controls starts a standalone entrance, checks real Docker network and power actions through the bridge WebSocket, and cleans up. Its other modes run the historical Playwright checks against an active entrance. The ticket file contains only synthetic barcodes.
The venue lab integration uses the lab's base Compose file:
scripts/venue.sh up --gatepost ../gatepost --ref main --mode lab
scripts/venue.sh downThe lab requires a Gatepost revision with lab/compose.yaml and simulator backends. The lab overlay's standalone config supplies a default gate image for validation. Set LAB_GATE_IMAGE to the lab gate image when combining it with a lab whose gate image differs.
SIM_PORT changes the local page port. The bridge listens for the page on port 8080 inside its container, publishes only to host loopback, and accepts device TCP on the private devices network. AUTO_PASS_MS enables automatic passage after a relay opens. At startup the bridge reads the mounted Docker socket's group inside the container, then runs as node with that supplementary group. The health endpoint and page report socket access.
The browser WebSocket is /ws. The bridge sends { "type": "snapshot", "gates": [], "events": [], "tickets": [], "docker": { "ok": true, "message": "Docker socket accessible" } } and { "type": "error", "message": "..." }. The browser sends scan (gate, barcode), simultaneous (gates, barcode), burst (count, intervalMs), pass (gate), power (gate, on), or network (gate, on). Gate IDs must be configured services. The event log records the wire lines and directions. The bridge does not decide ticket validity; gated does.
Use Node 26.13.1 and pnpm 10.20.0. Run pnpm install --frozen-lockfile, then pnpm lint, pnpm typecheck, pnpm test, and pnpm build. pnpm test:e2e runs browser checks against a running bridge and fake gates. CI also builds the image, produces an SBOM, and scans it.
Install headless Chromium with pnpm exec playwright install chromium, then capture light and dark pairs for Gate 3 stopping after an unknown barcode, two gates admitting one ticket before the race fix, exactly one gate admitting it after the fix, and offline admission at two gates. In the offline scene, Gate 2 admits a ticket with its cable unplugged and network LED off. Online Gate 1 then admits the same ticket through the hub, which has not heard of Gate 2's local admission. The event log labels each decision from the network LED reported by the gate.
GATEPOST_DIR=../gatepost \
GATE3_WORKING_REF="$gate3_fix" GATE3_CRASH_REF="$gate3_crash" \
DOUBLE_ADMISSION_BEFORE_REF="$race_before" DOUBLE_ADMISSION_FIXED_REF="$race_after" \
OFFLINE_ADMISSION_REF=69c5ea6 \
scripts/screenshots.shChoose each ref from your Gatepost checkout before running: gate3_fix is the revision after the Gate 3 crash fix; gate3_crash is a revision that still exhibits the crash; race_after is the revision with the hub race fix; race_before is a revision that still exhibits double admission. OFFLINE_ADMISSION_REF needs the hub client and network LED; 69c5ea6 has both. Use git -C ../gatepost log --oneline --all to find them, then set those five shell variables. The script builds detached temporary worktrees, checks the historical behavior, writes 1440 × 900 screenshots at 2× device scale under docs/screenshots/, and runs Compose down -v for every entrance. See screenshot notes.
The bridge has the Docker Engine socket mounted. Anyone who can use that socket can manage every container on the host. This local development service publishes its page only on 127.0.0.1 and checks the configured Compose project and service allow-list before power or network actions. The network control disconnects and reconnects only the venue network, saving its address, MAC and aliases; the private device network stays connected. The simulator models hardware commands, not radio, power-supply behavior, or scanner optics.