-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
173 lines (166 loc) · 4.76 KB
/
docker-compose.yml
File metadata and controls
173 lines (166 loc) · 4.76 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
version: "3.8"
services:
# PostgreSQL 数据库
postgres:
image: postgres:17-alpine
container_name: itsm-postgres
hostname: postgres
environment:
POSTGRES_DB: itsm
POSTGRES_USER: itsm
# WARNING: Change this password before deploying! This default is for local dev only.
POSTGRES_PASSWORD: itsm_password_2026
ports:
- "5432:5432"
volumes:
- postgres_data:/var/lib/postgresql/data
networks:
- itsm-network
healthcheck:
test: [ "CMD-SHELL", "pg_isready -U itsm -d itsm" ]
interval: 10s
timeout: 5s
retries: 5
restart: unless-stopped
# Redis 缓存
redis:
image: redis:7-alpine
container_name: itsm-redis
hostname: redis
ports:
- "6379:6379"
volumes:
- redis_data:/data
networks:
- itsm-network
healthcheck:
test: [ "CMD", "redis-cli", "ping" ]
interval: 10s
timeout: 3s
retries: 5
restart: unless-stopped
# ITSM AI Service (独立 Python 微服务)
itsm-ai-service:
build:
context: ./itsm-ai-service
dockerfile: Dockerfile
container_name: itsm-ai-service
hostname: ai-service
environment:
- PYTHONUNBUFFERED=1
- ITSM_AI_CONFIG=/app/config.yaml
- ITSM_BACKEND_URL=http://itsm-backend:8090
# LLM 配置
- LLM_PROVIDER=${LLM_PROVIDER:-openai}
- LLM_API_KEY=${LLM_API_KEY:-}
- LLM_MODEL=${LLM_MODEL:-gpt-4o-mini}
# 取消代理设置
- HTTP_PROXY=
- HTTPS_PROXY=
- http_proxy=
- https_proxy=
- NO_PROXY=localhost,127.0.0.1,ai-service,backend
- no_proxy=localhost,127.0.0.1,ai-service,backend
ports:
- "8000:8000"
depends_on:
- itsm-backend
networks:
- itsm-network
restart: unless-stopped
healthcheck:
test: ["CMD", "python", "-c", "import httpx; httpx.get('http://localhost:8000/health').raise_for_status()"]
interval: 30s
timeout: 10s
retries: 3
# ITSM 后端服务
itsm-backend:
build:
context: ./itsm-backend
dockerfile: Dockerfile
args:
- GOPROXY=${GOPROXY:-https://proxy.golang.org,direct}
- GOSUMDB=${GOSUMDB:-sum.golang.org}
- HTTP_PROXY=
- HTTPS_PROXY=
- http_proxy=
- https_proxy=
- no_proxy=localhost,127.0.0.1
container_name: itsm-backend
hostname: backend
environment:
# WARNING: Change DB_PASSWORD before deploying! This default is for local dev only.
- DATABASE_URL=postgres://itsm:${DB_PASSWORD:-itsm_password_2026}@postgres:5432/itsm?sslmode=disable
- DB_HOST=postgres
- DB_PORT=5432
- DB_USER=itsm
# WARNING: Change DB_PASSWORD before deploying! This default is for local dev only.
- DB_PASSWORD=${DB_PASSWORD:-itsm_password_2026}
- DB_NAME=itsm
- DB_SSLMODE=disable
- REDIS_HOST=redis
- REDIS_PORT=6379
- REDIS_PASSWORD=${REDIS_PASSWORD:-}
- REDIS_DB=0
# WARNING: Change JWT_SECRET before deploying! This default is for local dev only.
- JWT_SECRET=${JWT_SECRET:-dev-secret-key-placeholder-change-in-production-min-32-chars}
- SERVER_MODE=release
- LOG_LEVEL=info
- GIN_MODE=release
# WARNING: ITSM_ALLOW_ALL_ORIGINS=true is for local dev only! Set proper CORS in production.
- ITSM_ALLOW_ALL_ORIGINS=true
# 取消代理设置,确保内部网络请求不走代理
- HTTP_PROXY=
- HTTPS_PROXY=
- http_proxy=
- https_proxy=
- NO_PROXY=localhost,127.0.0.1,backend,postgres,redis
- no_proxy=localhost,127.0.0.1,backend,postgres,redis
ports:
- "8090:8090"
depends_on:
postgres:
condition: service_healthy
redis:
condition: service_healthy
networks:
- itsm-network
volumes:
- ./logs:/app/logs
restart: unless-stopped
healthcheck:
test: [ "CMD", "wget", "--no-verbose", "--tries=1", "--spider", "http://localhost:8090/api/v1/health" ]
interval: 30s
timeout: 10s
retries: 3
# ITSM 前端服务
itsm-frontend:
build:
context: ./itsm-frontend
dockerfile: Dockerfile
target: production
container_name: itsm-frontend
hostname: frontend
environment:
- NODE_ENV=production
- NEXT_PUBLIC_API_URL=http://itsm-backend:8090
# 取消代理设置,确保内部网络请求不走代理
- HTTP_PROXY=
- HTTPS_PROXY=
- http_proxy=
- https_proxy=
- NO_PROXY=localhost,127.0.0.1,backend,postgres,redis
- no_proxy=localhost,127.0.0.1,backend,postgres,redis
ports:
- "3000:3000"
depends_on:
- itsm-backend
networks:
- itsm-network
restart: unless-stopped
networks:
itsm-network:
driver: bridge
volumes:
postgres_data:
redis_data: