Port Conflicts
AEGIS uses a range of ports for its microservices and infrastructure. Port conflicts are one of the most common issues when starting the platform, especially if you run other development projects alongside AEGIS.
Full Port Map
Application Services
| Port | Service | Language | Process |
|---|---|---|---|
| 3000 | Frontend | TypeScript | npm run dev (Next.js) |
| 8000 | API Gateway | Go | go run ./cmd/gateway/ |
| 8001 | Orchestration Engine | Python | uvicorn orchestration.main:app |
| 8002 | Memory Service | Python | uvicorn memory.main:app |
| 8003 | Knowledge Graph Service | Python | uvicorn knowledge_graph.main:app |
| 8004 | Approval Service | Python | uvicorn approval.main:app |
| 8005 | Ingestion Service | Python | uvicorn ingestion.main:app |
| 8006 | Compliance Monitor | Python | uvicorn compliance.main:app |
| 8007 | Flaring Monitor | Python | uvicorn flaring.main:app |
| 8009 | Auth Service | Python | uvicorn auth_service.main:app |
Port 8008 is intentionally unused — it is reserved for future services.
Infrastructure Services
| Port | Service | Container Name | Process |
|---|---|---|---|
| 5432 | PostgreSQL 15 | aegis-postgres | Docker (apache/age + pgvector) |
| 6379 | Redis 7 | aegis-redis | Docker (redis:7-alpine) |
| 9092 | Kafka | aegis-kafka | Docker (confluentinc/cp-kafka:7.6.0) |
| 9093 | Kafka Controller | aegis-kafka | Internal (KRaft controller, not exposed to host) |
Checking What Is Using a Port
macOS
# Check a specific port
lsof -i :8001
# Check all AEGIS ports at once
for port in 3000 5432 6379 8000 8001 8002 8003 8004 8005 8006 8007 8009 9092; do
pid=$(lsof -ti:$port 2>/dev/null)
if [ -n "$pid" ]; then
echo "Port $port: PID $pid ($(ps -p $pid -o comm= 2>/dev/null))"
else
echo "Port $port: free"
fi
doneLinux
# Check a specific port
ss -tlnp | grep :8001
# Or using netstat
netstat -tlnp | grep :8001Killing Conflicting Processes
Kill a Specific Port
# Kill whatever is on port 8001
lsof -ti:8001 | xargs kill -9Kill All AEGIS Ports
The start-all.sh stop command does this automatically:
./infrastructure/scripts/start-all.sh stopThis kills processes on ports 8000-8007 and 8009 using lsof, and also reads from the .service-pids file to clean up tracked processes.
Kill Infrastructure Containers
# Stop all Docker containers
docker compose down
# Or stop a specific container
docker compose stop postgresChanging Default Ports
Python Services
Each Python service accepts a --port flag via uvicorn. To change the port, modify the startup command:
# Start orchestration engine on port 9001 instead of 8001
cd services/orchestration-engine
poetry run uvicorn orchestration.main:app --port 9001 --host 0.0.0.0If the service has a config module, you can also set it via environment variable. For example, the memory service reads from settings.PORT:
export PORT=9002
cd services/memory-service
poetry run uvicorn memory.main:app --port $PORTIf you change a service port, you must also update the API gateway routing configuration and any service-to-service HTTP client URLs. The orchestration engine, for example, has hardcoded URLs for the memory service (localhost:8002), knowledge graph service (localhost:8003), and approval service (localhost:8004).
Infrastructure Ports
To change infrastructure ports, modify docker-compose.yml. The port mapping is in host:container format:
# Change PostgreSQL from 5432 to 15432
services:
postgres:
ports:
- "15432:5432" # host:containerAfter changing infrastructure ports, update the corresponding environment variables:
# For a non-standard PostgreSQL port
DATABASE_URL=postgresql://aegis:aegis_local@localhost:15432/aegisAPI Gateway Port
The Go gateway runs on port 8000. To change it, modify the gateway’s configuration or pass it as a flag:
cd services/api-gateway
PORT=9000 go run ./cmd/gateway/Frontend Port
Next.js defaults to port 3000. To change it:
cd frontend
PORT=4000 npm run devOr in frontend/package.json:
{
"scripts": {
"dev": "next dev -p 4000"
}
}Common Port Conflicts by Application
| Port | Common Conflicting Application |
|---|---|
| 3000 | React dev servers, Rails, other Next.js apps |
| 5432 | Local PostgreSQL installations (Homebrew, system) |
| 6379 | Local Redis installations (Homebrew, system) |
| 8000 | Django dev server, other Python web frameworks |
| 8080 | Various web servers (not used by AEGIS, but close to 8000) |
| 9092 | Other Kafka installations |
PostgreSQL Conflict (Port 5432)
If you have a system PostgreSQL installation:
# Check if system PostgreSQL is running
pg_isready -h localhost -p 5432
# On macOS with Homebrew
brew services stop postgresql@15
# Or change the Docker port mapping
# In docker-compose.yml: "15432:5432"Redis Conflict (Port 6379)
# Check if system Redis is running
redis-cli ping
# On macOS with Homebrew
brew services stop redis
# Or change the Docker port mapping
# In docker-compose.yml: "16379:6379"The start-all.sh Port Cleanup
The start-all.sh script handles port cleanup automatically on startup. It runs stop_services() first, which:
- Reads PIDs from
.service-pidsand kills each process - As a fallback, kills any process on ports 8000-8007 and 8009 using
lsof
# From start-all.sh
for port in 8000 8001 8002 8003 8004 8005 8006 8007 8009; do
lsof -ti:$port | xargs kill -9 2>/dev/null || true
doneThis means running start-all.sh after a crash or partial shutdown will clean up stale processes automatically.