Files
LithosAnanke/demo/README.md
T
Claude 6ebe706351 demo: each session's transcript, kept 7 days in a write-only drop box (#192)
Ruled 2026-11-21, "Write-only drop box": console.py writes each session's transcript, mode 0600,
into /var/lib/starshipos-demo-transcripts (the owner's, group starshipos-demo, mode 1730: a session
adds a file but cannot list or read the directory). transcripts-tidy.sh, run as root every 5 minutes
by starshipos-demo-transcripts.timer, hands each file to the owner and deletes those over 7 days.
starshipos-demo.service gets the directory writable and DEMO_TRANSCRIPTS; DEPLOY.md step 4 has the
server steps and the check.

"Nothing you do is kept" was no longer true. Ruled 2026-11-24, "Machine not kept; log 7 days": the
session's banner, the Try it page and the old wiki page say nothing is kept on the machine and a
transcript is kept for up to 7 days, then deleted, and the page says so before the console.

demo/test_transcripts.py failed first (logs/20261121-demo-transcripts/before.txt) and passes its
10 checks (after.txt).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017RzZgrf7V7Zk2iczBXDRbm
2026-11-24 09:19:03 +00:00

4.2 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; two guests at once, a busy message for the rest (#114, #116)
transcripts-tidy.sh Hands each session's transcript to its owner, mode 0600, and deletes those over 7 days (#192)
starshipos-demo-transcripts.service, .timer Runs transcripts-tidy.sh as root every 5 minutes (#192)
test_transcripts.py Tests the transcript and the tidy, with a stand-in machine: python3 demo/test_transcripts.py
DEPLOY.md Putting it on the server, step by step
apache-demo.conf Example vhost: TLS, the websocket, framing allowed for the .com only (#115)
xwiki-try-it.xwiki The "Try it" page, its own page on the .com XWiki (TryIt), in the landing page's style

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).

What is kept: a transcript of each session -- what the visitor typed and what the machine answered -- for up to 7 days, readable by the server's owner only, then deleted (#192; DEPLOY.md, step 4). The Try it page and the session's first lines say so.

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 the page TryIt on the .com 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).