Skip to content

Add postgres to the dashboard compose stack so the API always has a database - #84

Merged
userAugustos merged 1 commit into
mainfrom
compose-postgres-service
Sep 10, 2026
Merged

Add postgres to the dashboard compose stack so the API always has a database#84
userAugustos merged 1 commit into
mainfrom
compose-postgres-service

Conversation

@userAugustos

@userAugustos userAugustos commented Sep 10, 2026

Copy link
Copy Markdown

Problem

canyonos serve brings 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 container localhost is the container itself, so it never finds a database and the stack fails to come up.

Change

cli/canyonos/dashboard.compose.yml now owns the database:

  • Adds a postgres service (postgres:17-alpine, database/user/password canyonos) with a pg_isready healthcheck, mirroring the smoke compose in canyon-os.
  • Sets DATABASE_URL=postgres://canyonos:canyonos@postgres:5432/canyonos on the api service so the built-in default is never used.
  • Makes api wait for postgres to be healthy before starting.
  • Stores the data in a named volume (canyonos-dashboard_postgres-data). The CLI only ever runs compose down without -v (on a failed first serve), so dashboard data survives a teardown and the next serve.

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 config renders the manifest with the new service, volume, and dependency.
  • tests/test_dashboard_stack.py passes (13 tests).
  • Booted locally with the CLI installed from this branch: canyonos serve from a project directory brings up postgres, api, and web, all healthy. The API log shows migrations ran (12 tables created in public) and /healthz and /api/healthz return 200.
  • Persistence: inserted a marker row, ran compose down, ran canyonos serve again, and the row was still there.

https://claude.ai/code/session_012gos1qbDnSzz7Qjia9yq5P

@coderabbitai

coderabbitai Bot commented Sep 10, 2026

Copy link
Copy Markdown

Review Change StackReview Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Advanced

Run ID: f7766add-2a1e-4dba-a20c-3ac77383f78f

📥 Commits

Reviewing files that changed from the base of the PR and between 1231707 and e664c0f.

📒 Files selected for processing (1)
  • cli/canyonos/dashboard.compose.yml

Included review availability: Your plan provides up to 1 included review per hour; 0 remain after this review.


📝 Walkthrough

Walkthrough

The 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 DATABASE_URL.

Changes

Postgres Compose integration

Layer / File(s) Summary
Postgres service and API wiring
cli/canyonos/dashboard.compose.yml
Adds PostgreSQL configuration, persistent storage, a pg_isready healthcheck, API startup ordering, and the API DATABASE_URL.

Estimated code review effort: 2 (Simple) | ~10 minutes

Merge Risk: ⚪ Minimal · up to e664c

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: saaketh0

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 0…
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the main change: adding PostgreSQL to the dashboard Compose stack and connecting the API to the database.
✨ Finishing Touches 💡 1
🛠️ Fix failing CI checks 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch compose-postgres-service

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai
coderabbitai Bot requested a review from Saaketh0 September 10, 2026 01:22
@userAugustos
userAugustos merged commit 4711c8e into main Sep 10, 2026
4 of 5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant