-
-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
406 lines (350 loc) · 10.7 KB
/
docker-compose.yml
File metadata and controls
406 lines (350 loc) · 10.7 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
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
# =============================================================================
# Strada.Brain - Production Docker Compose Configuration
# =============================================================================
# Usage:
# docker compose up -d # Start all services
# docker compose -f docker-compose.yml up -d # Production mode
# docker compose down # Stop all services
# docker compose logs -f strada-brain # View logs
#
# Environment Variables (create .env file):
# ANTHROPIC_API_KEY=sk-ant-...
# TELEGRAM_BOT_TOKEN=123456:ABC...
# DISCORD_BOT_TOKEN=...
# SLACK_BOT_TOKEN=xoxb-...
# =============================================================================
version: "3.8"
services:
# ===========================================================================
# Main Application - Strada.Brain
# ===========================================================================
strada-brain:
build:
context: .
dockerfile: Dockerfile
args:
- NODE_ENV=production
container_name: strada-brain
hostname: strada-brain
environment:
# Core
- NODE_ENV=production
# AI Providers (Required)
- ANTHROPIC_API_KEY=${ANTHROPIC_API_KEY}
- OPENAI_API_KEY=${OPENAI_API_KEY:-}
- DEEPSEEK_API_KEY=${DEEPSEEK_API_KEY:-}
- GROQ_API_KEY=${GROQ_API_KEY:-}
- MISTRAL_API_KEY=${MISTRAL_API_KEY:-}
- GEMINI_API_KEY=${GEMINI_API_KEY:-}
- PROVIDER_CHAIN=${PROVIDER_CHAIN:-claude}
# Bot Tokens
- TELEGRAM_BOT_TOKEN=${TELEGRAM_BOT_TOKEN:-}
- DISCORD_BOT_TOKEN=${DISCORD_BOT_TOKEN:-}
- SLACK_BOT_TOKEN=${SLACK_BOT_TOKEN:-}
- SLACK_SIGNING_SECRET=${SLACK_SIGNING_SECRET:-}
- SLACK_APP_TOKEN=${SLACK_APP_TOKEN:-}
- SLACK_SOCKET_MODE=${SLACK_SOCKET_MODE:-true}
# Security
- ALLOWED_TELEGRAM_USER_IDS=${ALLOWED_TELEGRAM_USER_IDS:-}
- ALLOWED_SLACK_WORKSPACES=${ALLOWED_SLACK_WORKSPACES:-}
- ALLOWED_SLACK_USER_IDS=${ALLOWED_SLACK_USER_IDS:-}
- REQUIRE_EDIT_CONFIRMATION=${REQUIRE_EDIT_CONFIRMATION:-true}
- READ_ONLY_MODE=${READ_ONLY_MODE:-false}
# Project Paths
- UNITY_PROJECT_PATH=/app/project
# Dashboard & Monitoring
- DASHBOARD_ENABLED=${DASHBOARD_ENABLED:-true}
- DASHBOARD_PORT=3100
- METRICS_PORT=9090
# Memory
- MEMORY_ENABLED=${MEMORY_ENABLED:-true}
- MEMORY_DB_PATH=/app/.strada-memory
# Logging
- LOG_LEVEL=${LOG_LEVEL:-info}
- LOG_FILE=/app/logs/strada-brain.log
# Redis (optional - for distributed rate limiting)
- REDIS_URL=${REDIS_URL:-redis://:${REDIS_PASSWORD:-changeme}@redis:6379}
# Health check
- HEALTH_CHECK_PORT=3100
volumes:
# Unity project (read-only for security)
- type: bind
source: ${UNITY_PROJECT_PATH:-./project}
target: /app/project
read_only: true
# Persistent memory storage
- type: volume
source: strada-memory
target: /app/.strada-memory
# Log files
- type: volume
source: strada-logs
target: /app/logs
# Optional: Custom plugins
- type: bind
source: ${PLUGINS_PATH:-./plugins}
target: /app/plugins
read_only: true
bind:
create_host_path: true
ports:
- "${DASHBOARD_PORT:-3100}:3100" # Dashboard UI
- "${METRICS_PORT:-9090}:9090" # Prometheus metrics
# Resource limits
deploy:
resources:
limits:
cpus: '${CPU_LIMIT:-2}'
memory: ${MEMORY_LIMIT:-2G}
reservations:
cpus: '${CPU_RESERVATION:-0.5}'
memory: ${MEMORY_RESERVATION:-512M}
restart_policy:
condition: unless-stopped
delay: 5s
max_attempts: 3
window: 120s
# Health check
healthcheck:
test: ["CMD", "wget", "-q", "--spider", "http://localhost:3100/health"]
interval: 30s
timeout: 10s
retries: 3
start_period: 60s
start_interval: 5s
# Security
security_opt:
- no-new-privileges:true
read_only: true
tmpfs:
- /tmp:noexec,nosuid,size=100m
cap_drop:
- ALL
cap_add:
- CHOWN
- SETGID
- SETUID
# Networking
networks:
- strada-network
# Dependencies
depends_on:
redis:
condition: service_healthy
# Graceful shutdown
stop_grace_period: 30s
stop_signal: SIGTERM
# ===========================================================================
# Redis - Distributed Rate Limiting & Caching
# ===========================================================================
redis:
image: redis:7.4-alpine
container_name: strada-redis
hostname: redis
restart: unless-stopped
command: >
redis-server
--requirepass ${REDIS_PASSWORD:-changeme}
--maxmemory 256mb
--maxmemory-policy allkeys-lru
--appendonly yes
--appendfsync everysec
--no-appendfsync-on-rewrite yes
--auto-aof-rewrite-percentage 100
--auto-aof-rewrite-min-size 64mb
volumes:
- type: volume
source: redis-data
target: /data
# Resource limits
deploy:
resources:
limits:
cpus: '0.5'
memory: 256M
reservations:
cpus: '0.1'
memory: 64M
# Health check
healthcheck:
test: ["CMD", "redis-cli", "-a", "${REDIS_PASSWORD:-changeme}", "--no-auth-warning", "ping"]
interval: 10s
timeout: 3s
retries: 3
start_period: 10s
# Security
security_opt:
- no-new-privileges:true
read_only: true
tmpfs:
- /tmp:noexec,nosuid,size=10m
cap_drop:
- ALL
cap_add:
- SETGID
- SETUID
networks:
- strada-network
# No external exposure
expose:
- "6379"
# ===========================================================================
# Nginx - Reverse Proxy & SSL Termination
# ===========================================================================
nginx:
image: nginx:1.27-alpine
container_name: strada-nginx
hostname: nginx
restart: unless-stopped
environment:
- NGINX_ENTRYPOINT_QUIET_LOGS=1
ports:
- "${NGINX_HTTP_PORT:-80}:80"
- "${NGINX_HTTPS_PORT:-443}:443"
volumes:
# Nginx configuration
- type: bind
source: ./nginx/nginx.conf
target: /etc/nginx/nginx.conf
read_only: true
# SSL certificates
- type: bind
source: ${SSL_CERT_PATH:-./nginx/ssl}
target: /etc/nginx/ssl
read_only: true
bind:
create_host_path: true
# Let's Encrypt (optional)
- type: volume
source: letsencrypt-data
target: /etc/letsencrypt
# Nginx cache
- type: volume
source: nginx-cache
target: /var/cache/nginx
# Resource limits
deploy:
resources:
limits:
cpus: '0.5'
memory: 128M
reservations:
cpus: '0.1'
memory: 32M
# Health check
healthcheck:
test: ["CMD", "wget", "-q", "--spider", "http://localhost/health"]
interval: 30s
timeout: 10s
retries: 3
start_period: 10s
# Security
security_opt:
- no-new-privileges:true
read_only: true
tmpfs:
- /var/run:noexec,nosuid,size=10m
- /tmp:noexec,nosuid,size=10m
cap_drop:
- ALL
cap_add:
- CHOWN
- SETGID
- SETUID
networks:
- strada-network
depends_on:
strada-brain:
condition: service_healthy
# ===========================================================================
# Prometheus - Metrics Collection (Optional)
# ===========================================================================
prometheus:
image: prom/prometheus:v3.0.0
container_name: strada-prometheus
hostname: prometheus
restart: unless-stopped
profiles:
- monitoring
command:
- '--config.file=/etc/prometheus/prometheus.yml'
- '--storage.tsdb.path=/prometheus'
- '--storage.tsdb.retention.time=15d'
- '--storage.tsdb.retention.size=10GB'
- '--web.console.libraries=/usr/share/prometheus/console_libraries'
- '--web.console.templates=/usr/share/prometheus/consoles'
- '--web.enable-lifecycle'
volumes:
- type: bind
source: ./monitoring/prometheus.yml
target: /etc/prometheus/prometheus.yml
read_only: true
- type: volume
source: prometheus-data
target: /prometheus
ports:
- "${PROMETHEUS_PORT:-9091}:9090"
networks:
- strada-network
depends_on:
- strada-brain
# ===========================================================================
# Grafana - Visualization (Optional)
# ===========================================================================
grafana:
image: grafana/grafana:11.3.0
container_name: strada-grafana
hostname: grafana
restart: unless-stopped
profiles:
- monitoring
environment:
- GF_SECURITY_ADMIN_USER=${GRAFANA_ADMIN_USER:-admin}
- GF_SECURITY_ADMIN_PASSWORD=${GRAFANA_ADMIN_PASSWORD:?GRAFANA_ADMIN_PASSWORD must be set - do not use default passwords in production}
- GF_USERS_ALLOW_SIGN_UP=false
- GF_SERVER_ROOT_URL=${GRAFANA_ROOT_URL:-http://localhost:3000}
volumes:
- type: volume
source: grafana-data
target: /var/lib/grafana
- type: bind
source: ./grafana-dashboard.json
target: /etc/grafana/provisioning/dashboards/strada-dashboard.json
read_only: true
- type: bind
source: ./monitoring/grafana-datasource.yml
target: /etc/grafana/provisioning/datasources/prometheus.yml
read_only: true
ports:
- "${GRAFANA_PORT:-3000}:3000"
networks:
- strada-network
depends_on:
- prometheus
# =============================================================================
# Volumes
# =============================================================================
volumes:
strada-memory:
driver: local
strada-logs:
driver: local
redis-data:
driver: local
nginx-cache:
driver: local
letsencrypt-data:
driver: local
prometheus-data:
driver: local
grafana-data:
driver: local
# =============================================================================
# Networks
# =============================================================================
networks:
strada-network:
driver: bridge
ipam:
config:
- subnet: 172.20.0.0/16