dev setup: allow Postgres and Redis host ports to be configured
- Dominant language
- Rust
- Stars
- 32.7k
- Forks
- 4.3k
- Avg merge
- 1d 13h
- Merged PRs (30d)
- 253
Description
## Summary
`just setup` requires host ports `5432` and `6379` for its Docker-managed Postgres and Redis services. This blocks local setup when standard Homebrew Postgres or Redis services are already running, even though Buzz itself supports custom `DATABASE_URL` and `REDIS_URL` values.
## Environment
- Buzz `main` at `acfbb1bb`
- macOS
- Docker Desktop 29.3.1 / Docker Compose 5.1.1
- Homebrew `postgresql@15` on `localhost:5432`
- Homebrew `redis` on `localhost:6379`
## Reproduction
1. Start local Postgres and Redis services on their standard ports.
2. Clone Buzz and activate Hermit.
3. Run:
```bash
just setup
```
## Actual behavior
Setup aborts before Compose starts:
```text
[dev-setup] Local Redis is already listening on port 6379 (...).
Stop it before running setup: brew services stop redis
```
Postgres would also conflict because `docker-compose.yml` publishes `5432:5432`.
The fixed assumptions are currently spread across:
- `docker-compose.yml`: `5432:5432` and `6379:6379`
- `scripts/dev-setup.sh`: collision detection always checks `6379`
- `.env.example`: URLs and `PGPORT` use the standard ports
Stopping existing database services can disrupt unrelated local applications.
## Expected behavior
Buzz should preserve the current defaults while allowing its Docker services to bind configurable host ports, for example:
```dotenv
DATABASE_URL=postgres://buzz:buzz_dev@localhost:55432/buzz
PGPORT=55432
BUZZ_REDIS_HOST_PORT=56379
REDIS_URL=redis://localhost:56379
```
Then `just setup`, `just relay`, and `just dev` should use those values without requiring existing services to stop.
## Proposed direction
- Publish Postgres as `${PGPORT:-5432}:5432`.
- Add a Redis host-port setting, e.g. `BUZZ_REDIS_HOST_PORT`, and publish `${BUZZ_REDIS_HOST_PORT:-6379}:6379`.
- Make the local Redis collision check inspect the configured host port.
- Document that each host-port value and its corresponding connection URL must be changed together.
- Consider making integration-test scripts honor the configured URLs/ports as a follow-up.
## Local verification
I tested the proposed approach with Postgres on `55432` and Redis on `56379`:
- `just setup` completed.
- Database migrations and local community seeding completed.
- Both Buzz containers reported healthy.
- Both existing Homebrew services remained running.
- Redis returned `PONG` on both `6379` (Homebrew) and `56379` (Buzz).
Contributor guide
Assessment
This issue has not been assessed yet.