diff --git a/CLAUDE.md b/CLAUDE.md index 24b2aa8..2cb5370 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -506,16 +506,18 @@ cd ~/Projects/homelab && happy claude ### Files & Configuration | File | Purpose | |------|---------| -| `~/Library/LaunchAgents/com.hutson.happy-daemon.plist` | launchd auto-start Happy daemon | +| `/Library/LaunchDaemons/com.hutson.happy-daemon.plist` | System LaunchDaemon (starts at boot, KeepAlive enabled) | | `~/.happy/` | Happy Coder config and logs | +**Server:** `https://happy.htsn.io` (self-hosted Happy server) + ### Troubleshooting ```bash # Check if daemon is running -pgrep -f "happy.*daemon" +happy daemon status -# Check launchd status -launchctl list | grep happy +# Check launchd status (system level) +launchctl print system/com.hutson.happy-daemon | head -10 # List active sessions happy daemon list @@ -527,6 +529,81 @@ happy daemon stop && happy daemon start /Applications/Tailscale.app/Contents/MacOS/Tailscale up ``` +## Happy Server (Self-Hosted Relay) + +Self-hosted Happy Coder relay server for lower latency and no external dependencies. + +### Architecture +``` +Phone App → https://happy.htsn.io → Traefik → docker-host:3002 → Happy Server + ↓ + PostgreSQL + Redis + MinIO (local) +``` + +### Service Details + +| Component | Location | Port | Notes | +|-----------|----------|------|-------| +| Happy Server | docker-host (10.10.10.206) | 3002 | Main relay service | +| PostgreSQL | docker-host | 5432 (internal) | User/session data | +| Redis | docker-host | 6379 (internal) | Real-time events | +| MinIO | docker-host | 9000 (internal) | File/image storage | +| Traefik | CT 202 | 443 | SSL termination | + +### Configuration + +**Docker Compose**: `/opt/happy-server/docker-compose.yml` +**Traefik Config**: `/etc/traefik/conf.d/happy.yaml` (on CT 202) +**DNS**: happy.htsn.io → 70.237.94.174 (Cloudflare proxied) + +**Credentials**: +- Master Secret: `3ccbfd03a028d3c278da7d2cf36d99b94cd4b1fecabc49ab006e8e89bc7707ac` +- MinIO: `happyadmin` / `happyadmin123` +- PostgreSQL: `happy` / `happypass` + +### Quick Commands +```bash +# Check status +ssh docker-host 'docker ps --filter "name=happy"' + +# View logs +ssh docker-host 'docker logs -f happy-server' + +# Restart stack +ssh docker-host 'cd /opt/happy-server && sudo docker-compose restart' + +# Health check +curl https://happy.htsn.io/health + +# Run migrations (if needed) +ssh docker-host 'docker exec happy-server npx prisma migrate deploy' +``` + +### Connecting Devices + +**Phone (Happy App)**: +1. Settings → Relay Server URL +2. Enter: `https://happy.htsn.io` +3. Save and reconnect + +**CLI (Mac/Linux)**: +```bash +export HAPPY_SERVER_URL="https://happy.htsn.io" +happy auth # Re-authenticate with new server +``` + +### Maintenance + +**Backup data**: +```bash +ssh docker-host 'docker exec happy-postgres pg_dump -U happy happy > /tmp/happy-backup.sql' +``` + +**Update Happy Server**: +```bash +ssh docker-host 'cd /opt/happy-server && git pull && sudo docker-compose build && sudo docker-compose up -d' +``` + ## Agent and Tool Guidelines ### Background Agents @@ -594,6 +671,7 @@ There are **TWO separate Traefik instances** handling different services: - copyparty → 10.10.10.201 - aitrade → trading server - pulse.htsn.io → 10.10.10.206:7655 (Pulse monitoring) +- happy.htsn.io → 10.10.10.206:3002 (Happy Coder relay server) **Access Traefik config:** ```bash @@ -1000,6 +1078,26 @@ Future improvements and maintenance tasks: ## Changelog +### 2025-12-21 + +**Happy Server Self-Hosted Relay** +- Deployed self-hosted Happy Coder relay server on docker-host (10.10.10.206) +- Stack includes: Happy Server, PostgreSQL, Redis, MinIO (all containerized) +- Configured Traefik reverse proxy at https://happy.htsn.io +- Added Cloudflare DNS record (proxied) +- Fixed Dockerfile to include Prisma migrations on startup + +**Docker-host CPU Upgrade** +- Changed VM 206 CPU from emulated to `host` passthrough +- Fixes x86-64-v2 compatibility issues with modern binaries (Sharp, MinIO) +- Requires: `ssh pve 'qm set 206 -cpu host'` + VM reboot + +**PVE Tailscale Routing Fix** +- Fixed issue where PVE was unreachable via local network (10.10.10.120) +- Root cause: Tailscale routing table 52 was capturing local subnet traffic +- Fix: Added routing rule `ip rule add from 10.10.10.120 table main priority 5200` +- Made permanent in `/etc/network/interfaces` under vmbr0 + ### 2024-12-20 **Git Repository Setup**