Captain Bob, 2026-11-07: 'Limit guests and have a Busy, try back in a few minutes.' start-session.sh takes one of DEMO_MAX_GUESTS slots (default 2), a lock it holds for the session's life (flock -n: two visitors cannot both take the last one; QEMU and the bridge are started without its descriptor); with every slot taken, the visitor's terminal says every machine is busy and to try back in a few minutes, and the session ends without a machine. The service: DEMO_MAX_GUESTS=2, RuntimeDirectory for the locks, ttyd's --max-clients 6 so a visitor over the limit reaches the message. The guest: 384 MiB (v4 boots from 256 MiB, refuses at 128; measured, #116). Tested here: every slot held -> the busy message; slot 1 held -> slot 2 taken. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01GE3SDvQn5EoxdGufk84zz2
39 lines
1.6 KiB
Desktop File
39 lines
1.6 KiB
Desktop File
# starshipos-demo.service -- the public demo's web terminal (issue #114): ttyd on localhost, one
|
|
# throwaway StarshipOS machine per browser connection (start-session.sh). Apache in front
|
|
# (apache-demo.conf) does TLS and the websocket.
|
|
#
|
|
# Install: the repository's demo/ at /opt/starshipos-demo/demo, the saved machine (make-snapshot.sh)
|
|
# in /var/lib/starshipos-demo, a user starshipos-demo; then systemctl enable --now starshipos-demo.
|
|
[Unit]
|
|
Description=StarshipOS public demo terminal (ttyd)
|
|
After=network.target
|
|
|
|
[Service]
|
|
User=starshipos-demo
|
|
Group=starshipos-demo
|
|
Environment=DEMO_STATE=/var/lib/starshipos-demo
|
|
Environment=DEMO_SESSION_LIMIT=1800
|
|
Environment=DEMO_MAX_GUESTS=2
|
|
# the guests' slot locks (start-session.sh): /run/starshipos-demo, made for this user, gone at stop
|
|
RuntimeDirectory=starshipos-demo
|
|
# --max-clients: the guests and a few more, so a visitor over the limit reaches the busy message
|
|
# instead of a refused connection; still a cap on open connections
|
|
# each guest a QEMU of 384 MiB and most of a core (demo/qemu-args.sh; #116)
|
|
ExecStart=/usr/bin/ttyd --port 7681 --interface lo --writable --max-clients 6 \
|
|
--client-option titleFixed=StarshipOS --client-option disableLeaveAlert=true \
|
|
/opt/starshipos-demo/demo/start-session.sh
|
|
Restart=on-failure
|
|
# Each session is already a sandboxed QEMU with no network; this fences ttyd and its children too.
|
|
NoNewPrivileges=yes
|
|
ProtectSystem=strict
|
|
ProtectHome=yes
|
|
PrivateTmp=yes
|
|
PrivateDevices=yes
|
|
ReadOnlyPaths=/var/lib/starshipos-demo
|
|
MemoryMax=4G
|
|
CPUQuota=300%
|
|
TasksMax=200
|
|
|
|
[Install]
|
|
WantedBy=multi-user.target
|