README.md

Deploying pi-collab (the terminal) to the mini-PC #

atproto-server@192.168.86.250, the same box that runs the aligned.click services. The terminal stack gets its own systemd units and its own Cloudflare tunnel (coding) so it never interferes with the aligned services already running there.

Six services, started by systemd at boot, none of them listening on a port anybody outside can reach. The only way in is the coding Cloudflare tunnel, an outbound connection, and it terminates at the gate / chat bridge:

pi-tunnel    cloudflared        — coding.prosocial.social
pi-sandbox   docker            — the pi-proxy + pi-sandbox containers
pi-oauth     the OAuth sidecar — holds every credential
pi-gate      the auth gate     — the only way in (login + chat tokens)
pi-server    the chat bridge   — web client + websocket, reaches the agent
pi-watch     the turn recorder — git-commits each turn

One-time: create the tunnel + subdomain #

Run from the laptop (where ~/.cloudflared/cert.pem lives — the account certificate). The prosocial.social zone must be in the same Cloudflare account.

cloudflared tunnel create coding
cloudflared tunnel route dns coding coding.prosocial.social

Then copy the new credentials file it created to the mini-PC:

scp ~/.cloudflared/<tunnel-uuid>.json atproto-server@192.168.86.250:~/.cloudflared/

cert.pem should already be on the mini-PC (the aligned deploy put it there).

Getting the code there #

rsync -av --delete --filter=':- .gitignore' --exclude .git --exclude data --exclude node_modules \
  --exclude private --exclude sandbox/.club_ed25519 --exclude sandbox/.club_ed25519.pub \
  --exclude .club-state.json ./ atproto-server@192.168.86.250:~/terminal/

data/ and node_modules/ are installed/created on the box, not copied. The conversation record (data/pi/, committed to git) is a fresh start on the mini-PC — its own watch.mjs takes over recording from there.

The box starts with no git history (the repo is the record, so we begin it clean rather than copying the laptop's). First time only, on the box:

cd ~/terminal
git init -b master
git config user.name  "pi-collab"
git config user.email "pi-collab@coding.prosocial.social"
git add -A && git commit -m "initial deploy"

(pi-watch.service also sets GIT_AUTHOR/COMMITTER_* env vars, so the local config above is belt-and-braces.)

All six units also git fetch origin master && git reset --hard origin/master in ExecStartPre before they start — so a restart pulls the latest code from tangled, exactly like the aligned deploy. Because data/pi/sessions/ is gitignored, the running session survives the reset (it is never tracked, so reset --hard leaves it alone). To ship new code: push to tangled, then sudo systemctl restart pi-server (or the whole stack).

Installing #

ssh atproto-server@192.168.86.250
cd ~/terminal
sudo deploy/install.sh

It installs docker if absent, npm-installs the node deps, generates the sandbox ssh key, creates .env (with PUBLIC_URL=https://coding.prosocial.social and OAUTH_PORT=4099 — aligned's oauth already owns 4098 on this box), installs the units and starts everything. Run it again after pulling new code — it is idempotent.

It will refuse to start until GREENPT_API_KEY is in .env (the model provider key — aligned's .env on this box already has one you can copy) and the coding tunnel credentials are in ~/.cloudflared.

Afterwards #

curl -s https://coding.prosocial.social/health

Open https://coding.prosocial.social and log in with your atproto handle.

Removing it #

sudo systemctl disable --now pi-tunnel pi-sandbox pi-oauth pi-gate pi-server pi-watch
sudo rm /etc/systemd/system/pi-*.service
sudo systemctl daemon-reload

Deleting <repo>/private/oauth/sessions.json is what actually logs everybody out.