-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
175 lines (166 loc) · 4.85 KB
/
Copy pathdocker-compose.yml
File metadata and controls
175 lines (166 loc) · 4.85 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
version: '3.8'
# ===========================================
# MuuAgent AI 中台 Docker 编排
# ===========================================
#
# 快速启动:
# docker-compose up -d
#
# 首次部署需初始化数据库:
# docker-compose exec app npx prisma migrate deploy
#
# 环境变量配置:
# 创建 .env 文件(基于 service/.env.example)或使用下方默认值
# ===========================================
x-common: &common
networks:
- muu_agent_network
restart: unless-stopped
services:
# ===========================================
# MySQL 数据库
# ===========================================
mysql:
image: mysql:8.0
container_name: muu_agent_mysql
<<: *common
environment:
MYSQL_ROOT_PASSWORD: ${MYSQL_ROOT_PASSWORD:-Root_Pass_2026}
MYSQL_DATABASE: muu_agent_platform
MYSQL_USER: muu_agent
MYSQL_PASSWORD: ${MYSQL_PASSWORD:-MuAgent_2026_Prod_Pass}
ports:
- "${MYSQL_PORT:-3306}:3306"
volumes:
- mysql_data:/var/lib/mysql
- ./deploy/mysql/init:/docker-entrypoint-initdb.d
- ./deploy/mysql/conf.d:/etc/mysql/conf.d
command:
--default-authentication-plugin=mysql_native_password
--character-set-server=utf8mb4
--collation-server=utf8mb4_unicode_ci
--max-connections=1000
--innodb-buffer-pool-size=1G
--innodb-log-file-size=256M
healthcheck:
test: ["CMD", "mysqladmin", "ping", "-h", "localhost", "-u", "root", "-p${MYSQL_ROOT_PASSWORD:-Root_Pass_2026}"]
interval: 10s
timeout: 5s
retries: 5
start_period: 30s
# ===========================================
# Redis 缓存(用于限流、缓存、任务队列)
# ===========================================
redis:
image: redis:7-alpine
container_name: muu_agent_redis
<<: *common
ports:
- "${REDIS_PORT:-6379}:6379"
volumes:
- redis_data:/data
command: redis-server --appendonly yes --maxmemory 512mb --maxmemory-policy allkeys-lru
healthcheck:
test: ["CMD", "redis-cli", "ping"]
interval: 10s
timeout: 3s
retries: 5
# ===========================================
# Qdrant 向量数据库(用于知识库向量检索)
# ===========================================
qdrant:
image: qdrant/qdrant:latest
container_name: muu_agent_qdrant
<<: *common
ports:
- "${QDRANT_PORT:-6333}:6333"
- "${QDRANT_GRPC_PORT:-6334}:6334"
volumes:
- qdrant_data:/qdrant/storage
environment:
QDRANT__SERVICE__GRPC_PORT: 6334
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:6333/healthz"]
interval: 10s
timeout: 5s
retries: 5
start_period: 10s
# ===========================================
# AI 中台服务(NestJS)
# ===========================================
app:
build:
context: .
dockerfile: Dockerfile
args:
VITE_API_BASE_URL: ${VITE_API_BASE_URL:-}
VITE_WS_URL: ${VITE_WS_URL:-}
container_name: muu_agent_service
<<: *common
ports:
- "${APP_PORT:-3002}:3002"
env_file:
- ${ENV_FILE:-./service/.env}
environment:
# Docker 环境覆盖:确保容器内端口一致
PORT: 3002
# 数据库和缓存使用容器内地址
DATABASE_URL: mysql://muu_agent:${MYSQL_PASSWORD:-MuAgent_2026_Prod_Pass}@mysql:3306/muu_agent_platform?connection_limit=10&pool_timeout=30
REDIS_URL: redis://redis:6379
VECTOR_DB_HOST: qdrant
VECTOR_DB_PORT: 6333
VECTOR_DB_URL: http://qdrant:6333
NODE_ENV: production
volumes:
- app_uploads:/app/uploads
depends_on:
mysql:
condition: service_healthy
redis:
condition: service_healthy
qdrant:
condition: service_healthy
healthcheck:
test: ["CMD", "wget", "--no-verbose", "--tries=1", "--spider", "http://localhost:3002/health"]
interval: 30s
timeout: 10s
retries: 3
start_period: 60s
deploy:
resources:
limits:
memory: ${APP_MEMORY_LIMIT:-2G}
reservations:
memory: ${APP_MEMORY_RESERVATION:-512M}
# ===========================================
# Nginx 反向代理(可选,用于 HTTPS 和域名访问)
# ===========================================
nginx:
image: nginx:alpine
container_name: muu_agent_nginx
<<: *common
ports:
- "${NGINX_HTTP_PORT:-80}:80"
- "${NGINX_HTTPS_PORT:-443}:443"
volumes:
- ./deploy/nginx/nginx.conf:/etc/nginx/nginx.conf:ro
- ./deploy/nginx/ssl:/etc/nginx/ssl:ro
depends_on:
app:
condition: service_healthy
deploy:
resources:
limits:
memory: 256M
volumes:
mysql_data:
driver: local
redis_data:
driver: local
qdrant_data:
driver: local
app_uploads:
driver: local
networks:
muu_agent_network:
driver: bridge