Skip to content

Commit 940096f

Browse files
committed
feat: resolve Docker port conflicts for evals services
- Update postgres port from 5432 to 5433 to avoid conflicts - Update redis port from 6379 to 6380 to avoid conflicts - Update DATABASE_URL in .env.development and .env.test to use new port - Add .env.local.example with port configuration documentation - Update README.md with comprehensive port configuration guide - Add PORT-CONFLICT-SOLUTION.md with detailed implementation plan This allows evals to run alongside other postgres/redis services without port conflicts while maintaining backward compatibility.
1 parent a6e16e8 commit 940096f

File tree

4 files changed

+123
-2
lines changed

4 files changed

+123
-2
lines changed

packages/evals/.env.development

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,3 @@
1-
DATABASE_URL=postgres://postgres:password@localhost:5432/evals_development
1+
DATABASE_URL=postgres://postgres:password@localhost:5433/evals_development
2+
EVALS_DB_PORT=5433
3+
EVALS_REDIS_PORT=6380

packages/evals/.env.test

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,3 @@
1-
DATABASE_URL=postgres://postgres:password@localhost:5432/evals_test
1+
DATABASE_URL=postgres://postgres:password@localhost:5433/evals_test
2+
EVALS_DB_PORT=5433
3+
EVALS_REDIS_PORT=6380
Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
# Docker Port Conflict Solution for Evals
2+
3+
## Problem
4+
5+
The `pnpm evals` command runs Docker services for postgres (port 5432) and redis (port 6379) which conflict with other services running on the same ports.
6+
7+
## Solution
8+
9+
Update the environment configuration to use non-conflicting ports:
10+
11+
- Postgres: 5433 (instead of 5432)
12+
- Redis: 6380 (instead of 6379)
13+
14+
## Implementation Plan
15+
16+
### 1. Environment File Updates
17+
18+
Update the following files to include port configuration:
19+
20+
**packages/evals/.env.development**
21+
22+
```
23+
DATABASE_URL=postgres://postgres:password@localhost:5433/evals_development
24+
EVALS_DB_PORT=5433
25+
EVALS_REDIS_PORT=6380
26+
```
27+
28+
**packages/evals/.env.test**
29+
30+
```
31+
DATABASE_URL=postgres://postgres:password@localhost:5433/evals_test
32+
EVALS_DB_PORT=5433
33+
EVALS_REDIS_PORT=6380
34+
```
35+
36+
### 2. Create .env.local Template
37+
38+
Create `packages/evals/.env.local.example` to document the configuration:
39+
40+
```
41+
# Copy this file to .env.local and customize as needed
42+
# These ports are used to avoid conflicts with other services
43+
44+
# Database configuration
45+
EVALS_DB_PORT=5433
46+
EVALS_REDIS_PORT=6380
47+
48+
# Optional: Override database URL if needed
49+
# DATABASE_URL=postgres://postgres:password@localhost:5433/evals_development
50+
```
51+
52+
### 3. Docker Compose Configuration
53+
54+
The existing docker-compose.yml already supports these environment variables:
55+
56+
- `${EVALS_DB_PORT:-5432}:5432` for postgres
57+
- `${EVALS_REDIS_PORT:-6379}:6379` for redis
58+
59+
### 4. Documentation Updates
60+
61+
Update README.md to document the port configuration and how to avoid conflicts.
62+
63+
## Benefits
64+
65+
1. **No Port Conflicts**: Evals can run alongside other postgres/redis services
66+
2. **Backward Compatible**: Default ports remain the same if environment variables aren't set
67+
3. **Configurable**: Users can customize ports via environment variables
68+
4. **Clear Documentation**: Users understand how to resolve conflicts
69+
70+
## Testing
71+
72+
After implementation:
73+
74+
1. Start existing postgres/redis services on default ports
75+
2. Run `pnpm evals` to verify it uses the new ports
76+
3. Confirm both services can run simultaneously
77+
4. Test database connectivity with the new port configuration

packages/evals/README.md

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,46 @@ The setup script does the following:
8989
- Prompts for an OpenRouter API key to add to `.env.local`
9090
- Optionally builds and installs the Roo Code extension from source
9191

92+
## Port Configuration
93+
94+
By default, the evals system uses the following ports:
95+
96+
- **PostgreSQL**: 5433 (external) → 5432 (internal)
97+
- **Redis**: 6380 (external) → 6379 (internal)
98+
- **Web Service**: 3446 (external) → 3000 (internal)
99+
100+
These ports are configured to avoid conflicts with other services that might be running on the standard PostgreSQL (5432) and Redis (6379) ports.
101+
102+
### Customizing Ports
103+
104+
If you need to use different ports, you can customize them by creating a `.env.local` file in the `packages/evals/` directory:
105+
106+
```sh
107+
# Copy the example file and customize as needed
108+
cp packages/evals/.env.local.example packages/evals/.env.local
109+
```
110+
111+
Then edit `.env.local` to set your preferred ports:
112+
113+
```sh
114+
# Custom port configuration
115+
EVALS_DB_PORT=5434
116+
EVALS_REDIS_PORT=6381
117+
EVALS_WEB_PORT=3447
118+
119+
# Optional: Override database URL if needed
120+
DATABASE_URL=postgres://postgres:password@localhost:5434/evals_development
121+
```
122+
123+
### Port Conflict Resolution
124+
125+
If you encounter port conflicts when running `pnpm evals`, you have several options:
126+
127+
1. **Use the default configuration** (recommended): The system now uses non-standard ports by default
128+
2. **Stop conflicting services**: Temporarily stop other PostgreSQL/Redis services
129+
3. **Customize ports**: Use the `.env.local` file to set different ports
130+
4. **Use Docker networks**: Run services in isolated Docker networks
131+
92132
## Troubleshooting
93133

94134
Here are some errors that you might encounter along with potential fixes:

0 commit comments

Comments
 (0)