-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdocker-compose.yml
427 lines (427 loc) · 13.3 KB
/
docker-compose.yml
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
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
version: '3.7'
networks:
deploy:
driver: ${NETWORKS_DRIVER}
services:
portainer:
container_name: portainer
image: 'portainer/portainer-ce:latest'
restart: always
ports:
- '${PORTAINER_PORT}:8000'
- '${PORTAINER_HTTP_PORT}:9000'
- '${PORTAINER_HTTPS_PORT}:9443'
volumes:
- /var/run/docker.sock:/var/run/docker.sock
- ./portainer/data:/data
networks:
- deploy
golang:
container_name: golang
build:
context: ./golang # 指定构建使用的 Dockerfile 文件
environment:
TZ: ${TZ}
GOPROXY: https://goproxy.cn,direct
working_dir: /code
volumes:
- ${GOLANG_CODE_PATH}:/code # 引用 .env 配置中 CODE_PATH 变量,将宿主机上代码存放的目录挂载到容器中
privileged: true
ports:
- "30000:30000"
- "31001:31001"
- "31002:31002"
- "31003:31003"
- "30004:30004"
- "31004:31004"
- "30005:30005"
- "31005:31005"
- "30006:30006"
- "31006:31006"
- "31007:31007"
- "30008:30008"
- "31008:31008"
- "30009:30009"
- "31009:31009"
- "30010:30010"
- "31010:31010"
- "30011:30011"
- "31011:31011"
- "31012:31012"
logging:
#日志驱动
driver: "json-file"
options:
#日志大小
max-size: "5m"
#日志数量
max-file: "3"
networks:
- deploy
mysql:
container_name: mysql
hostname: mysql
image: 'mysql:8.0.21'
# 重启策略
restart: always
platform: linux/x86_64
environment:
# 时区上海
TZ: ${TZ}
# root 密码
MYSQL_ROOT_PASSWORD: ${MYSQL_ROOT_PASSWORD}
# 初始化用户(不能是root 会报错, 后续需要给新用户赋予权限)
MYSQL_USER: ${MYSQL_USERNAME}
# 用户密码
MYSQL_PASSWORD: ${MYSQL_PASSWORD}
# 映射端口
volumes:
# 数据挂载
- ./mysql/data/:/var/lib/mysql/
# 配置挂载
- ./mysql/conf/:/etc/mysql/conf.d/
# 初始化目录挂载
- ./mysql/init/:/docker-entrypoint-initdb.d/
command:
# 将mysql8.0默认密码策略 修改为 原先 策略 (mysql8.0对其默认策略做了更改 会导致密码无法匹配)
--default-authentication-plugin=mysql_native_password
--character-set-server=utf8mb4
--collation-server=utf8mb4_general_ci
--explicit_defaults_for_timestamp=true
--lower_case_table_names=1
ports:
- "${MYSQL_PORT}:3306" # 设置容器 3306 端口映射指定宿主机端口
expose:
- 3306
networks:
- deploy
postgresql:
image: postgres:14.5
container_name: postgresql # 容器名为'postgresql'
# 重启策略
restart: always # 指定容器退出后的重启策略为始终重启,但是不考虑在Docker守护进程启动时就已经停止了的容器
# 设置环境变量,相当于docker run命令中的-e
environment:
TZ: Asia/Shanghai
LANG: en_US.UTF-8
POSTGRES_DB: postgres
POSTGRES_USER: postgres
POSTGRES_PASSWORD: 123456
ALLOW_IP_RANGE: 0.0.0.0/0 # 允许所有ip访问
# 数据卷挂载路径设置,将本机目录映射到容器目录
volumes:
- "./postgresql/data:/var/lib/postgresql/data"
# 映射端口
ports:
- "${POSTGRESQL_PORT}:5432"
networks:
- deploy
redis:
container_name: redis
image: 'redis:6.2.13-alpine'
restart: always
environment:
- TZ=${TZ}
command: [ "redis-server", "--appendonly", "yes", "--requirepass","${REDIS_PASS}" ]
volumes:
- ./redis/data:/data/:rw
ports:
- "${REDIS_PORT}:6379"
expose:
- 6379
networks:
- deploy
mysql-manage:
container_name: mysql-manage
image: 'phpmyadmin/phpmyadmin:5.1.3'
restart: always
environment:
- TZ=${TZ}
- PMA_ARBITRARY=1
- PMA_HOST=${MYSQL_MANAGE_CONNECT_HOST} # 设置连接的 Mysql 服务 host,可以是 Mysql 服务容器的名称,也可以是 Mysql 服务容器的 ip 地址
- PMA_PORT=${MYSQL_MANAGE_CONNECT_PORT} # 设置连接的 Mysql 服务端口号
ports:
- "${MYSQL_MANAGE_PORT}:80" # 设置容器 80 端口映射指定宿主机端口,用于宿主机访问可视化web
networks:
- deploy
redis-manage:
container_name: redis-manage
image: 'erikdubbelboer/phpredisadmin:latest'
restart: always
environment:
- TZ=${TZ}
- ADMIN_USER=${REDIS_MANAGE_USERNAME} # 设置 Redis 可视化管理的用户名称
- ADMIN_PASS=${REDIS_MANAGE_PASSWORD} # 设置 Redis 可视化管理的用户密码
- REDIS_1_HOST=${REDIS_MANAGE_CONNECT_HOST} # 设置连接的 Redis 服务 host,可以是 Redis 服务容器的名称,也可以是 Redis 服务容器的 ip 地址
- REDIS_1_PORT=${REDIS_MANAGE_CONNECT_PORT} # 设置连接的 Redis 服务端口号
- REDIS_1_AUTH=${REDIS_MANAGE_CONNECT_PASS} # 设置连接的 Redis 密码
ports:
- "${REDIS_MANAGE_PORT}:80" # 设置容器80端口映射指定宿主机端口,用于宿主机访问可视化web
# 在 Redis 服务容器启动后启动
networks:
- deploy
asynq-manage:
image: 'hibiken/asynqmon:latest'
container_name: asynq-manage
restart: always
platform: linux/x86_64
ports:
- "${ASYNQ_MANAGE_PORT}:8080"
command:
- "--redis-addr=${ASYNQ_MANAGE_REDIS_CONNECT_HOST}:${ASYNQ_MANAGE_REDIS_CONNECT_PORT}"
- "--redis-password=${ASYNQ_MANAGE_REDIS_CONNECT_PASS}"
networks:
- deploy
rabbitmq:
image: rabbitmq:3.9.1-management # 镜像`rabbitmq:3.9.1-management` 【 注:该版本包含了web控制页面 】
container_name: rabbitmq # 容器名为'rabbitmq'
restart: always # 指定容器退出后的重启策略为始终重启,但是不考虑在Docker守护进程启动时就已经停止了的容器
environment: # 设置环境变量,相当于docker run命令中的-e
TZ: Asia/Shanghai
LANG: en_US.UTF-8
volumes: # 数据卷挂载路径设置,将本机目录映射到容器目录
- "./rabbitmq/config/rabbitmq.conf:/etc/rabbitmq/rabbitmq.conf"
- "./rabbitmq/config/10-default-guest-user.conf:/etc/rabbitmq/conf.d/10-default-guest-user.conf"
- "./rabbitmq/data:/var/lib/rabbitmq"
- "./rabbitmq/plugins/rabbitmq_delayed_message_exchange-3.9.0.ez:/opt/rabbitmq/plugins/rabbitmq_delayed_message_exchange-3.9.0.ez"
- "./rabbitmq/log:/var/log/rabbitmq"
ports: # 映射端口
- "${RABBITMQ_PORT}:5672"
- "${RABBITMQ_WEB_PORT}:15672"
networks:
- deploy
elasticsearch:
image: elasticsearch:7.14.1
container_name: elasticsearch
user: root
environment:
TZ: Asia/Shanghai
LANG: en_US.UTF-8
discovery.type: single-node
ES_JAVA_OPTS: "-Xmx512m -Xms512m"
ELASTIC_PASSWORD: "${ELASTIC_PASSWORD}" # elastic账号密码
volumes:
- ./elasticsearch/data:/usr/share/elasticsearch/data
- ./elasticsearch/logs:/usr/share/elasticsearch/logs
# - ./elasticsearch/config/elasticsearch.yml:/usr/share/elasticsearch/config/elasticsearch.yml
# - ./elasticsearch/config/jvm.options:/usr/share/elasticsearch/config/jvm.options
ports:
- "${ELASTIC_PORT1}:9200"
- "${ELASTIC_PORT2}:9300"
networks:
- deploy
jaeger:
container_name: jaeger
image: 'jaegertracing/all-in-one:latest'
environment:
- TZ=${TZ}
- SPAN_STORAGE_TYPE=elasticsearch
- ES_SERVER_URLS=${JAEGER_ES_SERVER_URLS}
- LOG_LEVEL=debug
ports:
- "${JAEGER_PORT}:16686" # 设置容器16686端口映射指定宿主机端口,用于宿主机访问可视化web
- "5775:5775/udp"
- "6831:6831/udp"
- "6832:6832/udp"
- "5778:5778"
- "14268:14268"
- "14250:14250"
- "9411:9411"
depends_on:
- elasticsearch
networks:
- deploy
jaeger-standalone:
container_name: jaeger-standalone
image: 'jaegertracing/all-in-one:latest'
environment:
- TZ=${TZ}
- LOG_LEVEL=debug
ports:
- "${JAEGER_PORT}:16686" # 设置容器16686端口映射指定宿主机端口,用于宿主机访问可视化web
- "5775:5775/udp"
- "6831:6831/udp"
- "6832:6832/udp"
- "5778:5778"
- "14268:14268"
- "14250:14250"
- "9411:9411"
networks:
- deploy
jaeger-opentelemetry-standalone:
container_name: jaeger-opentelemetry-standalone
image: 'jaegertracing/opentelemetry-all-in-one:latest'
environment:
- TZ=${TZ}
- LOG_LEVEL=debug
- SPAN_STORAGE_TYPE=memory
platform: linux/x86_64
ports:
- "${JAEGER_PORT}:16686" # 设置容器16686端口映射指定宿主机端口,用于宿主机访问可视化web
- "13133:13133"
- "55680:55680"
- "55681:55681"
networks:
- deploy
prometheus:
container_name: prometheus
image: 'bitnami/prometheus:latest'
environment:
- TZ=${TZ}
ports:
- "${PROMETHEUS_PORT}:9090" # 设置容器9090端口映射指定宿主机端口,用于宿主机访问可视化web
volumes:
- ./prometheus/prometheus.yml:/opt/bitnami/prometheus/conf/prometheus.yml # 将 prometheus 配置文件挂载到容器里
networks:
- deploy
etcd:
container_name: etcd
image: 'bitnami/etcd:latest'
restart: always
platform: linux/x86_64
privileged: true
volumes:
- ./etcd:/bitnami/etcd
environment:
- TZ=${TZ}
- ETCD_ENABLE_V2=true
- ALLOW_NONE_AUTHENTICATION=yes
- ETCD_ADVERTISE_CLIENT_URLS=http://0.0.0.0:2379
- ETCD_LISTEN_CLIENT_URLS=http://0.0.0.0:2379
ports:
- "${ETCD_PORT}:2379"
networks:
- deploy
grafana:
container_name: grafana
image: 'grafana/grafana:latest'
restart: always
environment:
- TZ=${TZ}
volumes:
- ./grafana/data:/var/lib/grafana
- ./grafana/log:/var/log/grafana
- ./grafana/conf/provisioning:/etc/grafana/provisioning
- ./grafana/conf/dashboards:/var/lib/grafana/dashboards
- ./grafana/conf/config/grafana.ini:/etc/grafana/grafana.ini
ports:
- "${GRAFANA_PORT}:3000"
networks:
- deploy
dtm:
container_name: dtm
image: 'yedf/dtm'
restart: always
environment:
- TZ=${TZ}
entrypoint:
- "/app/dtm/dtm"
- "-c=/app/dtm/configs/config.yaml"
volumes:
- ./dtm/config.yml:/app/dtm/configs/config.yaml # 将 dtm 配置文件挂载到容器里
ports:
- "${DTM_HTTP_PORT}:36789"
- "${DTM_GRPC_PORT}:36790"
networks:
- deploy
apisix-dashboard:
container_name: apisix-dashboard
image: apache/apisix-dashboard:3.0.0-alpine
restart: always
volumes:
- ./apisix-dashboard/conf.yaml:/usr/local/apisix-dashboard/conf/conf.yaml
ports:
- "${APISIX_DASHBOARD_PORT}:9000"
networks:
- deploy
apisix:
container_name: apisix
image: apache/apisix:3.1.0-debian
restart: always
volumes:
- ./apisix/conf/config.yaml:/usr/local/apisix/conf/config.yaml:ro
depends_on:
- etcd
##network_mode: host
ports:
- "${APISIX_HTTP_PORT}:9080/tcp"
- "${APISIX_HTTPS_PORT}:9443/tcp"
- "${APISIX_PORT1}:9091/tcp"
- "${APISIX_PORT2}:9092/tcp"
networks:
- deploy
apisix-nginx1:
container_name: apisix-nginx1
image: nginx:1.19.0-alpine
restart: always
volumes:
- ./apisix-nginx/nginx1.conf:/etc/nginx/nginx.conf
ports:
- "${APISIX_NGINX1_PORT}:80/tcp"
environment:
- NGINX_PORT=80
networks:
- deploy
apisix-nginx2:
container_name: apisix-nginx2
image: nginx:1.19.0-alpine
restart: always
volumes:
- ./apisix-nginx/nginx2.conf:/etc/nginx/nginx.conf
ports:
- "${APISIX_NGINX2_PORT}:80/tcp"
environment:
- NGINX_PORT=80
networks:
- deploy
pyroscope:
container_name: pyroscope
image: "pyroscope/pyroscope:latest"
ports:
- "${PYROSCOPE_PORT}:4040"
environment:
## 限制必须使用 API 秘钥上传
- PYROSCOPE_AUTH_INGESTION_ENABLED=false
## 设置账号密码登录后台
- PYROSCOPE_AUTH_INTERNAL_ENABLED=true
volumes:
## 设置数据共享目录
- ./pyroscope:/var/lib/pyroscope
command:
- "server"
networks:
- deploy
polaris:
container_name: polaris
hostname: polaris
image: polarismesh/polaris-server-standalone:latest
restart: always
privileged: true
ports: # 用于其他服务访问北极星
- "15010:15010"
- "8101:8101"
- "8100:8100"
- "18080:8080"
- "8090:8090"
- "8091:8091"
- "8093:8093"
- "8761:8761"
- "9090:9090"
networks:
- deploy
nacos:
image: nacos/nacos-server:v2.2.2
container_name: nacos
restart: always
platform: linux/x86_64
env_file:
- ./nacos/env/nacos-standlone-mysql.env
volumes:
- ./nacos/logs/:/home/nacos/logs
ports:
- "${NACOS_UI_PORT}:8848"
- "${NACOS_PORT}:9848"
depends_on:
- mysql
networks:
- deploy