-
Notifications
You must be signed in to change notification settings - Fork 13
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
273 lines (260 loc) · 8.1 KB
/
docker-compose.yml
File metadata and controls
273 lines (260 loc) · 8.1 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
version: '3.9'
services:
# PostgreSQL with TimescaleDB
postgres:
image: timescale/timescaledb:latest-pg16
container_name: aim-postgres
environment:
POSTGRES_DB: ${POSTGRES_DB:-identity}
POSTGRES_USER: ${POSTGRES_USER:-postgres}
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-postgres}
PGDATA: /var/lib/postgresql/data/pgdata
ports:
- "127.0.0.1:5432:5432"
volumes:
- postgres_data:/var/lib/postgresql/data
healthcheck:
test: ["CMD-SHELL", "pg_isready -U postgres -d identity"]
interval: 10s
timeout: 5s
retries: 5
networks:
- aim-network
# Redis Cache
redis:
image: redis:7-alpine
container_name: aim-redis
command: redis-server --requirepass ${REDIS_PASSWORD:-redis_dev_password}
ports:
- "127.0.0.1:6379:6379"
volumes:
- redis_data:/data
healthcheck:
test: ["CMD", "redis-cli", "ping"]
interval: 10s
timeout: 5s
retries: 5
networks:
- aim-network
# Elasticsearch for audit logs and search
elasticsearch:
image: docker.elastic.co/elasticsearch/elasticsearch:8.12.0
container_name: aim-elasticsearch
environment:
- discovery.type=single-node
- xpack.security.enabled=false
- "ES_JAVA_OPTS=-Xms512m -Xmx512m"
ports:
- "127.0.0.1:9200:9200"
- "127.0.0.1:9300:9300"
volumes:
- elasticsearch_data:/usr/share/elasticsearch/data
healthcheck:
test: ["CMD-SHELL", "curl -f http://localhost:9200/_cluster/health || exit 1"]
interval: 30s
timeout: 10s
retries: 5
networks:
- aim-network
# MinIO for object storage (certificates, documents)
minio:
image: minio/minio:latest
container_name: aim-minio
command: server /data --console-address ":9001"
environment:
MINIO_ROOT_USER: ${MINIO_ROOT_USER:-aim_minio_user}
MINIO_ROOT_PASSWORD: ${MINIO_ROOT_PASSWORD:-aim_minio_password_dev}
ports:
- "127.0.0.1:9000:9000"
- "127.0.0.1:9001:9001"
volumes:
- minio_data:/data
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:9000/minio/health/live"]
interval: 30s
timeout: 20s
retries: 3
networks:
- aim-network
# NATS JetStream for messaging
nats:
image: nats:2-alpine
container_name: aim-nats
command: "--jetstream --store_dir=/data"
ports:
- "127.0.0.1:4222:4222"
- "127.0.0.1:8222:8222"
volumes:
- nats_data:/data
healthcheck:
test: ["CMD", "wget", "--spider", "-q", "http://localhost:8222/healthz"]
interval: 10s
timeout: 5s
retries: 5
networks:
- aim-network
# Prometheus for metrics collection
prometheus:
image: prom/prometheus:latest
container_name: aim-prometheus
command:
- '--config.file=/etc/prometheus/prometheus.yml'
- '--storage.tsdb.path=/prometheus'
- '--web.console.libraries=/usr/share/prometheus/console_libraries'
- '--web.console.templates=/usr/share/prometheus/consoles'
ports:
- "127.0.0.1:9090:9090"
volumes:
- ./infrastructure/monitoring/prometheus.yml:/etc/prometheus/prometheus.yml
- prometheus_data:/prometheus
healthcheck:
test: ["CMD", "wget", "--spider", "-q", "http://localhost:9090/-/healthy"]
interval: 10s
timeout: 5s
retries: 5
networks:
- aim-network
# Grafana for metrics visualization
grafana:
image: grafana/grafana:latest
container_name: aim-grafana
environment:
- GF_SECURITY_ADMIN_USER=${GRAFANA_ADMIN_USER:-admin}
- GF_SECURITY_ADMIN_PASSWORD=${GRAFANA_ADMIN_PASSWORD:-admin}
- GF_USERS_ALLOW_SIGN_UP=false
- GF_SERVER_ROOT_URL=http://localhost:3003
ports:
- "127.0.0.1:3003:3000"
volumes:
- ./infrastructure/monitoring/grafana/provisioning:/etc/grafana/provisioning
- ./infrastructure/monitoring/grafana/dashboards:/var/lib/grafana/dashboards
- grafana_data:/var/lib/grafana
depends_on:
- prometheus
healthcheck:
test: ["CMD", "wget", "--spider", "-q", "http://localhost:3000/api/health"]
interval: 10s
timeout: 5s
retries: 5
networks:
- aim-network
# Loki for log aggregation
loki:
image: grafana/loki:latest
container_name: aim-loki
command: -config.file=/etc/loki/local-config.yaml
ports:
- "127.0.0.1:3100:3100"
volumes:
- ./infrastructure/monitoring/loki.yml:/etc/loki/local-config.yaml
- loki_data:/loki
healthcheck:
test: ["CMD", "wget", "--spider", "-q", "http://localhost:3100/ready"]
interval: 10s
timeout: 5s
retries: 5
networks:
- aim-network
# Promtail for log collection
promtail:
image: grafana/promtail:latest
container_name: aim-promtail
command: -config.file=/etc/promtail/config.yml
volumes:
- ./infrastructure/monitoring/promtail.yml:/etc/promtail/config.yml
- /var/log:/var/log:ro
- promtail_data:/promtail
depends_on:
- loki
networks:
- aim-network
# Backend API Service
backend:
image: ghcr.io/opena2a-org/aim-server:latest
build:
context: .
dockerfile: infrastructure/docker/Dockerfile.backend
container_name: aim-backend
environment:
# Database Configuration (connects to postgres service)
- POSTGRES_HOST=postgres
- POSTGRES_PORT=5432
- POSTGRES_USER=${POSTGRES_USER:-postgres}
- POSTGRES_PASSWORD=${POSTGRES_PASSWORD:-postgres}
- POSTGRES_DB=${POSTGRES_DB:-identity}
- POSTGRES_SSL_MODE=${POSTGRES_SSL_MODE:-disable}
# Redis Configuration (connects to redis service)
- REDIS_HOST=redis
- REDIS_PORT=6379
- REDIS_PASSWORD=${REDIS_PASSWORD:-redis_dev_password}
# Security Configuration
# WARNING: Default secrets are for LOCAL DEVELOPMENT ONLY
# For production: Generate your own with openssl rand -hex 32 (JWT) / openssl rand -base64 32 (KEYVAULT)
# The backend will refuse to start in production mode with default secrets
- JWT_SECRET=${JWT_SECRET:-dev-only-jwt-secret-do-not-use-in-production-abc123}
- KEYVAULT_MASTER_KEY=${KEYVAULT_MASTER_KEY:-XfnA4gOf872btnIv8pMyaTBu0bpi4AfbAFDfisQBUt0=}
# Email Configuration (optional - platform works without email)
- EMAIL_FROM_ADDRESS=${EMAIL_FROM_ADDRESS:-noreply@localhost}
- SMTP_HOST=${SMTP_HOST:-}
- SMTP_PORT=${SMTP_PORT:-587}
- SMTP_USERNAME=${SMTP_USERNAME:-}
- SMTP_PASSWORD=${SMTP_PASSWORD:-}
# Frontend URL for CORS and links
- FRONTEND_URL=${FRONTEND_URL:-http://localhost:3000}
- ALLOWED_ORIGINS=${ALLOWED_ORIGINS:-http://localhost:3000}
# Admin user configuration (optional - override default admin password)
- ADMIN_EMAIL=${ADMIN_EMAIL:-admin@opena2a.org}
- ADMIN_PASSWORD=${ADMIN_PASSWORD:-}
# Environment (defaults to development for docker-compose; set ENVIRONMENT=production for production)
- ENVIRONMENT=${ENVIRONMENT:-development}
ports:
- "8080:8080"
depends_on:
postgres:
condition: service_healthy
redis:
condition: service_healthy
healthcheck:
test: ["CMD", "wget", "--no-verbose", "--tries=1", "--spider", "http://127.0.0.1:8080/health"]
interval: 10s
timeout: 5s
retries: 5
restart: unless-stopped
networks:
- aim-network
# Frontend Web Application
frontend:
image: ghcr.io/opena2a-org/aim-dashboard:latest
build:
context: .
dockerfile: infrastructure/docker/Dockerfile.frontend
container_name: aim-frontend
environment:
- NEXT_PUBLIC_API_URL=http://localhost:8080
- NODE_ENV=production
ports:
- "3000:3000"
depends_on:
backend:
condition: service_healthy
healthcheck:
test: ["CMD", "wget", "--no-verbose", "--tries=1", "--spider", "http://0.0.0.0:3000"]
interval: 10s
timeout: 5s
retries: 5
restart: unless-stopped
networks:
- aim-network
volumes:
postgres_data:
redis_data:
elasticsearch_data:
minio_data:
nats_data:
prometheus_data:
grafana_data:
loki_data:
promtail_data:
networks:
aim-network:
driver: bridge