Repository navigation
Reuse an already running dev database - #5295
Conversation
@wasp/spec
@wasp/cli
@wasp/cli-darwin-arm64-unknown
@wasp/cli-linux-arm64-glibc
@wasp/cli-linux-x64-glibc
@wasp/cli-linux-x64-musl
commit: |
520b8b5 to
9e96337
Compare
There was a problem hiding this comment.
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
withRunningPostgresDevDbto reuse an existing project database without stopping it afterward, or start a temporary one around the action. - Foreground startup: Preserves
wasp db startfailing 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.
gpt-6.1-sol | 𝕏
9e96337 to
a3962e4
Compare
There was a problem hiding this comment.
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
throwUnlessDevDbAcceptsConnectionsandthrowDbErrorfor 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).
gpt-6.1-sol | 𝕏
|
This pull request is now stale. Next steps if the PR is still relevant, and you are able to devote time to it:
If no action is taken, this PR will be automatically closed in 7 days. |
a3962e4 to
e725b61
Compare
e725b61 to
945c476
Compare
4405f11 to
427bc0a
Compare
427bc0a to
8c3fc66
Compare

Description
Prepare a dev DB helper that either reuses an already running database or starts a new one (useful for
wasp startand otherwasp db *commands that are notwasp db start). Forwasp db startwe fail because that command is supposed to start the database.Agreement
wasp start#4914 (comment)Type of change
Checklist
I tested my change in a Wasp app to verify that it works as intended.
🧪 Tests and apps:
examples/kitchen-sink/e2e-tests.waspc/data/Cli/templates, as needed.examples/, as needed.examples/tutorials) I updated the tutorial in the docs (and vice versa).📜 Documentation:
web/docs/.🆕 Changelog: (if change is more than just code/docs improvement)
waspc/ChangeLog.mdwith a user-friendly description of the change.web/docs/migration-guides/.versioninwaspc/waspc.cabalto reflect the changes I introduced.