-
Notifications
You must be signed in to change notification settings - Fork 0
/
docker-compose.yaml
89 lines (80 loc) · 2.16 KB
/
docker-compose.yaml
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
version: "3.9"
services:
# CONSUL AGENTS
consul-agent-1:
image: consul:latest
environment:
- 'CONSUL_LOCAL_CONFIG={"connect": {"enabled": true}}'
networks:
- consul-demo
command: "agent -retry-join consul-server-bootstrap -client 0.0.0.0"
consul-agent-2:
image: consul:latest
environment:
- 'CONSUL_LOCAL_CONFIG={"connect": {"enabled": true}}'
ports:
- "8081:8080"
networks:
- consul-demo
command: "agent -retry-join consul-server-bootstrap -client 0.0.0.0"
consul-agent-3:
image: consul:latest
environment:
- 'CONSUL_LOCAL_CONFIG={"connect": {"enabled": true}}'
networks:
- consul-demo
command: "agent -retry-join consul-server-bootstrap -client 0.0.0.0"
# CONSUL SERVERS
consul-server-1:
image: consul:latest
environment:
- 'CONSUL_LOCAL_CONFIG={"connect": {"enabled": true}}'
networks:
- consul-demo
command: "agent -server -retry-join consul-server-bootstrap -client 0.0.0.0"
consul-server-2:
image: consul:latest
environment:
- 'CONSUL_LOCAL_CONFIG={"connect": {"enabled": true}}'
networks:
- consul-demo
command: "agent -server -retry-join consul-server-bootstrap -client 0.0.0.0"
# CONSUL SERVERS BOOTSTRAP
consul-server-bootstrap:
image: consul:latest
environment:
- 'CONSUL_LOCAL_CONFIG={"connect": {"enabled": true}}'
networks:
- consul-demo
ports:
- "8400:8400"
- "8500:8500"
- "8600:8600"
- "8600:8600/udp"
command: "agent -server -bootstrap-expect 3 -ui -client 0.0.0.0"
# DEMO APP
server:
container_name: server
build:
context: .
restart: on-failure
user: "50000:50000"
env_file:
- ./server.env
depends_on:
- consul-agent-1
network_mode: service:consul-agent-1 # Using same network namespace as agent-1
client:
container_name: client
build:
context: .
restart: on-failure
user: "50000:50000"
env_file:
- ./client.env
depends_on:
- consul-agent-2
network_mode: service:consul-agent-2 # Using same network namespace as agent-2
networks:
consul-demo:
name: consul-demo