fix(dev): resolve postgres port conflict with local PostgreSQL installations#9
Open
deangoodmanson wants to merge 1 commit intodevelopfrom
Open
fix(dev): resolve postgres port conflict with local PostgreSQL installations#9deangoodmanson wants to merge 1 commit intodevelopfrom
deangoodmanson wants to merge 1 commit intodevelopfrom
Conversation
macOS developers with a local PostgreSQL installation experienced
"role kruxiaflow does not exist" errors when running tests, because
both the Docker container and the local server bound port 5432 and
host TCP connections landed on the local server.
Changes:
- docker-compose.yml: expose Docker postgres on ${POSTGRES_PORT:-5433}:5432
so it no longer conflicts with a local postgres on 5432
- scripts/test.sh: load .env before setup so POSTGRES_PASSWORD and
POSTGRES_PORT are available; use ${POSTGRES_PORT:-5433} for DB_PORT
- .env.example: document POSTGRES_PORT with updated default and rationale
Container-internal references (postgres:5432) are unchanged — those
communicate over Docker's internal network and are unaffected.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
| - "log_min_duration_statement=100" | ||
| ports: | ||
| - "5432:5432" | ||
| - "${POSTGRES_PORT:-5433}:5432" |
Contributor
There was a problem hiding this comment.
I'd rather default to 5432 but I agree with having an override to other ports.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
5432:5432to${POSTGRES_PORT:-5433}:5432to avoid conflicts with a locally-installed PostgreSQL server.envloading toscripts/test.shsoPOSTGRES_PORTandPOSTGRES_PASSWORDare picked up automatically.env.exampledocumentation to explain the default port choiceProblem
On developer machines with a local PostgreSQL installation, both the local server and Docker bind to port 5432. TCP connections from the host (used by
cargo testandscripts/test.sh) silently hit the local server instead of Docker, causingrole "kruxiaflow" does not existerrors.This was discovered via
lsof -i :5432showing two processes on the same port.Test plan
docker-compose up -d postgres./scripts/test.sh --skip-db-setup(withDATABASE_URLpointing to port 5433)./scripts/test.shtest_invalidate_cache_key_requires_authand related cache handler tests pass🤖 Generated with Claude Code