Monorepo for Aesthetic.Computer
aesthetic.computer
1# DP1 Feed Deployment Checklist
2
3## ✅ Pre-Deployment (Completed)
4
5- [x] Installed ripgrep (rg) in Docker container
6- [x] Updated Dockerfile to include ripgrep
7- [x] Cloned dp1-feed repository
8- [x] Installed wrangler CLI (v4.42.0)
9- [x] Installed dp1-feed dependencies
10- [x] Found Cloudflare API credentials
11- [x] Updated wrangler.toml for aesthetic.computer
12- [x] Created setup scripts (Fish shell)
13- [x] Created deployment scripts
14- [x] Added npm scripts to main package.json
15- [x] Created comprehensive documentation
16
17## 📋 Deployment Steps (To Do)
18
19### Step 1: Authenticate with Cloudflare
20- [ ] Run: `cd /workspaces/aesthetic-computer/feed/dp1-feed`
21- [ ] Run: `wrangler login` (opens browser)
22- [ ] Complete OAuth flow
23- [ ] Verify: Should see "Successfully logged in"
24
25**Alternative (API Token):**
26```fish
27set -x CLOUDFLARE_API_TOKEN "YOUR_CLOUDFLARE_API_KEY_HERE"
28set -x CLOUDFLARE_EMAIL "me@jas.life"
29wrangler whoami
30```
31
32### Step 2: Create Cloudflare Resources
33- [ ] Run: `npm run feed:setup` (from root)
34- [ ] OR: `cd dp1-feed && ./setup-resources.fish`
35- [ ] Choose: Option 2 (Production)
36- [ ] **IMPORTANT**: Copy the namespace IDs from output
37- [ ] Example output to look for:
38 ```
39 Created namespace with title "aesthetic-feed-DP1_PLAYLISTS"
40 ID: xxxxxxxxxxxxxxxxxxxxxxxxxxxx
41 ```
42
43### Step 3: Update Configuration
44- [ ] Open: `dp1-feed/wrangler.toml`
45- [ ] Find section: `[[env.production.kv_namespaces]]`
46- [ ] Replace placeholder IDs with real IDs from Step 2
47- [ ] Update all 3 namespaces:
48 - [ ] DP1_PLAYLISTS
49 - [ ] DP1_CHANNELS
50 - [ ] DP1_PLAYLIST_ITEMS
51- [ ] Save file
52
53### Step 4: Generate and Set Secrets
54- [ ] Run: `cd /workspaces/aesthetic-computer/feed/dp1-feed`
55- [ ] Generate API secret:
56 ```fish
57 set api_secret (openssl rand -hex 32)
58 echo "Save this API Secret: $api_secret"
59 echo $api_secret | wrangler secret put API_SECRET --env production
60 ```
61- [ ] **SAVE THE API SECRET** - write it down!
62- [ ] Generate Ed25519 keys:
63 ```fish
64 npm run jwt:generate-keys
65 ```
66- [ ] Set Ed25519 private key:
67 ```fish
68 cat private-key.txt | wrangler secret put ED25519_PRIVATE_KEY --env production
69 ```
70- [ ] (Optional) Set JWT config if using JWT auth:
71 ```fish
72 echo "your-issuer" | wrangler secret put JWT_ISSUER --env production
73 echo "your-audience" | wrangler secret put JWT_AUDIENCE --env production
74 ```
75
76### Step 5: Test Locally (Optional but Recommended)
77- [ ] Run: `npm run feed:dev`
78- [ ] Open: http://localhost:8787/api/v1
79- [ ] Test health: `curl http://localhost:8787/api/v1/health`
80- [ ] Press Ctrl+C to stop
81- [ ] Verify no errors in console
82
83### Step 6: Deploy to Production
84- [ ] Run: `npm run feed:deploy` (from root)
85- [ ] OR: `cd dp1-feed && ./deploy-feed.fish production`
86- [ ] Confirm deployment when prompted
87- [ ] Wait for deployment to complete
88- [ ] Look for: "Published aesthetic-feed"
89- [ ] Note the worker URL (e.g., aesthetic-feed.xxx.workers.dev)
90
91### Step 7: Configure Custom Domain
92- [ ] Open: https://dash.cloudflare.com/
93- [ ] Navigate to: Workers & Pages
94- [ ] Click: aesthetic-feed
95- [ ] Go to: Settings → Domains & Routes
96- [ ] Click: "Add Custom Domain"
97- [ ] Enter: `feed.aesthetic.computer`
98- [ ] Click: "Add Domain"
99- [ ] Wait: ~2-5 minutes for DNS propagation
100
101### Step 8: Verify Deployment
102- [ ] Test health endpoint:
103 ```fish
104 curl https://feed.aesthetic.computer/api/v1/health
105 ```
106- [ ] Expected response:
107 ```json
108 {
109 "status": "healthy",
110 "timestamp": "2024-10-06T...",
111 "version": "1.0.0"
112 }
113 ```
114- [ ] Test API info:
115 ```fish
116 curl https://feed.aesthetic.computer/api/v1
117 ```
118- [ ] Test creating a playlist (use your API_SECRET):
119 ```fish
120 curl -X POST https://feed.aesthetic.computer/api/v1/playlists \
121 -H "Authorization: Bearer YOUR_API_SECRET" \
122 -H "Content-Type: application/json" \
123 -d '{
124 "dpVersion": "1.0.0",
125 "title": "test-playlist",
126 "items": [{
127 "source": "https://aesthetic.computer/prompt",
128 "duration": 300,
129 "license": "open"
130 }]
131 }'
132 ```
133
134### Step 9: Monitor & Verify
135- [ ] Watch logs: `npm run feed:logs`
136- [ ] Check dashboard: https://dash.cloudflare.com/
137- [ ] Verify metrics are showing requests
138- [ ] Check for any errors in logs
139- [ ] Test a few API endpoints
140
141### Step 10: Documentation & Integration
142- [ ] Save API_SECRET in secure location
143- [ ] Document the subdomain in your DNS records
144- [ ] Update any internal documentation
145- [ ] Share API endpoint with team if needed
146- [ ] Test integration with aesthetic.computer pieces
147
148## 🔍 Verification Commands
149
150Run these after deployment to verify everything:
151
152```fish
153# Check DNS resolution
154dig feed.aesthetic.computer
155
156# Test API health
157curl https://feed.aesthetic.computer/api/v1/health
158
159# List playlists (should return empty array initially)
160curl https://feed.aesthetic.computer/api/v1/playlists
161
162# Check worker logs
163cd /workspaces/aesthetic-computer/feed/dp1-feed
164wrangler tail --env production
165
166# List secrets (verify they're set)
167wrangler secret list --env production
168
169# Check deployments
170wrangler deployments list --env production
171```
172
173## 📊 Success Criteria
174
175- [ ] ✅ API responds at https://feed.aesthetic.computer
176- [ ] ✅ Health check returns 200 OK
177- [ ] ✅ Can list playlists (GET)
178- [ ] ✅ Can create playlist with API_SECRET (POST)
179- [ ] ✅ DNS resolves correctly
180- [ ] ✅ SSL certificate is active (https works)
181- [ ] ✅ Logs show successful requests
182- [ ] ✅ No errors in Cloudflare dashboard
183
184## 🚨 Common Issues & Solutions
185
186### Issue: "Worker not found"
187**Solution:** Wait 1-2 minutes after deployment, DNS needs to propagate
188
189### Issue: "Unauthorized" when creating playlist
190**Solution:** Verify API_SECRET is set correctly:
191```fish
192wrangler secret list --env production
193```
194
195### Issue: "KV namespace not found"
196**Solution:** Check namespace IDs in wrangler.toml match created namespaces
197
198### Issue: Custom domain not working
199**Solution:**
2001. Check domain is added in Cloudflare dashboard
2012. Verify DNS record was created automatically
2023. Wait up to 5 minutes for propagation
203
204### Issue: "Module not found" error
205**Solution:**
2061. Ensure dependencies are installed: `npm install`
2072. Try: `npm run worker:build` to verify TypeScript compiles
208
209## 📝 Important Notes
210
2111. **API Secret**: Save it securely - you can't retrieve it later
2122. **Ed25519 Keys**: Keep private key secure, back up both keys
2133. **KV Namespace IDs**: Must match in wrangler.toml
2144. **DNS Propagation**: Can take 2-5 minutes
2155. **CORS**: Configured to allow requests from aesthetic.computer
2166. **Rate Limits**: Default Cloudflare Worker limits apply
217
218## 🎯 Quick Reference
219
220### Key Files
221- `dp1-feed/wrangler.toml` - Configuration
222- `dp1-feed/worker.ts` - Entry point
223- `dp1-feed/app.ts` - Main logic
224
225### Key Commands
226```fish
227npm run feed:setup # One-time setup
228npm run feed:deploy # Deploy to production
229npm run feed:dev # Local development
230npm run feed:logs # Watch logs
231npm run feed:test # Run tests
232```
233
234### Key URLs
235- API: https://feed.aesthetic.computer/api/v1
236- Dashboard: https://dash.cloudflare.com/
237- DNS: https://dash.cloudflare.com/.../dns/records
238
239## ⏱️ Estimated Time
240
241- **Total Setup Time**: 10-15 minutes
242- **Step 1 (Auth)**: 1-2 minutes
243- **Step 2 (Resources)**: 2-3 minutes
244- **Step 3 (Config)**: 1 minute
245- **Step 4 (Secrets)**: 2-3 minutes
246- **Step 5 (Test)**: 2 minutes (optional)
247- **Step 6 (Deploy)**: 1-2 minutes
248- **Step 7 (Domain)**: 1-2 minutes
249- **Step 8 (Verify)**: 2-3 minutes
250
251---
252
253**Ready to deploy?** Start with Step 1! 🚀
254
255**Need help?** See `DP1-FEED-SETUP.md` for detailed instructions.