Files
LithosAnanke/demo/README.md
T
rajamesandClaude Opus 5.5 9e711563b4 demo: StarshipOS in a browser -- a throwaway machine per visitor, as Zuse (#111-#115)
Captain Bob, 2026-11-06: a terminal with QEMU amd64 for people to play
with; "Mint Zuse for demo console" (#111); "Make the most recent of
builds that's green the demo"; a Try-it XWiki page with the console
embedded.

demo/ -- see its README:
  mint-zuse.sh       a Zuse of the demo's own, as a stick: blank pair,
                     system=v3 genesis, a second boot to confirm, make
                     zusestick. Never anyone's real Zuse
  build-iso.sh       the amd64 ISO, packed as make qemu packs it
  make-snapshot.sh   boot once to [zuse@Hera] ok>, save the machine
  start-session.sh   one visitor: the saved machine resumed, ended on
                     hang-up, close or time-out
  console.py         joins the visitor's terminal only once the machine
                     runs; keys typed while it loads are discarded
  qemu-args.sh       the machine, shared by save and resume
  starshipos-demo.service, apache-demo.conf, xwiki-try-it.xwiki

Every session is a copy: no network, read-only image, the Zuse stick's
writes discarded, QEMU's seccomp sandbox, an unprivileged user, a
fenced systemd unit, 30 minutes at most.

Tested here, from the sources master accepted (run 153): the Zuse
minted (logs/20261106-192626, -192739); the saved machine at POST
538/538 and [zuse@Hera] ok>; a session through ttyd's websocket ready
in 0.2 s, 3 4 + . -> 7 ok, 7 SQUARE . -> 49 ok; QEMU gone at once on
hang-up, close and time-out. Found and fixed on the way: a machine
saved stopped resumes stopped; a prompt matched as a regex; QEMU left
behind by a hang-up; keys lost while the machine loads. Not tested
here: Apache, several sessions at once (#116).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01GE3SDvQn5EoxdGufk84zz2
2026-11-06 19:41:22 +00:00

3.4 KiB

demo/ -- StarshipOS in a browser

A public "Try it" console: each visitor gets a StarshipOS machine of their own, logged in as a Zuse minted for the demo, resumed at its prompt in under a second, gone when they leave. Milestone Public demo terminal (#111-#117).

XWiki "Try it" page (iframe) -> Apache: TLS, websocket -> ttyd -> start-session.sh
                                                                   -> QEMU amd64, resumed from the saved machine
                                                                   <-> console.py <-> the visitor's terminal

The pieces

File What it does
mint-zuse.sh Mints a Zuse of the demo's own -- never anyone's real one -- as a stick (#111, ruled 2026-11-06)
build-iso.sh Packs the amd64 ISO from a kernel build, as make qemu packs it
make-snapshot.sh Boots the machine once to [zuse@Hera] ok> and saves it (#113)
start-session.sh One visitor's session: resumes the saved machine, ends it on hang-up, close or time-out (#112)
console.py Joins the visitor's terminal to the machine only once it runs, discarding keys typed while it loads
qemu-args.sh The machine, shared by the two above: a resumed machine must match the saved one exactly
starshipos-demo.service ttyd as a systemd service, on localhost, at most 3 sessions (#114)
apache-demo.conf Example vhost: TLS, the websocket, framing allowed for the XWiki only (#115)
xwiki-try-it.xwiki The XWiki "Try it" page, with the console embedded (XWiki 2.1 syntax)

What a visitor cannot do

Each session is a copy: the firmware variables are copied, the image is read-only, and the Zuse stick's writes are discarded (snapshot=on). The guest has no network device. QEMU runs under its seccomp sandbox (no spawning, no privilege changes), as an unprivileged user, inside a systemd unit that fences memory, CPU and the file system. A session lasts at most DEMO_SESSION_LIMIT seconds (1800).

Setting it up

From a checkout of the most recent green commit -- the latest that passed acceptance, master (or, once it is published, the nightly's StarshipOS.iso):

make ARCH=amd64 init INIT_DOCS=0
demo/mint-zuse.sh   /tmp/demo-zuse                     # once; keep the stick
demo/build-iso.sh   /tmp/StarshipOS.iso
DEMO_PROMPT='[zuse@Hera]' demo/make-snapshot.sh /tmp/StarshipOS.iso /var/lib/starshipos-demo /tmp/demo-zuse/zusestick.img

Then install starshipos-demo.service and apache-demo.conf (their headers say how), and paste xwiki-try-it.xwiki into a page on the XWiki. The {{html}} macro there needs a page author with script rights.

A new image means re-running build-iso.sh and make-snapshot.sh: the saved machine belongs to one image and one QEMU version. Sessions already running keep theirs.

Tested (2026-11-06, Ubuntu 24.04, QEMU 8.2.2, ttyd 1.7.4)

  • The Zuse minted: "genesis minted", then "identity confirmed" (logs/20261106-192626, -192739).
  • The saved machine: POST 538/538, "identity confirmed", [zuse@Hera] ok> after an 87 s boot.
  • A session, in a terminal and through ttyd's websocket: ready 0.2 s after it starts; 3 4 + . answers 7 ok, : SQUARE DUP * ; 7 SQUARE . answers 49 ok; keys typed before "Ready" are discarded, not half-delivered.
  • QEMU is gone 0.1 s or less after a hang-up or a closed terminal, and on time at the session limit.
  • Not tested here: Apache (none in the test container), several sessions at once (#116).