Skip to content

Commit 434c981

Browse files
pxs4528claude
andcommitted
docs: add migration status and recovery guide
Comprehensive guide for resuming work after Pi restart: - Complete migration history - Current issues (Vite segfault on ARM) - Next steps and recovery commands - Alternative solutions if build fails 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
1 parent b807285 commit 434c981

File tree

1 file changed

+271
-0
lines changed

1 file changed

+271
-0
lines changed

.cicd/MIGRATION_STATUS.md

Lines changed: 271 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,271 @@
1+
# Migration Status & Next Steps
2+
3+
**Date:** 2026-01-05
4+
**Status:** In Progress - Need to complete Vite build on ARM
5+
6+
---
7+
8+
## What We've Done
9+
10+
### ✅ Completed Tasks
11+
12+
1. **Migrated from Podman to Docker**
13+
- Podman v5.4.2 has critical segfaults on ARM64 (Raspberry Pi)
14+
- Installed Docker 29.1.3 successfully
15+
- Created Dockerfiles from Containerfiles
16+
- Updated compose.yaml to reference Dockerfiles
17+
- Updated deploy.sh to use `docker compose` instead of `podman-compose`
18+
19+
2. **Fixed Frontend JavaScript Errors**
20+
- Removed `import "solid-devtools";` from `frontend/src/index.tsx`
21+
- This was causing: `can't access property "live", n.links is undefined`
22+
- Removed devtools plugin from `vite.config.ts`
23+
24+
3. **Optimized Vite Build for ARM**
25+
- Set `NODE_OPTIONS="--max-old-space-size=1536"` in frontend Dockerfile
26+
- Configured esbuild minifier (faster, less memory)
27+
- Disabled manual chunks to reduce memory fragmentation
28+
- All committed to GitHub (commit: b807285)
29+
30+
4. **Documentation**
31+
- Created `.cicd/DOCKER_MIGRATION.md` (full migration guide)
32+
- Created `.cicd/cleanup-podman.sh` (cleanup script)
33+
34+
---
35+
36+
## Current Issues
37+
38+
### 🔴 CRITICAL: Vite Build Segfault
39+
40+
**Symptom:**
41+
```
42+
vite v7.3.0 building client environment for production...
43+
transforming...
44+
Segmentation fault (core dumped)
45+
```
46+
47+
**Root Cause:** Vite build is very memory-intensive on ARM64, crashes during build
48+
49+
**System Resources:**
50+
- RAM: 3.7GB total, only 1.5GB available
51+
- Swap: 1GB total, 654MB available
52+
- Vite needs ~2GB+ to build safely on ARM
53+
54+
**Attempted Fixes:**
55+
- ✅ Set NODE_OPTIONS max-old-space-size=1536
56+
- ✅ Optimized vite.config.ts
57+
- ⏳ Need to test after Pi restart (user is restarting now)
58+
59+
### ⚠️ Webhook Permission Issues
60+
61+
**Symptom:**
62+
```
63+
permission denied while trying to connect to the Docker daemon socket
64+
```
65+
66+
**Root Cause:** Webhook listener runs as user `darth`, but docker group membership hasn't taken effect (process started before group was added)
67+
68+
**Fix Required:** Restart webhook listener after Pi reboot
69+
70+
---
71+
72+
## Next Steps (After Pi Restart)
73+
74+
### Step 1: Test Optimized Vite Build
75+
76+
```bash
77+
cd ~/darth-forge
78+
79+
# Pull latest changes with memory optimizations
80+
git pull
81+
82+
# Try building with new memory settings
83+
docker compose -f compose.yaml -f compose.prod.yaml down
84+
docker compose -f compose.yaml -f compose.prod.yaml up -d --build
85+
86+
# Monitor build logs
87+
docker compose -f compose.yaml -f compose.prod.yaml logs -f frontend
88+
```
89+
90+
**If build succeeds:** ✅ Done! Check site at http://darth.local:8080
91+
92+
**If build still segfaults:** Go to Step 2
93+
94+
### Step 2: Build on GitHub Actions (Recommended)
95+
96+
If local ARM build fails, build images on GitHub Actions (x86 runners have more RAM) and push to GitHub Container Registry (ghcr.io).
97+
98+
**Changes needed:**
99+
1. Create `.github/workflows/build-images.yml` - Build & push images to ghcr.io
100+
2. Update `compose.yaml` - Pull pre-built images instead of building locally
101+
3. Update `deploy.sh` - Just pull and restart (no build step)
102+
103+
This is what production systems do - build on powerful CI servers, deploy lightweight containers.
104+
105+
### Step 3: Fix Webhook for Future Deployments
106+
107+
After Pi restart, the webhook listener will have docker group permissions:
108+
109+
```bash
110+
# Verify webhook can access docker
111+
sudo systemctl status webhook
112+
ps aux | grep webhook-listener
113+
114+
# Test manual trigger
115+
curl http://localhost:9000/health
116+
117+
# Check logs
118+
tail -f /home/darth/darth-forge/.cicd/webhook.log
119+
```
120+
121+
---
122+
123+
## Quick Recovery Commands
124+
125+
### Check Current Status
126+
```bash
127+
# Check if Docker is running
128+
docker ps
129+
130+
# Check containers
131+
docker ps -a
132+
133+
# Check system resources
134+
free -h
135+
136+
# Check webhook status
137+
sudo systemctl status webhook
138+
```
139+
140+
### Manual Deployment
141+
```bash
142+
cd ~/darth-forge
143+
git pull
144+
docker compose -f compose.yaml -f compose.prod.yaml down
145+
docker compose -f compose.yaml -f compose.prod.yaml up -d --build
146+
```
147+
148+
### View Logs
149+
```bash
150+
# Frontend logs
151+
docker logs darth-forge-frontend --tail 50 -f
152+
153+
# Backend logs
154+
docker logs darth-forge-backend --tail 50 -f
155+
156+
# Deployment logs
157+
tail -f .cicd/deploy.log
158+
159+
# Webhook logs
160+
tail -f .cicd/webhook.log
161+
```
162+
163+
### Test Endpoints
164+
```bash
165+
# Backend health check
166+
curl http://localhost:8080/api/health
167+
# Should return: {"status":"healthy"}
168+
169+
# Frontend
170+
curl -I http://localhost:8080
171+
# Should return: HTTP/1.1 200 OK
172+
173+
# Open in browser
174+
# http://darth.local:8080
175+
```
176+
177+
---
178+
179+
## Architecture Overview
180+
181+
```
182+
GitHub Push
183+
184+
GitHub Actions (deploy.yml)
185+
186+
Webhook → webhook.pipboi.dev
187+
188+
Cloudflare Tunnel (cloudflared)
189+
190+
Raspberry Pi → webhook-listener.py (port 9000)
191+
192+
deploy.sh
193+
194+
Docker Compose
195+
196+
┌─────────────────┐ ┌──────────────────┐
197+
│ Frontend │ │ Backend │
198+
│ (Caddy + React) │────▶│ (Go API) │
199+
│ Port: 8080 │ │ Port: 8080 │
200+
└─────────────────┘ └──────────────────┘
201+
```
202+
203+
**Key Files:**
204+
- `.cicd/deploy.sh` - Main deployment script
205+
- `compose.yaml` - Base Docker Compose config
206+
- `compose.prod.yaml` - Production overrides
207+
- `.cicd/webhook-listener.py` - GitHub webhook receiver
208+
- `frontend/Dockerfile` - Frontend build instructions
209+
- `backend/Dockerfile` - Backend build instructions
210+
- `frontend/Caddyfile` - Caddy reverse proxy config
211+
212+
---
213+
214+
## Known Working Commits
215+
216+
- `b807285` - Latest (Vite memory optimizations)
217+
- `1ece911` - Removed solid-devtools from production
218+
- `80a1cbf` - Docker migration complete
219+
- `56e60a2` - Last podman commit (broken)
220+
221+
---
222+
223+
## Important Notes
224+
225+
1. **Don't use podman anymore** - It crashes on ARM64
226+
2. **Frontend needs to build** - Currently segfaulting during Vite build
227+
3. **Backend is working** - Builds fine, returns `{"status":"healthy"}`
228+
4. **Caddy routing is correct** - `/api/*` → backend:8080, everything else → frontend
229+
5. **Cloudflare Tunnel is running** - PID 1690, routes traffic correctly
230+
231+
---
232+
233+
## If All Else Fails: Alternative Solutions
234+
235+
### Option 1: Pre-build Frontend Locally (Outside Docker)
236+
Build on Pi directly, then copy dist to container:
237+
```bash
238+
cd frontend
239+
npm install
240+
npm run build
241+
# Copy dist to Docker image
242+
```
243+
244+
### Option 2: Use Multi-Arch Images from CI
245+
Let GitHub Actions build for arm64/aarch64, push to registry, pull on Pi
246+
247+
### Option 3: Reduce Frontend Complexity
248+
Simplify the build or use a simpler framework that doesn't need Vite
249+
250+
### Option 4: Add More Swap
251+
Increase swap file size to 2GB+ to give Vite more virtual memory:
252+
```bash
253+
sudo swapoff -a
254+
sudo dd if=/dev/zero of=/swapfile bs=1M count=2048
255+
sudo chmod 600 /swapfile
256+
sudo mkswap /swapfile
257+
sudo swapon /swapfile
258+
```
259+
260+
---
261+
262+
## Contact Info
263+
264+
GitHub Repo: https://github.com/pxs4528/darth-forge
265+
Issues: https://github.com/pxs4528/darth-forge/issues
266+
Website: https://pipboi.dev (via Cloudflare Tunnel)
267+
268+
---
269+
270+
**Last Updated:** 2026-01-05 23:15 CST
271+
**Next Action:** Test optimized build after Pi restart

0 commit comments

Comments
 (0)