Skip to content

Reuse an already running dev database - #5295

Merged
infomiho merged 1 commit into
mainfrom
issue-4479-dev-db-reuse
Nov 20, 2026
Merged

infomiho merged 1 commit into
mainfrom
issue-4479-dev-db-reuse

Conversation

@infomiho

@infomiho infomiho commented Nov 6, 2026 •

Copy link
Copy Markdown
Member

Description

Prepare a dev DB helper that either reuses an already running database or starts a new one (useful for wasp start and other wasp db * commands that are not wasp db start). For wasp db start we fail because that command is supposed to start the database.

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 6, 2026 11:11
@infomiho infomiho added the skip-ci Disables GitHub Workflows on this PR. label Nov 6, 2026
@infomiho
infomiho temporarily deployed to railway-deploy-test November 6, 2026 11:25 — with GitHub Actions Inactive
@pkg-pr-new

pkg-pr-new Bot commented Nov 6, 2026

Copy link
Copy Markdown

Open in StackBlitz

@wasp/spec

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

@wasp/cli

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

@wasp/cli-darwin-arm64-unknown

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

@wasp/cli-linux-arm64-glibc

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

@wasp/cli-linux-x64-glibc

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

@wasp/cli-linux-x64-musl

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

commit: 520b8b5

@infomiho infomiho changed the title Reuse a running dev database in withPostgresDevDbRunning Reuse an already running dev database Nov 6, 2026
@infomiho
infomiho force-pushed the issue-4479-dev-db-reuse branch from 520b8b5 to 9e96337 Compare November 6, 2026 14:09
@infomiho
infomiho marked this pull request as ready for review November 6, 2026 14:11

@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

The new reuse helper can execute database-dependent actions before PostgreSQL is ready.

Reviewed changes Reviewed the PostgreSQL helper split, container reuse, and startup/cleanup behavior.

  • Reuse helper: Adds withRunningPostgresDevDb to reuse an existing project database without stopping it afterward, or start a temporary one around the action.
  • Foreground startup: Preserves wasp db start failing when the project's database is already running.
  • Shared implementation: Extracts fresh-container startup, Docker availability checks, and connection information formatting.

The new helper has no callers yet, so the finding concerns its readiness contract rather than a current wasp start regression. Runtime validation was unavailable because Docker reported Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?; cabal build lib:cli-lib --offline also stopped before compilation because required Haskell packages were not cached.

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-reuse branch from 9e96337 to a3962e4 Compare November 6, 2026 15:00

@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

The new readiness wait can hang indefinitely if the reused database exits before becoming ready.

Reviewed changes Reviewed the delta since 9e96337, covering readiness on reuse and the shared validation/error handling.

  • Added readiness gating: Waited for a reused PostgreSQL container to accept connections before invoking the action.
  • Shared readiness handling: Extracted throwUnlessDevDbAcceptsConnections and throwDbError for both startup paths.
  • Moved Docker validation: Limited the explicit executable and daemon checks to fresh-container startup, after discovery.

Docker-backed validation was unavailable: Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running? The offline CLI build also stopped before compilation because required Haskell packages were not cached (--offline was specified, hence refusing to download the package).

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 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-reuse branch from a3962e4 to e725b61 Compare November 19, 2026 14:22
@cloudflare-workers-and-pages

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

Copy link
Copy Markdown

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

Latest commit: 8c3fc66
Status:⚡️  Build in progress...

View logs

@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
@infomiho
infomiho force-pushed the issue-4479-dev-db-reuse branch from e725b61 to 945c476 Compare November 20, 2026 20:21
@infomiho
infomiho requested review from a team and viborc November 20, 2026 20:21
@infomiho
infomiho force-pushed the issue-4479-dev-db-reuse branch 2 times, most recently from 4405f11 to 427bc0a Compare November 20, 2026 20:22
Base automatically changed from issue-4479-dev-db-prefix to main November 20, 2026 20:24
@infomiho
infomiho force-pushed the issue-4479-dev-db-reuse branch from 427bc0a to 8c3fc66 Compare November 20, 2026 20:24
@infomiho
infomiho merged commit b630c02 into main Nov 20, 2026
15 of 16 checks passed
@infomiho
infomiho deleted the issue-4479-dev-db-reuse branch November 20, 2026 20:25
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