Skip to content

fix(pg): fix POSTGRES_PORT envvar to map external port to 5432 internally#1187

Merged
waleedlatif1 merged 1 commit into
stagingfrom
fix/pg-port
Aug 29, 2025
Merged

fix(pg): fix POSTGRES_PORT envvar to map external port to 5432 internally#1187
waleedlatif1 merged 1 commit into
stagingfrom
fix/pg-port

Conversation

@waleedlatif1

Copy link
Copy Markdown
Collaborator

Summary

fix POSTGRES_PORT envvar to map external port to 5432 internally, previously we had a mix of using the postgres port directly but we should map the users external port to 5432 interally, since that follows best practices for networking with docker

Type of Change

  • Bug fix

Testing

Tested manually by connecting to port 5555 and 5433

Checklist

  • Code follows project style guidelines
  • Self-reviewed my changes
  • Tests added/updated and passing
  • No new warnings introduced
  • I confirm that I have read and agree to the terms outlined in the Contributor License Agreement (CLA)

@vercel

vercel Bot commented Aug 29, 2025

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Comments Updated (UTC)
docs Ready Ready Preview Comment Aug 29, 2025 5:10pm
sim Building Building Preview Comment Aug 29, 2025 5:10pm

@waleedlatif1 waleedlatif1 merged commit 41ec75f into staging Aug 29, 2025
3 of 4 checks passed

@greptile-apps greptile-apps 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.

Greptile Summary

This PR fixes a critical Docker networking configuration issue across all docker-compose files in the SimStudio application. The change standardizes PostgreSQL port handling by hardcoding the internal database port to 5432 in all DATABASE_URL connection strings while preserving the ability to customize external port mapping through the POSTGRES_PORT environment variable.

Previously, the configuration incorrectly used ${POSTGRES_PORT:-5432} for both external port mapping AND internal connection URLs. This created a problematic scenario: when users set POSTGRES_PORT to a custom value (e.g., 5555 to avoid port conflicts), the internal services would attempt to connect to db:5555, but PostgreSQL always runs on port 5432 inside its container. The external port mapping '${POSTGRES_PORT:-5432}:5432' was correctly configured, but the connection strings weren't aligned with this pattern.

The fix affects four docker-compose files:

  • docker-compose.local.yml - Local development environment
  • docker-compose.prod.yml - Production environment
  • .devcontainer/docker-compose.yml - Development container setup
  • docker-compose.ollama.yml - Ollama integration setup

In each file, the simstudio, realtime, and migrations services now use hardcoded port 5432 in their DATABASE_URL connection strings, while the db service maintains the flexible external port mapping. This change implements proper Docker networking best practices where internal service-to-service communication uses standard ports, and only host-to-container access requires custom port mapping.

Confidence score: 5/5

  • This PR is safe to merge with minimal risk
  • Score reflects a straightforward configuration fix that aligns with Docker networking best practices and resolves a clear connectivity bug
  • No files require special attention as the changes are consistent and well-understood networking fixes

4 files reviewed, no comments

Edit Code Review Bot Settings | Greptile

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.

1 participant