Skip to content

chore: make Postgres host port configurable via POSTGRES_PORT#18

Merged
xernobyl merged 9 commits intomainfrom
chore/postgres-port-env
Feb 9, 2026
Merged

chore: make Postgres host port configurable via POSTGRES_PORT#18
xernobyl merged 9 commits intomainfrom
chore/postgres-port-env

Conversation

@xernobyl
Copy link
Contributor

@xernobyl xernobyl commented Feb 5, 2026

Description:

Makes the Postgres host port configurable so developers can avoid port conflicts (e.g. with the main Formbricks app) without changing shared config. Also updates the README for setup and environment variables.

Configurable Postgres port

  • compose.yml: Port mapping uses "${POSTGRES_PORT:-5432}:5432" so the host port is controlled by env and defaults to 5432.
  • .env.example: Documents optional POSTGRES_PORT and notes that DATABASE_URL must use the same port when overriding.
  • README: Environment variables section is now a table (Variable, Required, Default, Description) including POSTGRES_PORT and its relation to DATABASE_URL. Troubleshooting added for port-already-in-use: set POSTGRES_PORT in .env, keep DATABASE_URL in sync, then make docker-up.
  • tests/README.md: Prerequisites updated to describe DATABASE_URL and POSTGRES_PORT instead of the hardcoded port 5433.

README: Go and PATH

  • Prerequisites: Go must be on PATH; added link to “Adding Go to PATH” and verification with go version.
  • Troubleshooting: “Go not found” — install Go, follow Adding Go to PATH, restart terminal. “Docker/Postgres port in use” — see above (use POSTGRES_PORT and DATABASE_URL).
  • Adding Go to PATH: New subsection with a single export PATH="..." line for macOS/Linux (bash/zsh), a note for the Go version manager, and verification with which go.

Default behaviour is unchanged (port 5432). To use another port, set POSTGRES_PORT and the same port in DATABASE_URL in your local .env only.

@xernobyl xernobyl marked this pull request as ready for review February 5, 2026 17:17
@BhagyaAmarasinghe
Copy link
Contributor

Right now the docs say 5432 but make run creates a .env with 5433 and doesn’t set POSTGRES_PORT, so Compose stays on 5432 and things can get out of sync. Worth either aligning the Makefile with the docs (both 5432) or setting POSTGRES_PORT=5433 in the generated .env and adding a quick note that new setups use 5433 to avoid port clashes.

@xernobyl xernobyl added this pull request to the merge queue Feb 9, 2026
Merged via the queue into main with commit 645b016 Feb 9, 2026
5 checks passed
@xernobyl xernobyl deleted the chore/postgres-port-env branch February 9, 2026 09:27
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