Skip to content

fix: make postgres port configurable for WSL2 compatibility#28478

Open
Felipeness wants to merge 4 commits intocalcom:mainfrom
Felipeness:fix/28395-configurable-db-port
Open

fix: make postgres port configurable for WSL2 compatibility#28478
Felipeness wants to merge 4 commits intocalcom:mainfrom
Felipeness:fix/28395-configurable-db-port

Conversation

@Felipeness
Copy link

Summary

  • Makes the Postgres host port configurable via DATABASE_PORT env var in packages/prisma/docker-compose.yml
  • Defaults to 5450 for backward compatibility (${DATABASE_PORT:-5450}:5432)
  • Adds documented DATABASE_PORT entry in .env.example with WSL2 troubleshooting context
  • Follows existing pattern: root docker-compose.yml already uses ${REDIS_PORT:-6379}:6379 for Redis

Fixes #28395

Root cause

Docker Desktop on WSL2 has a known issue where its port-forwarding proxy retains stale reservations after unclean container exits. Since Cal.com hardcodes port 5450, users cannot work around the conflict without modifying tracked files. The error manifests as:

/forwards/expose returned unexpected status: 500

Test plan

  • yarn dx works with default config (no DATABASE_PORT set) — port 5450 used
  • yarn dx works with DATABASE_PORT=5451 set in .env — port 5451 used
  • Verify .env.example has clear documentation about when to use DATABASE_PORT

@Felipeness Felipeness requested a review from a team as a code owner March 18, 2026 02:15
@CLAassistant
Copy link

CLAassistant commented Mar 18, 2026

CLA assistant check
All committers have signed the CLA.

@graphite-app graphite-app bot added the community Created by Linear-GitHub Sync label Mar 18, 2026
@github-actions github-actions bot added 🐛 bug Something isn't working ❗️ .env changes contains changes to env variables and removed community Created by Linear-GitHub Sync labels Mar 18, 2026
Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

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

No issues found across 2 files

Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

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

1 issue found across 1 file (changes from recent commits).

Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="turbo.json">

<violation number="1" location="turbo.json:49">
P2: `DATABASE_PORT` was added to `globalEnv`, which makes it part of the hash for all Turbo tasks even though it appears to be only needed for local Prisma/docker-compose flows. This can unnecessarily reduce cache reuse across unrelated tasks.</violation>
</file>

Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.

Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

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

1 issue found across 1 file (changes from recent commits).

Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="turbo.json">

<violation number="1" location="turbo.json:338">
P2: `DATABASE_PORT` is only exposed to `@calcom/prisma#db-up`, but `@calcom/prisma#db-reset` also shells into `db-up` via nested scripts and will lose the variable in Turbo strict mode, causing fallback to default port.</violation>
</file>

Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.

@Felipeness
Copy link
Author

@cubic-dev-ai addressed your feedback — moved DATABASE_PORT from globalEnv to task-specific env for db-up and db-reset. Should fix both the cache reuse concern and the strict mode variable loss.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

🐛 bug Something isn't working ❗️ .env changes contains changes to env variables size/S

Projects

None yet

Development

Successfully merging this pull request may close these issues.

yarn dx fails on WSL2 with Docker Desktop: Postgres container cannot bind port 5450

2 participants