-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathdocker-compose.prod.yml
More file actions
246 lines (234 loc) · 6.41 KB
/
Copy pathdocker-compose.prod.yml
File metadata and controls
246 lines (234 loc) · 6.41 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
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
version: '3.8'
services:
# PostgreSQL Database
postgres:
image: postgres:15-alpine
container_name: aran-mcp-postgres-prod
environment:
POSTGRES_DB: ${POSTGRES_DB:-aran_mcp_prod}
POSTGRES_USER: ${POSTGRES_USER:-aran_user}
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}
ports:
- "5432:5432"
volumes:
- postgres_data_prod:/var/lib/postgresql/data
- ./backend/migrations:/docker-entrypoint-initdb.d:ro
healthcheck:
test: ["CMD-SHELL", "pg_isready -U ${POSTGRES_USER:-aran_user}"]
interval: 10s
timeout: 5s
retries: 5
restart: unless-stopped
networks:
- aran-network
# Redis Cache
redis:
image: redis:7-alpine
container_name: aran-mcp-redis-prod
command: redis-server --requirepass ${REDIS_PASSWORD:-changeme}
ports:
- "6379:6379"
volumes:
- redis_data_prod:/data
healthcheck:
test: ["CMD", "redis-cli", "--no-auth-warning", "-a", "${REDIS_PASSWORD:-changeme}", "ping"]
interval: 10s
timeout: 5s
retries: 5
restart: unless-stopped
networks:
- aran-network
# Backend API
backend:
build:
context: ./backend
dockerfile: Dockerfile
container_name: aran-mcp-backend-prod
environment:
- ENV=production
- SERVER_PORT=8080
- DB_HOST=postgres
- DB_PORT=5432
- DB_USER=${POSTGRES_USER:-aran_user}
- DB_PASSWORD=${POSTGRES_PASSWORD}
- DB_NAME=${POSTGRES_DB:-aran_mcp_prod}
- DB_SSL_MODE=${DB_SSL_MODE:-require}
- JWT_SECRET=${JWT_SECRET}
- JWT_ACCESS_EXPIRY=15
- JWT_REFRESH_EXPIRY=168
- LOG_LEVEL=${LOG_LEVEL:-warn}
- CORS_ALLOWED_ORIGINS=${CORS_ALLOWED_ORIGINS}
- RATE_LIMIT_REQUESTS_PER_MINUTE=${RATE_LIMIT_REQUESTS_PER_MINUTE:-60}
- REDIS_URL=redis://:${REDIS_PASSWORD:-changeme}@redis:6379
ports:
- "8080:8080"
depends_on:
postgres:
condition: service_healthy
redis:
condition: service_healthy
restart: unless-stopped
networks:
- aran-network
healthcheck:
test: ["CMD", "wget", "--no-verbose", "--tries=1", "--spider", "http://localhost:8080/health"]
interval: 30s
timeout: 10s
retries: 3
start_period: 40s
# Frontend
frontend:
build:
context: ./frontend
dockerfile: Dockerfile
container_name: aran-mcp-frontend-prod
environment:
- NODE_ENV=production
- NEXT_PUBLIC_API_URL=${NEXT_PUBLIC_API_URL:-http://localhost:8080/api/v1}
- NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY=${NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY}
- CLERK_SECRET_KEY=${CLERK_SECRET_KEY}
ports:
- "3000:3000"
depends_on:
backend:
condition: service_healthy
restart: unless-stopped
networks:
- aran-network
healthcheck:
test: ["CMD", "wget", "--no-verbose", "--tries=1", "--spider", "http://localhost:3000"]
interval: 30s
timeout: 10s
retries: 3
start_period: 40s
# MCP Server
mcp-server:
build:
context: ./mcp-server
dockerfile: Dockerfile
container_name: aran-mcp-server-prod
ports:
- "3001:3001"
restart: unless-stopped
networks:
- aran-network
healthcheck:
test: ["CMD", "wget", "--no-verbose", "--tries=1", "--spider", "http://localhost:3001"]
interval: 30s
timeout: 10s
retries: 3
# Nginx Reverse Proxy
nginx:
image: nginx:alpine
container_name: aran-mcp-nginx-prod
ports:
- "80:80"
- "443:443"
volumes:
- ./nginx/nginx.prod.conf:/etc/nginx/nginx.conf:ro
- ./nginx/ssl:/etc/nginx/ssl:ro
- nginx_logs:/var/log/nginx
depends_on:
- frontend
- backend
restart: unless-stopped
networks:
- aran-network
healthcheck:
test: ["CMD", "nginx", "-t"]
interval: 30s
timeout: 10s
retries: 3
# Prometheus (Monitoring)
prometheus:
image: prom/prometheus:latest
container_name: aran-mcp-prometheus-prod
ports:
- "9090:9090"
volumes:
- ./monitoring/prometheus.yml:/etc/prometheus/prometheus.yml:ro
- prometheus_data:/prometheus
command:
- '--config.file=/etc/prometheus/prometheus.yml'
- '--storage.tsdb.path=/prometheus'
- '--web.console.libraries=/etc/prometheus/console_libraries'
- '--web.console.templates=/etc/prometheus/consoles'
- '--storage.tsdb.retention.time=200h'
- '--web.enable-lifecycle'
restart: unless-stopped
networks:
- aran-network
# Grafana (Dashboards)
grafana:
image: grafana/grafana:latest
container_name: aran-mcp-grafana-prod
ports:
- "3002:3000"
environment:
- GF_SECURITY_ADMIN_PASSWORD=${GRAFANA_PASSWORD:-admin}
- GF_USERS_ALLOW_SIGN_UP=false
- GF_INSTALL_PLUGINS=grafana-clock-panel,grafana-simple-json-datasource
volumes:
- grafana_data:/var/lib/grafana
- ./monitoring/grafana/dashboards:/etc/grafana/provisioning/dashboards:ro
- ./monitoring/grafana/datasources:/etc/grafana/provisioning/datasources:ro
depends_on:
- prometheus
restart: unless-stopped
networks:
- aran-network
healthcheck:
test: ["CMD-SHELL", "curl -f http://localhost:3000/api/health || exit 1"]
interval: 30s
timeout: 10s
retries: 3
# Node Exporter (System Metrics)
node-exporter:
image: prom/node-exporter:latest
container_name: aran-mcp-node-exporter-prod
ports:
- "9100:9100"
volumes:
- /proc:/host/proc:ro
- /sys:/host/sys:ro
- /:/rootfs:ro
command:
- '--path.procfs=/host/proc'
- '--path.rootfs=/rootfs'
- '--path.sysfs=/host/sys'
- '--collector.filesystem.mount-points-exclude=^/(sys|proc|dev|host|etc)($$|/)'
restart: unless-stopped
networks:
- aran-network
# cAdvisor (Container Metrics)
cadvisor:
image: gcr.io/cadvisor/cadvisor:latest
container_name: aran-mcp-cadvisor-prod
ports:
- "8081:8080"
volumes:
- /:/rootfs:ro
- /var/run:/var/run:ro
- /sys:/sys:ro
- /var/lib/docker/:/var/lib/docker:ro
- /dev/disk/:/dev/disk:ro
privileged: true
devices:
- /dev/kmsg
restart: unless-stopped
networks:
- aran-network
volumes:
postgres_data_prod:
driver: local
redis_data_prod:
driver: local
prometheus_data:
driver: local
grafana_data:
driver: local
nginx_logs:
driver: local
networks:
aran-network:
driver: bridge