-
Notifications
You must be signed in to change notification settings - Fork 2
/
docker-compose.yml
200 lines (197 loc) · 5.01 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
version: "3.5"
services:
consul1:
image: consul:latest
container_name: "node1"
hostname: "node1"
restart: always
networks:
- consul
volumes:
- $PWD/consul-data/:/consul/data
ports:
- 8300:8300
- 8301:8301
- 8302:8302
- 8400:8400
- 8500:8500
- 8600:8600
command:
- agent
- -server
- -node=node1
- -client=0.0.0.0
- -bootstrap-expect=3
# - -bind={{ GetInterfaceIP "eth0" }}
- -bind=127.0.0.1
- -ui
ulimits:
nproc: 65535
cap_add:
- ALL
privileged: true
deploy:
mode: global
restart_policy:
condition: on-failure
delay: 5s
max_attempts: 3
window: 120s
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:8500"]
#test: echo "hello world"
interval: 10s
timeout: 10s
retries: 5
consul2:
image: consul:latest
container_name: "node2"
hostname: "node2"
restart: always
networks:
- consul
volumes:
- $PWD/consul-data/:/consul/data
- $PWD/config/consul:/consul/config
ports:
- 8303:8300
- 8304:8301
- 8305:8302
- 8401:8400
- 8501:8500
- 8601:8600
command:
- agent
- -server
- -node=node2
- -join=node1
# - -rejoin
- -retry-join=node1
depends_on:
- consul1
links:
- consul1
ulimits:
nproc: 65535
cap_add:
- ALL
privileged: true
deploy:
mode: global
restart_policy:
condition: on-failure
delay: 5s
max_attempts: 3
window: 120s
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:8501"]
#test: echo "hello world"
interval: 10s
timeout: 10s
retries: 5
consul3:
image: consul:latest
container_name: "node3"
hostname: "node3"
restart: always
networks:
- consul
volumes:
- $PWD/consul-data/:/consul/data
- $PWD/config/consul:/consul/config
ports:
- 8306:8300
- 8307:8301
- 8308:8302
- 8402:8400
- 8502:8500
- 8602:8600
command:
- agent
- -server
- -node=node3
- -join=node1
# - -rejoin
- -retry-join=node1
depends_on:
- consul1
links:
- consul1
ulimits:
nproc: 65535
cap_add:
- ALL
privileged: true
deploy:
mode: global
restart_policy:
condition: on-failure
delay: 5s
max_attempts: 3
window: 120s
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:8502"]
#test: echo "hello world"
interval: 10s
timeout: 10s
retries: 5
vault:
depends_on:
- consul1
# - mysql
image: vault:latest
container_name: "vault"
hostname: "vault"
restart: always
cap_add:
- IPC_LOCK
ports:
- 8200:8200
environment:
VAULT_LOCAL_CONFIG: '{"backend": {"consul": {"address": "consul1:8500", "path": "vault"}}, "listener": {"tcp": {"address": "0.0.0.0:8200", "tls_disable": "1"}}, "default_lease_ttl": "24h", "max_lease_ttl": "720h"}'
VAULT_ADDR: "http://0.0.0.0:8200"
volumes:
- $PWD/vault/config:/vault/config
- $PWD/vault/logs:/vault/logs
- $PWD/vault/file:/vault/file
command:
- server
networks:
- consul
ulimits:
nproc: 65535
cap_add:
- ALL
privileged: true
deploy:
mode: global
restart_policy:
condition: on-failure
delay: 5s
max_attempts: 3
window: 120s
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:8200"]
#test: echo "hello world"
interval: 10s
timeout: 10s
retries: 5
# mysql:
# image: mysql:5.7.19
# networks:
# - consul
# #image: healthcheck/mysql
# environment:
# #MYSQL_ONETIME_PASSWORD: mysql
# MYSQL_ROOT_PASSWORD: mysql
# MYSQL_DATABASE: vault
# MYSQL_USER: vault
# MYSQL_PASSWORD: vault
# ports: ["3306:3306"]
# volumes: ["mysql-data:/var/lib/mysql"]
# #networks: [backing-services]
networks:
consul:
driver: bridge
# volumes:
# mysql-data: {}