Monorepo for Aesthetic.Computer
aesthetic.computer
1# Session Server Deployment Guide
2
3## Production Server
4- **Host**: session-server.aesthetic.computer (157.245.134.225)
5- **User**: root
6- **Path**: `/home/aesthetic-computer/session-server`
7- **Node**: Managed via `fnm` (Fast Node Manager)
8- **Process**: `pm2` (name: `session`)
9
10## Deploy from DevContainer
11
12The SSH key for the session server is available in the dev container at `~/.ssh/session_server`:
13
14```bash
15# One-liner deployment
16ssh -i ~/.ssh/session_server root@157.245.134.225 'export PATH="/root/.local/share/fnm:$PATH" && eval "$(fnm env)" && cd /home/aesthetic-computer && git pull origin main && cd session-server && npm install && pm2 restart session && pm2 logs session --lines 20 --nostream'
17```
18
19Or use the fish function (recommended):
20```fish
21ac-deploy-session
22```
23
24## What This Does
25
261. ✅ SSH into production server
272. ✅ Load fnm environment (for node/npm/pm2)
283. ✅ Pull latest code from GitHub main branch
294. ✅ Install any new npm dependencies
305. ✅ Restart session server process with pm2
316. ✅ Show last 20 log lines to verify deployment
32
33## Verify Deployment
34
35After deploying, test the endpoints:
36
37```bash
38# Test socklogs WebSocket endpoint
39websocat "wss://session-server.aesthetic.computer/socklogs?role=viewer"
40
41# Test build-stream endpoint
42curl -X POST https://session-server.aesthetic.computer/build-stream \
43 --header "Content-Type: application/json" \
44 --data '{"line": "🔨 Test deployment"}'
45
46# Expected response:
47# {"status":"ok"}
48```
49
50## Monitor Production
51
52```bash
53# Set up fnm first for any pm2 commands
54FNM='export PATH="/root/.local/share/fnm:$PATH" && eval "$(fnm env)"'
55
56# View live logs
57ssh -i ~/.ssh/session_server root@157.245.134.225 "$FNM && pm2 logs session"
58
59# Check process status
60ssh -i ~/.ssh/session_server root@157.245.134.225 "$FNM && pm2 status"
61
62# Restart if needed
63ssh -i ~/.ssh/session_server root@157.245.134.225 "$FNM && pm2 restart session"
64```
65
66## Local Testing (Already Verified ✅)
67
68The endpoints work locally at `https://localhost:8889`:
69
70- `/build-stream` - Accepts log lines and broadcasts to WebSocket clients
71- `/build-status` - Accepts status updates and broadcasts to WebSocket clients
72- Both endpoints are dev-mode only for security
73
74## Changes Deployed
75
76- Added `/build-stream` POST endpoint (session.mjs line ~220)
77- Added `/build-status` POST endpoint (session.mjs line ~225)
78- Both broadcast to all connected WebSocket clients via `everyone()`
79- Message types: `build:log` and `build:status`
80- Dev-mode only (protected by `if (dev)` block)
81
82## Next Steps After Deployment
83
841. Run a build with `./remote-update-and-build.fish`
852. Open https://builds.false.work in browser
863. Watch live build progress stream appear in real-time
874. Build logs will show with terminal-style formatting