Skip to content

Wait until the dev database accepts connections in wasp db start - #5285

Merged
infomiho merged 2 commits into
mainfrom
issue-4479-dev-db-session
Nov 20, 2026
Merged

infomiho merged 2 commits into
mainfrom
issue-4479-dev-db-session

Conversation

@infomiho

@infomiho infomiho commented Nov 5, 2026 •

Copy link
Copy Markdown
Member

Description

What it says on the tin, we use pg_isready to make sure the database is up before outputting is ready. Not a huge change, but this sets up for using it in other commands that need to wait for database being up before starting.

Agreement

Type of change

  • 🔧 Just code/docs improvement
  • 🐞 Bug fix
  • 🚀 New/improved feature
  • 💥 Breaking change

Checklist

  • I tested my change in a Wasp app to verify that it works as intended.

  • 🧪 Tests and apps:

    • I added unit tests for my change.
    • (if you fixed a bug) I added a regression test for the bug I fixed.
    • (if you added/updated a feature) I added/updated e2e tests in examples/kitchen-sink/e2e-tests.
    • (if you added/updated a feature) I updated the starter templates in waspc/data/Cli/templates, as needed.
    • (if you added/updated a feature) I updated the example apps in examples/, as needed.
      • (if you updated examples/tutorials) I updated the tutorial in the docs (and vice versa).
  • 📜 Documentation:

    • (if you added/updated a feature) I added/updated the documentation in web/docs/.
  • 🆕 Changelog: (if change is more than just code/docs improvement)

    • I updated waspc/ChangeLog.md with a user-friendly description of the change.
    • (if you did a breaking change) I added a step to the current migration guide in web/docs/migration-guides/.
    • I bumped the version in waspc/waspc.cabal to reflect the changes I introduced.

@infomiho
infomiho added this pull request to stack #5286 November 5, 2026 17:04
@infomiho
infomiho temporarily deployed to railway-deploy-test November 5, 2026 17:10 — with GitHub Actions Inactive
@pkg-pr-new

pkg-pr-new Bot commented Nov 5, 2026 •

Copy link
Copy Markdown

Open in StackBlitz

@wasp/spec

npx https://pkg.pr.new/@wasp/spec@5285

@wasp/cli

npx https://pkg.pr.new/@wasp/cli@5285

@wasp/cli-darwin-arm64-unknown

npx https://pkg.pr.new/@wasp/cli-darwin-arm64-unknown@5285

@wasp/cli-linux-arm64-glibc

npx https://pkg.pr.new/@wasp/cli-linux-arm64-glibc@5285

@wasp/cli-linux-x64-glibc

npx https://pkg.pr.new/@wasp/cli-linux-x64-glibc@5285

@wasp/cli-linux-x64-musl

npx https://pkg.pr.new/@wasp/cli-linux-x64-musl@5285

commit: 73a1e71

@infomiho
infomiho temporarily deployed to railway-deploy-test November 5, 2026 17:25 — with GitHub Actions Inactive
@infomiho
infomiho force-pushed the issue-4479-dev-db-session branch from 122bdae to c021ccd Compare November 6, 2026 08:42
@infomiho
infomiho temporarily deployed to railway-deploy-test November 6, 2026 08:45 — with GitHub Actions Inactive
@infomiho
infomiho marked this pull request as ready for review November 6, 2026 08:56

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Important

A clean database exit during startup can still trigger the readiness callback and print a false “ready” message.

Reviewed changes: Reviewed the readiness probe, database-session lifetime, and updated E2E synchronization.

  • Readiness polling: Uses container-local TCP pg_isready checks to wait past PostgreSQL initialization.
  • Session lifetime: Extracts withPostgresDevDb and brackets an asynchronous database job while racing readiness against process exit.
  • E2E synchronization: Waits for Wasp's readiness message before exercising migrations and existing shutdown checks.

Container-backed E2E tests could not be run locally because Docker reported: Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?

Pullfrog  | Fix all ➔ | Fix 👍s ➔ | View workflow run | Using gpt-6.1-sol | 𝕏

Comment thread waspc/cli/src/Wasp/Cli/DevDb.hs Resolved
@infomiho
infomiho force-pushed the issue-4479-dev-db-session branch from c021ccd to 73a1e71 Compare November 6, 2026 10:01
@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Nov 6, 2026 •

Copy link
Copy Markdown

Deploying wasp-docs-on-main with  Cloudflare Pages  Cloudflare Pages

Latest commit: 274b850
Status:⚡️  Build in progress...

View logs

@infomiho infomiho added the skip-ci Disables GitHub Workflows on this PR. label Nov 6, 2026

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ No new issues found.

Reviewed changes: Reviewed the changes since the previous Pullfrog review at c021ccd, focusing on startup failures and readiness-check results.

  • Prevented false readiness: Restricted the callback to successful readiness checks and made every pre-readiness container exit fail startup, including clean exits.
  • Handled missing probes: Added an explicit failure when docker exec reports that the readiness command is missing, rather than retrying indefinitely.
  • Added regression coverage: Added E2E assertions for an immediately exiting alpine container and an nginx:alpine container without pg_isready.

Container-backed E2E tests could not be run here: docker info reported Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?

Pullfrog  | View workflow run | Using gpt-6.1-sol | 𝕏

@infomiho
infomiho temporarily deployed to railway-deploy-test November 6, 2026 10:14 — with GitHub Actions Inactive
@infomiho
infomiho removed this pull request from stack #5286 November 7, 2026 14:53
@infomiho
infomiho added this pull request to stack #5310 November 7, 2026 14:53
@github-actions

Copy link
Copy Markdown
Contributor

This pull request is now stale.
That means that it hasn't seen any activity for a while, and needs to be updated or addressed before it can be merged.

Next steps if the PR is still relevant, and you are able to devote time to it:

  • If you received any questions or feedback, please address them.
  • Merge the latest main into your branch to ensure that you are up to date.
  • If you are still working on the changes, please leave a comment telling us so.
  • Otherwise, just leave a comment explaining why the PR is still relevant.

If no action is taken, this PR will be automatically closed in 7 days.

@github-actions github-actions Bot added the Stale label Nov 14, 2026
@infomiho
infomiho force-pushed the issue-4479-dev-db-session branch from 73a1e71 to 8051a2a Compare November 19, 2026 14:22
@infomiho infomiho removed the Stale label Nov 19, 2026
@infomiho
infomiho removed this pull request from stack #5310 November 20, 2026 10:32
@infomiho
infomiho added this pull request to stack #5428 November 20, 2026 10:32
Base automatically changed from issue-4479-dev-db-module to main November 20, 2026 20:21
@infomiho
infomiho requested review from a team and sodic November 20, 2026 20:21
@infomiho
infomiho force-pushed the issue-4479-dev-db-session branch from 8051a2a to 274b850 Compare November 20, 2026 20:21
@infomiho
infomiho merged commit b85f9c9 into main Nov 20, 2026
15 of 17 checks passed
@infomiho
infomiho deleted the issue-4479-dev-db-session branch November 20, 2026 20:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

skip-ci Disables GitHub Workflows on this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant