Skill: cakeos-deploy (version 1.0.0)

--- name: cakeos-deploy description: Operational playbook for deploying, managing, and troubleshooting CakeOS on Kali's Vultr VPS (107.191.57.94). Activate when: (1) user asks to deploy or launch CakeOS, (2) user needs to configure API keys or environment, (3) user asks about CakeOS service status, logs, or restarts, (4) user asks to connect a YouTube channel, (5) anything involving the CakeOS Docker stack, workers, or pipeline on the Vultr server. --- # CakeOS Deploy & Ops CakeOS is a faceless baking content automation platform. Full stack on Vultr VPS at `107.191.57.94`. ## Server Access - **SSH key:** `/home/minimax/.ssh/vultr_apex` → `root@107.191.57.94` - **All commands run via:** `exec` tool with SSH prefix: ``` ssh -i /home/minimax/.ssh/vultr_apex -o StrictHostKeyChecking=no root@107.191.57.94 '<cmd>' ``` ## Project Layout on Server ``` /workspace/cakeos/ ← source (local, sync with rsync) /var/www/cakeos/ ← server deployment root ├── media/ ← all video files (raw/working/final/captions/thumbnails/music) ├── docker-compose.yml ← copied from source ├── .env ← filled env (NEVER committed to git) └── api/ workers/ db/ nginx/ ← copied from source ``` ## First-Time Deployment Procedure ### 1. Create media directories ```bash ssh root@107.191.57.94 'mkdir -p /var/www/cakeos/media/{raw,working,final,captions,thumbnails,music,audio_tmp}' ``` ### 2. Sync source to server ```bash rsync -avz -e "ssh -i /home/minimax/.ssh/vultr_apex" \ /workspace/cakeos/ root@107.191.57.94:/var/www/cakeos/ \ --exclude='.env' --exclude='node_modules' --exclude='__pycache__' \ --exclude='cakeos-dashboard/node_modules' --exclude='cakeos-dashboard/dist' ``` ### 3. Sync built dashboard ```bash rsync -avz -e "ssh -i /home/minimax/.ssh/vultr_apex" \ /workspace/cakeos/cakeos-dashboard/dist/ root@107.191.57.94:/var/www/cakeos/cakeos-dashboard/dist/ ``` ### 4. Write .env on server Write directly via SSH heredoc — never store plaintext keys in workspace files. ```bash ssh root@107.191.57.94 'cat > /var/www/cakeos/.env' << 'EOF' POSTGRES_PASSWORD=<value> DATABASE_URL=postgresql://cakeos:<value>@postgres:5432/cakeos REDIS_PASSWORD=<value> REDIS_URL=redis://:<value>@redis:6379 GROQ_API_KEY=<value> GEMINI_API_KEY=<value> PIXABAY_API_KEY=<value> YOUTUBE_CLIENT_ID=<value> YOUTUBE_CLIENT_SECRET=<value> YOUTUBE_REDIRECT_URI=http://107.191.57.94:3001/api/youtube/callback MEDIA_DIR=/var/www/cakeos/media JWT_SECRET=<value> NODE_ENV=production API_PORT=3001 EOF ``` ### 5. Build and launch stack ```bash ssh root@107.191.57.94 'cd /var/www/cakeos && docker compose up -d --build' ``` ### 6. Verify all services healthy ```bash ssh root@107.191.57.94 'cd /var/www/cakeos && docker compose ps' ``` Expected: postgres ✅ redis ✅ api ✅ worker ✅ nginx ✅ ## YouTube OAuth (One-Time) 1. User visits: `http://107.191.57.94:3001/api/youtube/auth` in their browser 2. Completes Google OAuth → redirects back 3. Credentials stored in PostgreSQL automatically 4. Verify: `docker compose exec postgres psql -U cakeos -c "SELECT id, channel_id FROM youtube_credentials LIMIT 1;"` Note: The redirect URI in Google Cloud Console **must** match `YOUTUBE_REDIRECT_URI` in `.env`. After production domain is set, update both. ## Common Operations ### View logs ```bash # All services ssh root@107.191.57.94 'cd /var/www/cakeos && docker compose logs -f --tail=50' # Specific service ssh root@107.191.57.94 'cd /var/www/cakeos && docker compose logs -f worker --tail=100' ``` ### Restart a service ```bash ssh root@107.191.57.94 'cd /var/www/cakeos && docker compose restart worker' ``` ### Rebuild after code change ```bash # 1. Re-sync changed files (rsync) # 2. Rebuild only changed service: ssh root@107.191.57.94 'cd /var/www/cakeos && docker compose up -d --build worker' ``` ### Check job status in DB ```bash ssh root@107.191.57.94 'cd /var/www/cakeos && docker compose exec postgres psql -U cakeos -c "SELECT id, status, progress, error_log FROM jobs ORDER BY updated_at DESC LIMIT 10;"' ``` ### Upload test video via API ```bash ssh root@107.191.57.94 'curl -X POST http://localhost:3001/api/upload \ -F "file=@/path/to/video.mp4" \ -F "recipeId=<uuid-from-recipes-table>"' ``` ## Troubleshooting | Symptom | Fix | |---------|-----| | Job stuck in GENERATING | Check `docker compose logs worker` for Groq/Gemini errors | | Job stuck in READY (not publishing) | YouTube quota exceeded — resets midnight Pacific. Check `docker compose logs worker` | | Worker container keeps restarting | Missing env var — check `docker compose logs worker` first line | | Gemini thumbnail fails | Auto-falls back to Pillow text thumbnail. Not fatal. | | Port 3001 not reachable | Check nginx config, check `docker compose ps api` | ## API Quotas (Free Tier) | Service | Limit | ~Videos/day | |---------|-------|-------------| | YouTube Data API | 10,000 units/day | 6 uploads | | Groq LLM | 14,400 req/day | 7,200 videos | | Gemini | 1,500 req/day | 1,500 videos | | Pixabay | 100 req/min | unlimited | Bottleneck: YouTube (~6 videos/day free). Upgrade via Google Cloud quota increase request if needed. ## Dashboard URL After deploy: `http://107.191.57.94` (nginx serves React dist on port 80) With SSL: `https://cakeos.yourdomain.com` (run certbot after domain is pointed) ## Required API Keys (get these first) See references/api-keys-guide.md for step-by-step setup of all 4 free keys.


Security scan verdicts — ClawScan: suspicious | static analysis: clean | VirusTotal: clean | SkillSpector: suspicious (MEDIUM)