-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
164 lines (153 loc) · 4.43 KB
/
docker-compose.yml
File metadata and controls
164 lines (153 loc) · 4.43 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
services:
# ===========================================
# Infrastructure Services
# ===========================================
neo4j:
image: neo4j:5
container_name: adjacent-neo4j
ports:
- "7475:7474" # HTTP
- "7688:7687" # Bolt
environment:
- NEO4J_AUTH=neo4j/adjacent123
volumes:
- neo4j-data:/data
healthcheck:
test: ["CMD", "cypher-shell", "-u", "neo4j", "-p", "adjacent123", "RETURN 1"]
interval: 10s
timeout: 5s
retries: 5
restart: unless-stopped
redis:
image: redis:7-alpine
container_name: adjacent-redis
ports:
- "6379:6379"
volumes:
- redis-data:/data
healthcheck:
test: ["CMD", "redis-cli", "ping"]
interval: 5s
timeout: 3s
retries: 5
restart: unless-stopped
# ===========================================
# Application Services
# ===========================================
api:
build:
context: .
dockerfile: Dockerfile
container_name: adjacent-api
ports:
- "8000:8000"
environment:
- PYTHONPATH=/app/src
- NEO4J_URI=bolt://neo4j:7687
- NEO4J_USER=neo4j
- NEO4J_PASSWORD=adjacent123
- REDIS_URL=redis://redis:6379/0
- OPENAI_API_KEY=${OPENAI_API_KEY:-}
volumes:
# Mount source for hot reload (needs write for .pyc files)
- ./src:/app/src
- ./schemas:/app/schemas
# Use :consistent for better macOS Docker Desktop performance
- ./logs:/app/logs:consistent
command: uv run uvicorn adjacent.api.app:app --host 0.0.0.0 --port 8000 --reload
depends_on:
neo4j:
condition: service_healthy
redis:
condition: service_healthy
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:8000/v1/system/status"]
interval: 30s
timeout: 10s
retries: 3
start_period: 40s
restart: unless-stopped
worker:
build:
context: .
dockerfile: Dockerfile
container_name: adjacent-worker
environment:
- PYTHONPATH=/app/src
- NEO4J_URI=bolt://neo4j:7687
- NEO4J_USER=neo4j
- NEO4J_PASSWORD=adjacent123
- REDIS_URL=redis://redis:6379/0
- OPENAI_API_KEY=${OPENAI_API_KEY:-}
- NO_COLOR=1
- OBJC_DISABLE_INITIALIZE_FORK_SAFETY=YES
volumes:
# Mount source for hot reload (needs write for .pyc files)
- ./src:/app/src
- ./schemas:/app/schemas
# Use :consistent for better macOS Docker Desktop performance
- ./logs:/app/logs:consistent
command: uv run rq worker adjacent_inference --url redis://redis:6379/0 --with-scheduler
depends_on:
neo4j:
condition: service_healthy
redis:
condition: service_healthy
restart: unless-stopped
# ===========================================
# Monitoring Stack (Grafana + Loki + Promtail)
# ===========================================
loki:
image: grafana/loki:2.9.0
container_name: adjacent-loki
ports:
- "3100:3100"
volumes:
- ./monitoring/loki-config.yml:/etc/loki/local-config.yaml
- loki-data:/loki
command: -config.file=/etc/loki/local-config.yaml
restart: unless-stopped
promtail:
image: grafana/promtail:2.9.0
container_name: adjacent-promtail
volumes:
- ./monitoring/promtail-config.yml:/etc/promtail/config.yml
# Use :consistent for better file sync on macOS Docker Desktop
- ./logs:/var/log/adjacent:consistent
command: -config.file=/etc/promtail/config.yml
depends_on:
- loki
restart: unless-stopped
grafana:
image: grafana/grafana:10.2.0
container_name: adjacent-grafana
ports:
- "3000:3000"
environment:
- GF_SECURITY_ADMIN_USER=admin
- GF_SECURITY_ADMIN_PASSWORD=adjacent123
- GF_USERS_ALLOW_SIGN_UP=false
volumes:
- ./monitoring/grafana/provisioning:/etc/grafana/provisioning
- grafana-data:/var/lib/grafana
depends_on:
- loki
restart: unless-stopped
# ===========================================
# Named Volumes (prevents leaks)
# ===========================================
volumes:
neo4j-data:
name: adjacent-neo4j-data
redis-data:
name: adjacent-redis-data
loki-data:
name: adjacent-loki-data
grafana-data:
name: adjacent-grafana-data
# ===========================================
# Network (all services on same network)
# ===========================================
networks:
default:
name: adjacent-network