# 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