Add architecture-filtered template selection, safe CT reuse, TUN passthrough, a service-user installer, updates, and a Traefik example. Verify official Node 22 binaries with SHA-256 checksums and document deployment and credential setup. Cover mixed amd64/arm64 template selection with five bash regression checks.
4.2 KiB
Deploy ShellBook (M5 / #6)
Access is root-equivalent across managed hosts. Restrict CT port 8080 to the Traefik host with the Proxmox firewall; use HTTPS and limit the router to your LAN/Tailscale addresses. No password is set initially: API access fails closed.
- Copy
deploy/to the Proxmox VE 9 host. As root runbash deploy/proxmox/create-ct.sh. Defaults: unprivileged Debian 13 CT 501, 2 cores, 2 GiB RAM, 16 GiB disk, DHCP on vmbr0, onboot, nesting and TUN. Overrides:CTID,CT_STORAGE,TEMPLATE_STORAGE,CT_BRIDGE,CT_IP(Proxmox ip syntax),CT_HOSTNAME,CT_CORES,CT_MEMORY,CT_DISK_GB. Existing CTs must be unprivileged Debian 13 of the host architecture; they may reboot when TUN passthrough is added. No raw config appending is used. - Optionally supply
SHELLBOOK_REPO,SHELLBOOK_REF,SHELLBOOK_HOST,SHELLBOOK_PORT,SHELLBOOK_TRUSTED_PROXIES(comma-separated proxy IPs), andTS_AUTHKEYin the host environment. Auth keys are transferred in a mode-0600 temporary file and removed, never stored in the service env. - In the CT run the printed password command. It also accepts one password
line on stdin; do not pass passwords as arguments. Source-checkout command:
SHELLBOOK_DATA_DIR=/var/lib/shellbook pnpm --filter @shellbook/server set-password. - Run
claudeas shellbook and use/login. Authorize/home/shellbook/.ssh/id_ed25519.pubon managed hosts. The service user has no sudo access. Initialize notebooks manually if templates were absent. - Install the Traefik example in its file-provider directory and replace the
hostname, CT address, TLS resolver and allowed networks. Set the actual
Traefik peer IP in
/etc/shellbook/envasSHELLBOOK_TRUSTED_PROXIES, thensystemctl restart shellbook. Only configured proxies can influence HTTPS detection (and thus Secure cookies). TLS terminates at Traefik.
Standalone CT installation: run bash deploy/install.sh as root on Debian 13.
The installer can be rerun; it preserves env, password, workspace, SSH key and
session signing secret. It builds the checkout but does not pull on rerun.
Updates: bash /opt/shellbook/deploy/update.sh (root). Failure before restart
leaves the running service in place. Check journalctl -u shellbook.
Configuration is /etc/shellbook/env; data is /var/lib/shellbook (back it up
along with workspace and service-user home). SHELLBOOK_SESSION_SECONDS defaults
to 2592000 (30 days). Cookies survive restart. Logout clears the browser cookie;
password changes do not revoke existing cookies. For emergency revocation stop
the service, delete session-secret from the data directory and start it again.
Forward auth is off by default. To enable it set
SHELLBOOK_FORWARD_AUTH_HEADER=Remote-User and trusted proxy IPs. The header is
accepted only from an exact direct peer IP on that list (IPv4-mapped IPv6 is
normalized). Traefik must strip incoming identity headers and set its own after
authentication; block direct CT access. Built-in password login remains available.
WebSocket clients must send the same session cookie; cross-origin API requests
are rejected. Custom browser clients must use the public Host header.
Build choices: esbuild is a well-known TypeScript bundler; it bundles the source
@shellbook/core via an explicit alias, while npm dependencies (including native
node-pty) stay external. Production therefore retains installed node_modules.
@fastify/static supplies Fastify-compatible static serving and safe file paths;
the static directory is served only when index.html exists, with SPA fallback
outside /api. Node 22 comes from nodejs.org's latest-v22.x binary release,
verified with its SHA-256 manifest downloaded over HTTPS. This avoids third-party
apt signing-key compatibility issues on Debian 13. Rerun the installer to update
Node 22 security releases; unattended upgrades cover Debian packages only.
Build tools support node-pty compilation. Claude uses its native installer.
Local deployment regression: bash deploy/test/template-picker.test.sh.
The scripts require bash, use LF endings, and avoid early-consuming pipelines
under pipefail. Proxmox, systemd, Tailscale and SSH require deployment validation.