Add postgres to the dashboard compose stack so the API always has a database - #84
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (1)
Included review availability: Your plan provides up to 1 included review per hour; 0 remain after this review. 📝 WalkthroughWalkthroughThe Compose configuration adds a PostgreSQL 17 service with persistent storage and health checks. The API service waits for PostgreSQL to become healthy and receives a ChangesPostgres Compose integration
Estimated code review effort: 2 (Simple) | ~10 minutes Merge Risk: ⚪ Minimal · up to The dashboard stack now starts PostgreSQL before connecting the API and preserves its data. Configuration rendering and dashboard-stack tests pass, with no current merge-blocking risk identified. Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches 💡 1🛠️ Fix failing CI checks 💡
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Problem
canyonos servebrings up the API without any database. The API image falls back to its built-in default,postgres://cc_forge:cc_forge@localhost:5432/cc_forge, and inside the containerlocalhostis the container itself, so it never finds a database and the stack fails to come up.Change
cli/canyonos/dashboard.compose.ymlnow owns the database:postgresservice (postgres:17-alpine, database/user/passwordcanyonos) with apg_isreadyhealthcheck, mirroring the smoke compose in canyon-os.DATABASE_URL=postgres://canyonos:canyonos@postgres:5432/canyonoson theapiservice so the built-in default is never used.apiwait forpostgresto be healthy before starting.canyonos-dashboard_postgres-data). The CLI only ever runscompose downwithout-v(on a failed first serve), so dashboard data survives a teardown and the nextserve.The API runs its own migrations on boot, so nothing else is needed for a fresh database.
Verification
docker compose -p canyonos-dashboard -f dashboard.compose.yml configrenders the manifest with the new service, volume, and dependency.tests/test_dashboard_stack.pypasses (13 tests).canyonos servefrom a project directory brings up postgres, api, and web, all healthy. The API log shows migrations ran (12 tables created inpublic) and/healthzand/api/healthzreturn 200.compose down, rancanyonos serveagain, and the row was still there.https://claude.ai/code/session_012gos1qbDnSzz7Qjia9yq5P