-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdocker-swarm.env.yml
113 lines (107 loc) · 3.11 KB
/
docker-swarm.env.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
# 本地测试
version: '3'
services:
redis:
image: redis
environment:
- REDIS_PASSWORD=123456
ports:
- "6379:6379"
networks:
- mynetwork
# volumes:
# - ./.redis-data:/data # 持久化
deploy:
placement:
constraints: [node.labels.role==notebook_wsl]
mysql:
image: mysql:5.7.43
environment:
MYSQL_ROOT_PASSWORD: 123456 # root 用户密码
MYSQL_MAX_CONNECTIONS: 1000 # 最大连接数
TZ: Asia/Shanghai # 调整时区
ports:
- "3306:3306" # 端口映射
volumes:
- ./.mysql-data:/var/lib/mysql # 将数据目录挂载到本地目录以进行持久化
- ./mysql-init/init:/docker-entrypoint-initdb.d # 自动执行启动脚本
- ./mysql-init/sql:/opt/sql # 初始化数据
- ./mysql-init/backup:/opt/backup # 数据备份目录
# restart: always # 崩溃后自动重启
networks:
- mynetwork # 指定网络
# healthcheck: # 检查容器是否健康运行。
# test: [ "CMD", "mysqladmin" ,"ping", "-h", "localhost" ]
# interval: 5s
# timeout: 10s
# retries: 10
deploy:
placement:
constraints: [ node.labels.role==desktop_wsl ]
nacos:
image: nacos/nacos-server:v2.2.3
environment:
PREFER_HOST_MODE: hostname # 支持 hostname
MODE: standalone # 单节点模式启动
SPRING_DATASOURCE_PLATFORM: mysql
TZ: Asia/Shanghai # 控制时区
MYSQL_SERVICE_HOST: mysql
MYSQL_SERVICE_PORT: 3306
MYSQL_SERVICE_USER: root
MYSQL_SERVICE_PASSWORD: 123456
MYSQL_SERVICE_DB_NAME: nacos_devtest
MYSQL_SERVICE_DB_PARAM: characterEncoding=utf8&connectTimeout=1000&socketTimeout=3000&autoReconnect=true&useUnicode=true&useSSL=false&serverTimezone=UTC
ports:
- "8848:8848"
- "9848:9848"
- "9849:9849"
# volumes:
# - ./.nacos-standalone-logs/:/home/nacos/logs
# - ./nacos-init/application.properties:/home/nacos/conf/application.properties
networks:
- mynetwork
# depends_on:
# mysql:
# condition: service_healthy
deploy:
placement:
constraints: [ node.labels.role==notebook_wsl ]
rabbitmq:
image: rabbitmq:management
environment:
- RABBITMQ_DEFAULT_USER=user
- RABBITMQ_DEFAULT_PASS=123456
ports:
- "5672:5672"
- "15672:15672"
networks:
- mynetwork
# depends_on:
# mysql:
# condition: service_healthy
deploy:
placement:
constraints: [ node.labels.role==notebook_wsl ]
seata-server:
image: seataio/seata-server:latest
container_name: springcloud-seata-server
hostname: seata-server
ports:
- "8091:8091"
- "7091:7091"
environment:
- SEATA_PORT=8091
- SEATA_CONFIG_NAME=file:/root/seata-config/registry
volumes:
- ./seata-config:/root/seata-config
expose:
- 8091
- 7091
networks:
- mynetwork # 指定网络
deploy:
placement:
constraints: [ node.labels.role==desktop_wsl ]
networks:
mynetwork:
external: true # 网络在外部用docker network创建,而不是在部署时创建