-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.yaml
More file actions
325 lines (314 loc) · 9.4 KB
/
docker-compose.yaml
File metadata and controls
325 lines (314 loc) · 9.4 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
services:
# ===========================================
# 메인 애플리케이션 (Multi-Agent Chatbot)
# ===========================================
app:
build:
context: .
dockerfile: Dockerfile
container_name: multi-agent-chatbot-app
ports:
- "8000:8000"
depends_on:
redis:
condition: service_healthy
elasticsearch:
condition: service_healthy
chroma:
condition: service_started
env_file:
- .env
environment:
# Docker 내부 서비스 호스트명으로 오버라이드
# Using local MySQL instead of Docker MySQL
# - DATABASE_URL=mysql://${MYSQL_USER}:${MYSQL_PASSWORD}@mysql:3306/${MYSQL_DATABASE}
- REDIS_HOST=redis
- REDIS_PORT=6379
- CHROMA_HOST=chroma
- CHROMA_PORT=8000
- ELASTICSEARCH_HOST=elasticsearch
- ELASTICSEARCH_PORT=9200
- PYTHONPATH=/app
- ENVIRONMENT=production
volumes:
- ./logs:/app/logs
- ./data:/app/data
- ./backups:/app/backups
- chatbot_embeddings:/app/data/embeddings
networks:
- chatbot-network
restart: unless-stopped
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:8000/health"]
interval: 30s
timeout: 10s
retries: 5
start_period: 60s
# ===========================================
# MySQL 데이터베이스 (로컬 MySQL 사용으로 주석처리)
# ===========================================
# mysql:
# image: mysql:8.0
# container_name: multi-agent-mysql
# ports:
# - "3306:3306"
# env_file:
# - .env
# environment:
# - MYSQL_ROOT_PASSWORD=${MYSQL_ROOT_PASSWORD}
# - MYSQL_DATABASE=${MYSQL_DATABASE}
# - MYSQL_USER=${MYSQL_USER}
# - MYSQL_PASSWORD=${MYSQL_PASSWORD}
# - MYSQL_CHARACTER_SET_SERVER=utf8mb4
# - MYSQL_COLLATION_SERVER=utf8mb4_unicode_ci
# volumes:
# - mysql_data:/var/lib/mysql
# - ./scripts/init-mysql.sql:/docker-entrypoint-initdb.d/init.sql:ro
# networks:
# - chatbot-network
# restart: unless-stopped
# command: >
# --default-authentication-plugin=mysql_native_password
# --character-set-server=utf8mb4
# --collation-server=utf8mb4_unicode_ci
# --sql-mode=STRICT_TRANS_TABLES,NO_ZERO_DATE,NO_ZERO_IN_DATE,ERROR_FOR_DIVISION_BY_ZERO
# healthcheck:
# test: ["CMD", "mysqladmin", "ping", "-h", "localhost", "-u", "${MYSQL_USER}", "-p${MYSQL_PASSWORD}"]
# interval: 30s
# timeout: 10s
# retries: 5
# start_period: 60s
# ===========================================
# Redis (세션 관리 및 캐시)
# ===========================================
redis:
image: redis:7-alpine
container_name: multi-agent-redis
ports:
- "6379:6379"
volumes:
- redis_data:/data
# - ./config/redis.conf:/usr/local/etc/redis/redis.conf:ro
networks:
- chatbot-network
restart: unless-stopped
command: redis-server
healthcheck:
test: ["CMD", "redis-cli", "ping"]
interval: 30s
timeout: 10s
retries: 3
start_period: 30s
# ===========================================
# Elasticsearch (검색 엔진)
# ===========================================
elasticsearch:
image: elasticsearch:8.11.0
container_name: multi-agent-elasticsearch
ports:
- "9200:9200"
- "9300:9300"
environment:
- node.name=elasticsearch-node
- cluster.name=chatbot-cluster
- discovery.type=single-node
- bootstrap.memory_lock=true
- xpack.security.enabled=false
- xpack.security.enrollment.enabled=false
- "ES_JAVA_OPTS=-Xms1g -Xmx1g"
volumes:
- elasticsearch_data:/usr/share/elasticsearch/data
- ./config/elasticsearch.yml:/usr/share/elasticsearch/config/elasticsearch.yml:ro
networks:
- chatbot-network
restart: unless-stopped
ulimits:
memlock:
soft: -1
hard: -1
healthcheck:
test: ["CMD-SHELL", "curl -f http://localhost:9200/_cluster/health?wait_for_status=green&timeout=1s || exit 1"]
interval: 30s
timeout: 10s
retries: 5
start_period: 60s
# ===========================================
# ChromaDB (벡터 데이터베이스)
# ===========================================
chroma:
image: chromadb/chroma:latest
container_name: multi-agent-chroma
ports:
- "8001:8000"
environment:
- CHROMA_SERVER_HOST=0.0.0.0
- CHROMA_SERVER_HTTP_PORT=8000
- CHROMA_SERVER_CORS_ALLOW_ORIGINS=["*"]
- ANONYMIZED_TELEMETRY=False
- ALLOW_RESET=True
volumes:
- chroma_data:/chroma/chroma
- ./data/embeddings:/app/embeddings
networks:
- chatbot-network
restart: unless-stopped
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:8000/api/v1/version"]
interval: 30s
timeout: 10s
retries: 3
start_period: 30s
# ===========================================
# Zookeeper (Kafka 의존성)
# ===========================================
zookeeper:
image: confluentinc/cp-zookeeper:7.4.0
container_name: multi-agent-zookeeper
ports:
- "2181:2181"
environment:
ZOOKEEPER_CLIENT_PORT: 2181
ZOOKEEPER_TICK_TIME: 2000
volumes:
- zookeeper_data:/var/lib/zookeeper/data
- zookeeper_log:/var/lib/zookeeper/log
networks:
- chatbot-network
restart: unless-stopped
healthcheck:
test: ["CMD", "bash", "-c", "echo 'ruok' | nc localhost 2181"]
interval: 10s
timeout: 5s
retries: 5
# ===========================================
# Kafka (CDC 및 이벤트 스트리밍)
# ===========================================
kafka:
image: confluentinc/cp-kafka:7.4.0
container_name: multi-agent-kafka
depends_on:
zookeeper:
condition: service_healthy
ports:
- "9092:9092"
- "9101:9101"
environment:
KAFKA_BROKER_ID: 1
KAFKA_ZOOKEEPER_CONNECT: 'zookeeper:2181'
KAFKA_LISTENER_SECURITY_PROTOCOL_MAP: PLAINTEXT:PLAINTEXT,PLAINTEXT_HOST:PLAINTEXT
KAFKA_ADVERTISED_LISTENERS: PLAINTEXT://kafka:29092,PLAINTEXT_HOST://localhost:9092
KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR: 1
KAFKA_TRANSACTION_STATE_LOG_MIN_ISR: 1
KAFKA_TRANSACTION_STATE_LOG_REPLICATION_FACTOR: 1
KAFKA_GROUP_INITIAL_REBALANCE_DELAY_MS: 0
KAFKA_JMX_PORT: 9101
KAFKA_JMX_HOSTNAME: localhost
KAFKA_AUTO_CREATE_TOPICS_ENABLE: 'true'
volumes:
- kafka_data:/var/lib/kafka/data
networks:
- chatbot-network
restart: unless-stopped
healthcheck:
test: ["CMD", "bash", "-c", "kafka-broker-api-versions --bootstrap-server localhost:9092"]
interval: 30s
timeout: 10s
retries: 5
start_period: 60s
# ===========================================
# 선택사항: Nginx (리버스 프록시)
# ===========================================
nginx:
image: nginx:alpine
container_name: multi-agent-nginx
ports:
- "80:80"
- "443:443"
volumes:
- ./config/nginx.conf:/etc/nginx/nginx.conf:ro
- ./ssl:/etc/nginx/ssl:ro
depends_on:
- app
networks:
- chatbot-network
restart: unless-stopped
profiles:
- production # docker-compose --profile production up 으로 실행시에만 시작
# ===========================================
# 선택사항: Prometheus (모니터링)
# ===========================================
prometheus:
image: prom/prometheus:latest
container_name: multi-agent-prometheus
ports:
- "9090:9090"
volumes:
- ./config/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'
networks:
- chatbot-network
restart: unless-stopped
profiles:
- monitoring
# ===========================================
# 선택사항: Grafana (대시보드)
# ===========================================
grafana:
image: grafana/grafana:latest
container_name: multi-agent-grafana
ports:
- "3000:3000"
environment:
- GF_SECURITY_ADMIN_USER=admin
- GF_SECURITY_ADMIN_PASSWORD=grafana123
volumes:
- grafana_data:/var/lib/grafana
- ./config/grafana/datasources:/etc/grafana/provisioning/datasources
- ./config/grafana/dashboards:/etc/grafana/provisioning/dashboards
depends_on:
- prometheus
networks:
- chatbot-network
restart: unless-stopped
profiles:
- monitoring
# ===========================================
# 네트워크 설정
# ===========================================
networks:
chatbot-network:
driver: bridge
ipam:
config:
- subnet: 172.20.0.0/16
# ===========================================
# 볼륨 설정 (데이터 지속성)
# ===========================================
volumes:
mysql_data:
driver: local
redis_data:
driver: local
elasticsearch_data:
driver: local
chroma_data:
driver: local
chatbot_embeddings:
driver: local
prometheus_data:
driver: local
grafana_data:
driver: local
zookeeper_data:
driver: local
zookeeper_log:
driver: local
kafka_data:
driver: local