feat(deploy): one-step install/update from the Proxmox host (#6)

bootstrap.sh runs on the Proxmox host via
  bash -c "$(curl -fsSL .../deploy/proxmox/bootstrap.sh)"
It unpacks the repository into a temporary directory, runs
create-ct.sh and removes everything again; create-ct.sh also removes
the installer files it pushed into the CT. Nothing stays on the host.

install.sh now installs or updates: an existing checkout is pulled
(fast-forward, SHELLBOOK_REF pins are kept), the service is restarted
and health-checked, and the summary prints the address, the one-time
setup token while setup is pending, the Claude login state and the
SSH public key.

It also installs a root-owned `shellbook-update` that downloads the
installer from the repository and reruns it. Root never executes
scripts from /opt/shellbook, which the service user and its terminal
panel can modify, so deploy/update.sh is removed.

Verified in a Debian 13 container: fresh install, then an update that
pulls a new commit while a tampered checkout script is not executed;
bootstrap.test.sh checks that host and CT keep no installer files.
This commit is contained in:
Florian Schmidt
2026-11-16 10:57:42 +01:00
parent 5e60973ebf
commit 399628bf16
8 changed files with 152 additions and 41 deletions
+26 -11
View File
@@ -4,8 +4,15 @@ 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.
1. Copy `deploy/` to the Proxmox VE 9 host. As root run
`bash deploy/proxmox/create-ct.sh`. Defaults: unprivileged Debian 13 CT 501,
1. On the Proxmox VE 9 host, as root, run (installs or updates; nothing stays on the host):
```bash
bash -c "$(curl -fsSL https://git.finalfactory.de/FinalFactory/ShellBook/raw/branch/main/deploy/proxmox/bootstrap.sh)"
```
It unpacks the repository into a temporary directory, runs
`deploy/proxmox/create-ct.sh` from it, and removes it again; the installer files
pushed into the CT are removed too. 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`.
@@ -15,12 +22,13 @@ LAN/Tailscale addresses. No password is set initially: API access fails closed.
`SHELLBOOK_PORT`, `SHELLBOOK_TRUSTED_PROXIES` (comma-separated proxy IPs),
and `TS_AUTHKEY` in the host environment. Auth keys are transferred in a
mode-0600 temporary file and removed, never stored in the service env.
3. Open ShellBook in your browser. In the CT run `cat /var/lib/shellbook/setup-token`
and enter the token with a new password (at least 12 characters) in the setup screen.
This token is private, survives restart, and is deleted after setup. It is never logged.
3. Open the address the installer prints and enter the one-time setup token it prints
(also `cat /var/lib/shellbook/setup-token` in the CT) with a new password (at least
12 characters). The token survives restart, is deleted after setup, and the server
never logs it; only the installer shows it to the admin running it.
Alternative password CLI: `SHELLBOOK_DATA_DIR=/var/lib/shellbook pnpm --filter @shellbook/server set-password`
from the checkout (hidden prompt or one password line on stdin; never arguments).
4. Run `claude` as shellbook and use `/login`. Authorize
4. Unless a Claude login already exists: Settings > "Open terminal to log in", then `/login`. Authorize
`/home/shellbook/.ssh/id_ed25519.pub` on managed hosts. The service user has
no sudo access. Initialize notebooks manually if templates were absent.
5. Install the Traefik example in its file-provider directory and replace the
@@ -30,10 +38,16 @@ LAN/Tailscale addresses. No password is set initially: API access fails closed.
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`.
Updates: `shellbook-update` as root in the CT (from the Proxmox host:
`pct exec 501 -- shellbook-update`), or rerun the bootstrap command. It downloads
the installer from the repository (`/etc/shellbook/installer-url`, override with
`SHELLBOOK_INSTALLER_URL`) and reruns it: pull (fast-forward; a `SHELLBOOK_REF`
pin is kept), install, build, restart, health check. Env, password, workspace,
SSH key, Claude login and session secret are preserved. Root never executes
scripts from `/opt/shellbook`, which the service user (and the terminal panel)
can modify. A failed build 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
@@ -66,7 +80,8 @@ Node 22 security releases; unattended upgrades cover Debian packages only.
Build tools support node-pty compilation. Claude uses its native installer.
Local deployment regressions: `bash deploy/test/template-picker.test.sh` and
`bash deploy/test/ct-config.test.sh`, `bash deploy/test/install-script.test.sh`. Existing CTs with a manual TUN mount entry
`bash deploy/test/ct-config.test.sh`, `bash deploy/test/install-script.test.sh`,
`bash deploy/test/bootstrap.test.sh` (needs root; run it in a Debian container). Existing CTs with a manual TUN mount entry
(earlier Tailscale setups) keep it; no `dev0` is added on top.
The scripts require bash, use LF endings, and avoid early-consuming pipelines
under pipefail. Proxmox, systemd, Tailscale and SSH require deployment validation.