-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
372 lines (357 loc) · 8.92 KB
/
docker-compose.yml
File metadata and controls
372 lines (357 loc) · 8.92 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
networks:
office_network:
driver: bridge
ipam:
config:
- subnet: 172.20.0.0/16
volumes:
postgres_data:
redis_data:
rabbitmq_data:
minio_data:
grafana_data:
prometheus_data:
loki_data:
promtail_data:
weaviate_data:
elasticsearch_data:
# 中间件组 - 只保留使用官方镜像的服务
services:
# PostgreSQL数据库
postgres:
image: postgres:15
container_name: office_assistant_postgres
networks: [office_network]
volumes:
- postgres_data:/var/lib/postgresql/data
environment:
- POSTGRES_USER=office_user
- POSTGRES_PASSWORD=office_password
- POSTGRES_DB=office_assistant
- POSTGRES_LOGGING_COLLECTOR=on
- POSTGRES_LOG_DESTINATION=stderr
- POSTGRES_LOG_FORMAT=json
ports:
- "5432:5432"
restart: unless-stopped
healthcheck:
test: ["CMD-SHELL", "pg_isready -U office_user -d office_assistant"]
interval: 10s
timeout: 5s
retries: 3
logging:
driver: "json-file"
options:
max-size: "10m"
max-file: "5"
compress: "true"
# Redis缓存
redis:
image: redis:7
container_name: office_assistant_redis
networks: [office_network]
volumes:
- redis_data:/data
ports:
- "6379:6379"
restart: unless-stopped
command: ["redis-server", "--appendonly", "yes", "--loglevel", "notice"]
healthcheck:
test: ["CMD", "redis-cli", "ping"]
interval: 10s
timeout: 5s
retries: 3
logging:
driver: "json-file"
options:
max-size: "10m"
max-file: "5"
compress: "true"
# RabbitMQ消息队列
rabbitmq:
image: rabbitmq:3.12-management
container_name: office_assistant_rabbitmq
networks: [office_network]
volumes:
- rabbitmq_data:/var/lib/rabbitmq
environment:
- RABBITMQ_DEFAULT_USER=rabbitmq_user
- RABBITMQ_DEFAULT_PASS=rabbitmq_password
- RABBITMQ_DEFAULT_VHOST=office_assistant
- RABBITMQ_LOGS=-
- RABBITMQ_SASL_LOGS=-
ports:
- "5672:5672"
- "15672:15672"
restart: unless-stopped
healthcheck:
test: ["CMD", "rabbitmq-diagnostics", "ping"]
interval: 10s
timeout: 5s
retries: 3
logging:
driver: "json-file"
options:
max-size: "10m"
max-file: "5"
compress: "true"
# MinIO对象存储
minio:
image: minio/minio:latest
container_name: office_assistant_minio
networks: [office_network]
volumes:
- minio_data:/data
environment:
- MINIO_ROOT_USER=minio_user
- MINIO_ROOT_PASSWORD=minio_password
- MINIO_LOG_LEVEL=info
- MINIO_LOG_FORMAT=json
command: server /data --console-address :9001
ports:
- "9000:9000"
- "9001:9001"
restart: unless-stopped
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:9000/minio/health/live"]
interval: 10s
timeout: 5s
retries: 3
logging:
driver: "json-file"
options:
max-size: "10m"
max-file: "5"
compress: "true"
# Weaviate向量数据库
weaviate:
image: semitechnologies/weaviate:latest
container_name: office_assistant_weaviate
networks: [office_network]
volumes:
- ./backend/data/weaviate:/var/lib/weaviate # 将向量数据库数据持久化到本地目录
environment:
- AUTHENTICATION_ANONYMOUS_ACCESS_ENABLED=true
- PERSISTENCE_DATA_PATH=/var/lib/weaviate
- DEFAULT_VECTORIZER_MODULE=none
- ENABLE_MODULES=text2vec-openai
- CLUSTER_DISABLED=true
ports:
- "8080:8080"
- "50051:50051"
restart: unless-stopped
healthcheck:
test: ["CMD", "wget", "--spider", "-q", "http://localhost:8080/v1/.well-known/ready"]
interval: 10s
timeout: 5s
retries: 3
logging:
driver: "json-file"
options:
max-size: "10m"
max-file: "5"
compress: "true"
# Elasticsearch 全文检索引擎
elasticsearch:
image: elasticsearch:8.12.0
container_name: office_assistant_elasticsearch
networks: [office_network]
environment:
- discovery.type=single-node
- xpack.security.enabled=false
- "ES_JAVA_OPTS=-Xms512m -Xmx512m"
ports:
- "9200:9200"
- "9300:9300"
volumes:
- elasticsearch_data:/usr/share/elasticsearch/data
restart: unless-stopped
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:9200"]
interval: 10s
timeout: 5s
retries: 3
logging:
driver: "json-file"
options:
max-size: "10m"
max-file: "5"
compress: "true"
# Kibana 数据可视化
kibana:
image: kibana:8.12.0
container_name: office_assistant_kibana
networks: [office_network]
ports:
- "5601:5601"
environment:
- ELASTICSEARCH_HOSTS=http://elasticsearch:9200
depends_on:
- elasticsearch
restart: unless-stopped
logging:
driver: "json-file"
options:
max-size: "10m"
max-file: "5"
compress: "true"
# Prometheus监控
prometheus:
image: prom/prometheus:latest
container_name: office_assistant_prometheus
networks: [office_network]
volumes:
- prometheus_data:/prometheus
ports:
- "9090:9090"
restart: unless-stopped
healthcheck:
test: ["CMD", "wget", "--spider", "-q", "http://localhost:9090"]
interval: 10s
timeout: 5s
retries: 3
logging:
driver: "json-file"
options:
max-size: "10m"
max-file: "5"
compress: "true"
# Loki日志收集系统
loki:
image: grafana/loki:latest
container_name: office_assistant_loki
networks: [office_network]
volumes:
- loki_data:/loki
ports:
- "3100:3100"
restart: unless-stopped
command: -config.file=/etc/loki/local-config.yaml
# 移除健康检查,因为容器内没有可用的网络工具
logging:
driver: "json-file"
options:
max-size: "10m"
max-file: "5"
compress: "true"
# Promtail日志代理
promtail:
image: grafana/promtail:latest
container_name: office_assistant_promtail
networks: [office_network]
volumes:
- promtail_data:/promtail
- /var/run/docker.sock:/var/run/docker.sock
- /var/lib/docker/containers:/var/lib/docker/containers:ro
depends_on:
- loki
restart: unless-stopped
command: -config.file=/etc/promtail/config.yml
# 移除健康检查,因为容器内没有可用的网络工具
logging:
driver: "json-file"
options:
max-size: "10m"
max-file: "5"
compress: "true"
# Grafana可视化
grafana:
image: grafana/grafana:latest
container_name: office_assistant_grafana
networks: [office_network]
volumes:
- grafana_data:/var/lib/grafana
depends_on:
- prometheus
- loki
environment:
- GF_SECURITY_ADMIN_USER=admin
- GF_SECURITY_ADMIN_PASSWORD=admin_password
- GF_PATHS_PROVISIONING=/etc/grafana/provisioning
ports:
- "3001:3000"
restart: unless-stopped
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:3000/login"]
interval: 10s
timeout: 5s
retries: 3
logging:
driver: "json-file"
options:
max-size: "10m"
max-file: "5"
compress: "true"
# 后端 API 服务
backend:
build:
context: ./backend
dockerfile: Dockerfile
container_name: office_assistant_backend
networks: [office_network]
depends_on:
postgres:
condition: service_healthy
redis:
condition: service_healthy
rabbitmq:
condition: service_healthy
minio:
condition: service_healthy
extra_hosts:
- "host.docker.internal:host-gateway"
env_file:
- .env
volumes:
- ./backend/data:/app/data
- ./backend/logs:/app/logs
ports:
- "8000:8000"
restart: unless-stopped
logging:
driver: "json-file"
options:
max-size: "10m"
max-file: "5"
compress: "true"
# 前端应用服务
frontend:
build:
context: ./frontend
dockerfile: Dockerfile
args:
NEXT_PUBLIC_API_BASE: ${NEXT_PUBLIC_API_BASE}
container_name: office_assistant_frontend
networks: [office_network]
depends_on:
- backend
env_file:
- .env
ports:
- "3000:3000"
restart: unless-stopped
logging:
driver: "json-file"
options:
max-size: "10m"
max-file: "5"
compress: "true"
# Nginx 反向代理
nginx:
image: nginx:stable-alpine
container_name: office_assistant_nginx
networks: [office_network]
volumes:
- ./nginx/nginx.conf:/etc/nginx/nginx.conf:ro
ports:
- "80:80"
depends_on:
- frontend
- backend
restart: unless-stopped
logging:
driver: "json-file"
options:
max-size: "10m"
max-file: "5"
compress: "true"