forked from pranavcode/consul-demo
-
Notifications
You must be signed in to change notification settings - Fork 0
/
docker-compose.yml
165 lines (156 loc) · 3.03 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
version: "3.6"
services:
consul_server:
build:
context: consul_server
dockerfile: Dockerfile
image: consul_server
ports:
- 8300:8300
- 8301:8301
- 8302:8302
- 8400:8400
- 8500:8500
environment:
- NODE=consul_server
- PRIVATE_IP_ADDRESS=33.10.0.2
networks:
consul_network:
ipv4_address: 33.10.0.2
load_balancer:
image: fabiolb/fabio
ports:
- 9998:9998
- 9999:9999
command: -registry.consul.addr="33.10.0.2:8500"
networks:
consul_network:
ipv4_address: 33.10.0.100
mongo_1:
build:
context: mongo
dockerfile: Dockerfile
image: mongo_consul
dns:
- 127.0.0.1
- 8.8.8.8
- 8.8.4.4
environment:
- NODE=mongo_1
- MONGO_PORT=27017
- PRIMARY_MONGO=33.10.0.3
- PRIVATE_IP_ADDRESS=33.10.0.3
restart: always
ports:
- 27017:27017
- 28017:28017
depends_on:
- consul_server
- mongo_2
- mongo_3
networks:
consul_network:
ipv4_address: 33.10.0.3
mongo_2:
build:
context: mongo
dockerfile: Dockerfile
image: mongo_consul
dns:
- 127.0.0.1
- 8.8.8.8
- 8.8.4.4
environment:
- NODE=mongo_2
- MONGO_PORT=27017
- PRIMARY_MONGO=33.10.0.3
- PRIVATE_IP_ADDRESS=33.10.0.4
restart: always
ports:
- 27018:27017
- 28018:28017
depends_on:
- consul_server
networks:
consul_network:
ipv4_address: 33.10.0.4
mongo_3:
build:
context: mongo
dockerfile: Dockerfile
image: mongo_consul
dns:
- 127.0.0.1
- 8.8.8.8
- 8.8.4.4
environment:
- NODE=mongo_3
- MONGO_PORT=27017
- PRIMARY_MONGO=33.10.0.3
- PRIVATE_IP_ADDRESS=33.10.0.5
restart: always
ports:
- 27019:27017
- 28019:28017
depends_on:
- consul_server
networks:
consul_network:
ipv4_address: 33.10.0.5
web_1:
build:
context: django
dockerfile: Dockerfile
image: web_consul
ports:
- 8080:8000
environment:
- NODE=web_1
- PRIMARY=1
- LOAD_BALANCER=33.10.0.100
- PRIVATE_IP_ADDRESS=33.10.0.10
dns:
- 127.0.0.1
- 8.8.8.8
- 8.8.4.4
depends_on:
- consul_server
- mongo_1
volumes:
- ./django:/web
cap_add:
- NET_ADMIN
networks:
consul_network:
ipv4_address: 33.10.0.10
web_2:
build:
context: django
dockerfile: Dockerfile
image: web_consul
ports:
- 8081:8000
environment:
- NODE=web_2
- LOAD_BALANCER=33.10.0.100
- PRIVATE_IP_ADDRESS=33.10.0.11
dns:
- 127.0.0.1
- 8.8.8.8
- 8.8.4.4
depends_on:
- consul_server
- mongo_1
volumes:
- ./django:/web
cap_add:
- NET_ADMIN
networks:
consul_network:
ipv4_address: 33.10.0.11
networks:
consul_network:
driver: bridge
ipam:
config:
- subnet: 33.10.0.0/16