Skip to content

Docker and Database Interoperability Configuration#665

Merged
ngoiyaeric merged 1 commit into
mainfrom
docker-db-interop-5392326425213968008
Jun 19, 2026
Merged

Docker and Database Interoperability Configuration#665
ngoiyaeric merged 1 commit into
mainfrom
docker-db-interop-5392326425213968008

Conversation

@ngoiyaeric

@ngoiyaeric ngoiyaeric commented Jun 19, 2026

Copy link
Copy Markdown
Collaborator

This PR configures the Docker environment for full database interoperability.

Key changes:

  • docker-compose.yaml: Added a PostgreSQL 16 service with health checks and persistent volumes. Linked the main application to the database.
  • Dockerfile: Updated to include migration files in the standalone output and integrated a new entrypoint script.
  • docker-entrypoint.sh: Added a script to run database migrations automatically when EXECUTE_MIGRATIONS=true.
  • lib/db/index.ts: Added a guard and warning for missing DATABASE_URL during the production build phase to prevent Next.js build failures during static analysis.

PR created automatically by Jules for task 5392326425213968008 started by @ngoiyaeric

Summary by CodeRabbit

  • New Features

    • Added PostgreSQL database support with persistent storage in containerized environments
    • Enabled automatic database migrations on application startup
  • Bug Fixes

    • Improved health checks for enhanced application reliability monitoring
    • Enhanced graceful handling of missing database configuration in production environments

Co-authored-by: ngoiyaeric <115367894+ngoiyaeric@users.noreply.github.com>
@google-labs-jules

Copy link
Copy Markdown
Contributor

👋 Jules, reporting for duty! I'm here to lend a hand with this pull request.

When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down.

I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job!

For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

@vercel

vercel Bot commented Jun 19, 2026

Copy link
Copy Markdown
Contributor

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
qcx Ready Ready Preview, Comment Jun 19, 2026 7:03am

@qodo-code-review

Copy link
Copy Markdown
Contributor

Qodo reviews are paused for this user.

Troubleshooting steps vary by plan Learn more →

On a Teams plan?
Reviews resume once this user has a paid seat and their Git account is linked in Qodo.
Link Git account →

Using GitHub Enterprise Server, GitLab Self-Managed, or Bitbucket Data Center?
These require an Enterprise plan - Contact us
Contact us →

@CLAassistant

Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

@coderabbitai

coderabbitai Bot commented Jun 19, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Caution

Review failed

Pull request was closed or merged during review

Walkthrough

Adds docker-entrypoint.sh to conditionally run database migrations at container startup. Updates the Dockerfile runner stage to copy Drizzle migration assets and the entrypoint script. Introduces a Postgres service with healthchecking and persistent storage in docker-compose.yaml. Softens DATABASE_URL enforcement in lib/db/index.ts to allow builds without a live database.

Changes

Docker Migration Entrypoint and Postgres Orchestration

Layer / File(s) Summary
DATABASE_URL build-time resilience
lib/db/index.ts
Replaces the hard error on missing DATABASE_URL with a production-only warning and a fallback postgres://localhost:5432/postgres connection string, allowing Next.js builds to complete without a live database.
Migration entrypoint script and Dockerfile runner wiring
docker-entrypoint.sh, Dockerfile
Adds docker-entrypoint.sh that conditionally runs bun run db:migrate when EXECUTE_MIGRATIONS=true (non-fatal on failure) before exec-ing the main command. Updates the Dockerfile runner stage to copy /app/drizzle, migrate.ts, package.json, and the entrypoint script (with chmod +x), then sets ENTRYPOINT to the new script.
Postgres service and compose environment wiring
docker-compose.yaml
Adds a db service with postgres:16-alpine, pg_isready healthcheck, restart policy, and a postgres_data volume. Updates qcx to inject DATABASE_URL and EXECUTE_MIGRATIONS=true, depend on db healthy, and use a bun-based /api/health healthcheck. Updates qcx-dev to set DATABASE_URL inline with db health dependency.

Sequence Diagram(s)

sequenceDiagram
  participant Compose as docker-compose
  participant db as db (postgres:16-alpine)
  participant Entrypoint as docker-entrypoint.sh
  participant Drizzle as bun run db:migrate
  participant App as bun server.js

  Compose->>db: start and await pg_isready
  db-->>Compose: healthy
  Compose->>Entrypoint: start qcx container
  Entrypoint->>Entrypoint: check EXECUTE_MIGRATIONS=true
  Entrypoint->>Drizzle: run migrations against DATABASE_URL
  Drizzle-->>Entrypoint: complete (non-fatal on error)
  Entrypoint->>App: exec bun server.js
  App-->>Compose: /api/health bun fetch passes
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

  • QueueLab/QCX#393: Modifies the same Dockerfile runner-stage healthcheck and non-root user setup, and updates docker-compose.yaml service healthchecking—directly overlapping with this PR's Docker infrastructure changes.

Suggested labels

Review effort 3/5

🐇 A database wakes, migrations in tow,
The entrypoint script puts on quite a show.
"If EXECUTE_MIGRATIONS is true," it declares,
"We'll migrate before the server even cares!"
Postgres stands ready, its volume in place—
Now bunny deploys with containerized grace. 🥕

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately reflects the main objective of the PR, which is to configure Docker and database interoperability through updates to Dockerfile, docker-compose.yaml, entrypoint script, and database initialization logic.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
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.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch docker-db-interop-5392326425213968008

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 ESLint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

ESLint install failed. For unrecoverable errors, disable the tool in CodeRabbit configuration.


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 and usage tips.

@ngoiyaeric ngoiyaeric merged commit 8636eb4 into main Jun 19, 2026
3 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.

2 participants