-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
executable file
·232 lines (216 loc) · 6.94 KB
/
docker-compose.yml
File metadata and controls
executable file
·232 lines (216 loc) · 6.94 KB
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
version: '3.7'
services:
captain-1:
extends:
file: docker-compose-base.yml
service: captain-template
environment:
- SELF_URL=ws://10.5.0.11:7400
# # real consul installed
# - CONSUL_HTTP_ADDR=http://127.0.0.1:8500
# dummy consul
- CONSUL_HTTP_ADDR=http://dummy-consul-apps/consul-1
networks:
custom-network:
ipv4_address: 10.5.0.11
volumes:
- ./captain/__simulation__/real-consul-app/server1.json:/consul/config/server1.json:ro
ports:
- 8001:80
# following 3 ports needed only when running hashicorp-consul inside each container instead of dummy-consul
- 8500:8500
- 8600:8600/tcp
- 8600:8600/udp
depends_on:
dummy-consul-apps:
condition: service_started
captain-apps-install-packages:
condition: service_completed_successfully
captain-2:
extends:
file: docker-compose-base.yml
service: captain-template
environment:
- SELF_URL=ws://10.5.0.12:7400
# # real consul installed
# - CONSUL_HTTP_ADDR=http://127.0.0.1:8500
# dummy consul
- CONSUL_HTTP_ADDR=http://dummy-consul-apps/consul-2
networks:
custom-network:
ipv4_address: 10.5.0.12
volumes:
- ./captain/__simulation__/real-consul-app/server2.json:/consul/config/server2.json:ro
ports:
- 8002:80
depends_on:
dummy-consul-apps:
condition: service_started
captain-apps-install-packages:
condition: service_completed_successfully
captain-3:
extends:
file: docker-compose-base.yml
service: captain-template
environment:
- SELF_URL=ws://10.5.0.13:7400
# # real consul installed
# - CONSUL_HTTP_ADDR=http://127.0.0.1:8500
# dummy consul
- CONSUL_HTTP_ADDR=http://dummy-consul-apps/consul-3
networks:
custom-network:
ipv4_address: 10.5.0.13
volumes:
- ./captain/__simulation__/real-consul-app/server3.json:/consul/config/server3.json:ro
ports:
- 8003:80
depends_on:
dummy-consul-apps:
condition: service_started
captain-apps-install-packages:
condition: service_completed_successfully
multi-ip-dummy-web-app:
extends:
file: docker-compose-base.yml
service: dummy-apps
environment:
# a). specify primary ip along with additional ips to be mapped to the same container instance,
# to avoid performance issues of having one container per ip
# b). comma, new-line, tab and space are all considered separators
# Healthy ips
IP_UP: >-
10.5.0.21,10.5.0.22,10.5.0.23
10.5.0.31,10.5.0.32,10.5.0.33,10.5.0.34
10.5.0.41,10.5.0.42
10.5.0.121, 10.5.0.171
10.5.0.122,10.5.0.123,10.5.0.124
10.5.0.172,10.5.0.173,10.5.0.174
# Time out ips
IP_DELAY: >-
# UnHealthy/Error ips
IP_DOWN: >-
10.5.0.131, 10.5.0.161
10.5.0.125,10.5.0.126,10.5.0.127
10.5.0.128,10.5.0.129
10.5.0.132,10.5.0.133,10.5.0.134,10.5.0.135
10.5.0.136,10.5.0.137
10.5.0.138,10.5.0.139
10.5.0.162,10.5.0.163,10.5.0.164
10.5.0.165,10.5.0.166,10.5.0.167
10.5.0.168,10.5.0.169
10.5.0.175,10.5.0.176,10.5.0.177
10.5.0.178,10.5.0.179
volumes:
# link the relevant source as src/index.ts
- ./__simulation__/dummy-apps/allSrc/dummy-web-app.ts:/app/src/index.ts:ro
depends_on:
dummy-apps-install-packages:
condition: service_completed_successfully
networks:
custom-network:
ipv4_address: 10.5.0.21
command: ['. ./scripts/assigned-ips.sh && exec nodemon --signal SIGTERM -- --inspect=0.0.0.0:9234']
mate-1:
extends:
file: docker-compose-base.yml
service: mate-template
environment:
- CAPTAIN_URL=ws://10.5.0.13:7450,ws://10.5.0.11:7450,ws://10.5.0.12:7450
- WEBSERVICE_YAML_LOCATION=/data/services-mate-1.yaml
- MATE_ID=mate-1
networks:
custom-network:
ipv4_address: 10.5.0.111
depends_on:
mate-apps-install-packages:
condition: service_completed_successfully
mate-2:
extends:
file: docker-compose-base.yml
service: mate-template
environment:
- CAPTAIN_URL=ws://10.5.0.12:7450,ws://10.5.0.13:7450,ws://10.5.0.11:7450
- WEBSERVICE_YAML_LOCATION=/data/services-mate-2.yaml
- MATE_ID=mate-2
networks:
custom-network:
ipv4_address: 10.5.0.112
depends_on:
mate-apps-install-packages:
condition: service_completed_successfully
# # https://github.com/TechnitiumSoftware/DnsServer/blob/master/docker-compose.yml
dns-server:
extends:
file: docker-compose-base.yml
service: dns-server-template
volumes:
- technitium-config:/etc/dns
ports:
- '5380:5380/tcp' #DNS web console (HTTP)
networks:
custom-network:
ipv4_address: 10.5.0.2
# single app that simulate all the three consuls based on different url-prefix
# ping dummy-consul-apps
# dig dummy-consul-apps
dummy-consul-apps:
extends:
file: docker-compose-base.yml
service: dummy-apps
volumes:
- ./__simulation__/dummy-apps/allSrc/dummy-consul-app.ts:/app/src/index.ts:ro
depends_on:
dummy-apps-install-packages:
condition: service_completed_successfully
networks:
custom-network:
ipv4_address: 10.5.0.3
expose:
- 80
dummy-http-notification:
extends:
file: docker-compose-base.yml
service: dummy-apps
volumes:
- ./__simulation__/dummy-apps/allSrc/dummy-http-notification-app.ts:/app/src/index.ts:ro
depends_on:
dummy-apps-install-packages:
condition: service_completed_successfully
networks:
custom-network:
ipv4_address: 10.5.0.4
expose:
- 80
# since there are multiple instances of same source code and they share the same node_modules folder,
# install node_modules using a separate container before starting the relavant containers,
# as doing inside each container could create syncing issues
captain-apps-install-packages:
extends:
file: docker-compose-base.yml
service: captain-template
command: ['pnpm i --config.confirmModulesPurge=false --unsafe-perm=true']
mate-apps-install-packages:
extends:
file: docker-compose-base.yml
service: mate-template
command: ['pnpm i --config.confirmModulesPurge=false --unsafe-perm=true']
dummy-apps-install-packages:
extends:
file: docker-compose-base.yml
service: dummy-apps
command: ['pnpm i --config.confirmModulesPurge=false --unsafe-perm=true']
volumes:
technitium-config:
name: '${COMPOSE_PROJECT_NAME}-technitium-config'
external: false
networks:
custom-network:
name: ${COMPOSE_PROJECT_NAME}-network
driver: bridge
# disable ipv6 to simplify network setup
enable_ipv6: false
ipam:
config:
- subnet: 10.5.0.0/16
gateway: 10.5.0.1