Skip to content

postgresql plugin ignores PGPORT environment variable #2773

@restblake

Description

@restblake

Description

The postgresql plugin's process-compose.yaml does not respect the PGPORT environment variable when starting postgres:

# Current (plugins/postgresql/process-compose.yaml)
command: "pg_ctl start -o \"-k '$PGHOST'\""

This means postgres always starts on port 5432, even if PGPORT is set in the environment or via devbox.json.

Use Case

Running multiple devbox projects or worktrees simultaneously requires each instance to use different ports to avoid conflicts. Currently, there's no way to configure the postgres port through devbox's standard mechanisms.

Expected Behavior

The plugin should respect PGPORT like it respects PGHOST:

# Proposed fix
command: "pg_ctl start -o \"-k $PGHOST -p $PGPORT\""

And the readiness probe should also use the port:

readiness_probe:
  exec:
    command: "pg_isready -p $PGPORT"

Additional Context

  • The valkey plugin correctly uses $VALKEY_PORT in its process-compose.yaml, so this pattern already exists in other plugins
  • This is a one-line fix that would enable parallel development workflows
  • Current workaround requires bypassing devbox services entirely and starting postgres manually

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions