-
Notifications
You must be signed in to change notification settings - Fork 20
/
docker-compose.yml
325 lines (308 loc) · 10 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
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
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
version: '2'
# This creates a development environment for working with the device server
# requirements:
# - docker-engine==1.10+
# - docker-compose==1.6+
# ============================================================================
# Data volumes
volumes:
mongo: {}
# ============================================================================
# Network Settings
networks:
DeviceServerNet:
ipam:
driver: default
config:
- subnet: 172.10.0.0/24
ip_range: 172.10.0.0/24
gateway: 172.10.0.254
# ----------------------------------------------------------------------------
services:
# ----------------------------------------------------------------------------
# ============================================================================
# Service Discovery and routing
consul:
command: agent -dev -bind=172.10.0.10 -client=0.0.0.0
image: 'creatordev/dockerconsul:latest'
dns:
- 127.0.0.1
dns_search: .
expose:
- "53"
- "53/udp"
- 8500
ports:
- "8500:8500"
networks:
DeviceServerNet:
ipv4_address: 172.10.0.10
registrator:
command: -internal consul://consul.service.consul:8500
depends_on:
- consul
image: gliderlabs/registrator:latest
dns:
- 172.10.0.10
dns_search: .
networks:
- DeviceServerNet
restart: always
volumes:
- "/var/run/docker.sock:/tmp/docker.sock"
fabio:
depends_on:
- consul
- registrator
dns: 172.10.0.10
dns_search: .
environment:
# Registrator required ENVs
SERVICE_8443_NAME: "webservice-deviceserver-fabio" # internal load balancer
image: magiconair/fabio:1.3.3-go1.7.1
networks:
- DeviceServerNet
ports:
- "8000:9999"
- "8443:8443"
- "81:9998"
restart: always
volumes:
- ./docker/fabio:/etc/fabio:ro
# Make sure the certs to be mapped in are named cert.pem and key.pem
# Otherwise fabio will not work
- ./docker/ssl:/ssl:ro
nginx:
depends_on:
- fabio
image: nginx:1.10.2
ports:
- "80:80"
- "443:443"
networks:
- DeviceServerNet
links:
- fabio
restart: always
volumes:
- ./docker/nginx.conf:/etc/nginx/nginx.conf:ro
- ./docker/ssl:/etc/nginx/ssl:ro
- ./docker/dhparam.pem:/etc/ssl/certs/dhparam.pem:ro
# ----------------------------------------------------------------------------
# ============================================================================
# Required Services
mongo:
depends_on:
- fabio
dns: 172.10.0.10
dns_search: .
environment:
# Registrator required ENVs
SERVICE_27017_NAME: "mongo"
SERVICE_27017_CHECK_TCP: "true"
SERVICE_27017_CHECK_INTERVAL: "2s"
image: mongo:3.2.10
networks:
- DeviceServerNet
ports:
- "27017:27017"
restart: always
volumes:
- mongo:/data/db
rabbitmq:
depends_on:
- fabio
dns: consul
environment:
# Registrator required ENVs
SERVICE_5672_NAME: "rabbitmq"
# RabbitMQ Settings
RABBITMQ_DEFAULT_USER: '${RABBITMQ_USERNAME}'
RABBITMQ_DEFAULT_PASS: '${RABBITMQ_PASSWORD}'
image: rabbitmq:3.6.5-management
ports:
- "15672:15672"
networks:
- DeviceServerNet
restart: always
# ----------------------------------------------------------------------------
# ============================================================================
# Device Server Microservices
service-subscription:
depends_on:
- fabio
- mongo
- rabbitmq
- service-changenotification
- webservice-deviceserver
dns: 172.10.0.10
dns_search: .
environment:
# links
'ServiceConfiguration:MongoConnection': "mongodb://mongo.service.consul:27017"
'ServiceConfiguration:RabbitMQConnections:0:Uri': "amqp://rabbitmq.service.consul:5672"
'ServiceConfiguration:RabbitMQConnections:0:Username': "${RABBITMQ_USERNAME}"
'ServiceConfiguration:RabbitMQConnections:0:Password': "${RABBITMQ_PASSWORD}"
'ServiceConfiguration:ChangeNotificationServers:0': "tcp://service-changenotification.service.consul:14050"
'ServiceConfiguration:Hostname': "lwm2m-bootstrap.service.consul"
'ServiceConfiguration:ExternalUri': "coaps://${DEVICESERVER_HOSTNAME}:15684"
env_file:
- ./appsettings.env
image: 'creatordev/ds-mono-service-subscription:latest'
networks:
- DeviceServerNet
tty: true
service-webhook:
depends_on:
- fabio
- mongo
- rabbitmq
- service-changenotification
- webservice-deviceserver
dns: 172.10.0.10
dns_search: .
environment:
# links
'ServiceConfiguration:MongoConnection': "mongodb://mongo.service.consul:27017"
'ServiceConfiguration:RabbitMQConnections:0:Uri': "amqp://rabbitmq.service.consul:5672"
'ServiceConfiguration:RabbitMQConnections:0:Username': "${RABBITMQ_USERNAME}"
'ServiceConfiguration:RabbitMQConnections:0:Password': "${RABBITMQ_PASSWORD}"
'ServiceConfiguration:ChangeNotificationServers:0': "tcp://service-changenotification.service.consul:14050"
'ServiceConfiguration:Hostname': "lwm2m-bootstrap.service.consul"
'ServiceConfiguration:ExternalUri': "coaps://${DEVICESERVER_HOSTNAME}:15684"
env_file:
- ./appsettings.env
image: 'creatordev/ds-mono-service-webhook:latest'
networks:
- DeviceServerNet
tty: true
lwm2m-bootstrap:
depends_on:
- fabio
- mongo
- rabbitmq
- service-changenotification
- webservice-deviceserver
dns: 172.10.0.10
dns_search: .
environment:
# Registrator required ENVs
SERVICE_15683_NAME: "lwm2m-bootstrap-15683/udp"
SERVICE_15684_NAME: "lwm2m-bootstrap-15684/udp"
# links
'ServiceConfiguration:MongoConnection': "mongodb://mongo.service.consul:27017"
'ServiceConfiguration:RabbitMQConnections:0:Uri': "amqp://rabbitmq.service.consul:5672"
'ServiceConfiguration:RabbitMQConnections:0:Username': "${RABBITMQ_USERNAME}"
'ServiceConfiguration:RabbitMQConnections:0:Password': "${RABBITMQ_PASSWORD}"
'ServiceConfiguration:ChangeNotificationServers:0': "tcp://service-changenotification.service.consul:14050"
'ServiceConfiguration:Hostname': "lwm2m-bootstrap.service.consul"
'ServiceConfiguration:ExternalUri': "coaps://${DEVICESERVER_HOSTNAME}:15684"
env_file:
- ./appsettings.env
expose:
- 15683/udp
- 15684/udp
image: 'creatordev/ds-mono-lwm2m-bootstrap:latest'
networks:
- DeviceServerNet
ports:
- "15683:15683/udp"
- "15684:15684/udp"
tty: true
volumes:
- ./docker/ds/LWM2MBootstrap.pem:/app/LWM2MBootstrap.pem:ro
lwm2m-server:
depends_on:
- fabio
- mongo
- rabbitmq
- service-changenotification
- lwm2m-bootstrap
dns: 172.10.0.10
dns_search: .
environment:
# Registrator required ENVs
SERVICE_5683_NAME: "lwm2m-server-5683/udp"
SERVICE_5684_NAME: "lwm2m-server-5684/udp"
SERVICE_14080_NAME: "lwm2m-server"
SERVICE_14080_CHECK_TCP: "true"
SERVICE_14080_CHECK_INTERVAL: "2s"
# links
'ServiceConfiguration:MongoConnection': "mongodb://mongo.service.consul:27017"
'ServiceConfiguration:RabbitMQConnections:0:Uri': "amqp://rabbitmq.service.consul:5672"
'ServiceConfiguration:RabbitMQConnections:0:Username': "${RABBITMQ_USERNAME}"
'ServiceConfiguration:RabbitMQConnections:0:Password': "${RABBITMQ_PASSWORD}"
'ServiceConfiguration:ChangeNotificationServers:0': "tcp://service-changenotification.service.consul:14050"
'ServiceConfiguration:Hostname': "lwm2m-server.service.consul"
'ServiceConfiguration:ExternalUri': "coaps://${DEVICESERVER_HOSTNAME}:5684/"
env_file:
- ./appsettings.env
expose:
- 5683/udp
- 5684/udp
- 14080
image: 'creatordev/ds-mono-lwm2m-server:latest'
networks:
- DeviceServerNet
ports:
- "5683:5683/udp"
- "5684:5684/udp"
tty: true
volumes:
- ./docker/ds/LWM2MServer.pem:/app/LWM2MServer.pem:ro
service-changenotification:
depends_on:
- fabio
- mongo
- rabbitmq
dns: 172.10.0.10
dns_search: .
environment:
# Registrator required ENVs
SERVICE_14050_NAME: "service-changenotification"
# DotNet blows out with the TCP check currently...
#SERVICE_14050_CHECK_TCP: "true"
#SERVICE_14050_CHECK_INTERVAL: "2s"
env_file:
- ./appsettings.env
expose:
- 14050
image: 'creatordev/ds-mono-service-changenotification:latest'
networks:
- DeviceServerNet
restart: always
tty: true
webservice-deviceserver:
depends_on:
- mongo
- rabbitmq
- fabio
- service-changenotification
dns: 172.10.0.10
dns_search: .
environment:
# Registrator required ENVs
SERVICE_8080_NAME: "webservice-deviceserver"
SERVICE_8080_TAGS: "urlprefix-webservice-deviceserver.service.consul/,urlprefix-/,urlprefix-${DEVICESERVER_HOSTNAME}/,urlprefix-webservice-deviceserver-fabio.service.consul/"
SERVICE_8080_CHECK_HTTP: "/"
SERVICE_8080_CHECK_INTERVAL: "2s"
# links
'ServiceConfiguration:MongoConnection': "mongodb://mongo.service.consul:27017"
'ServiceConfiguration:RabbitMQConnections:0:Uri': "amqp://rabbitmq.service.consul:5672"
'ServiceConfiguration:RabbitMQConnections:0:Username': "${RABBITMQ_USERNAME}"
'ServiceConfiguration:RabbitMQConnections:0:Password': "${RABBITMQ_PASSWORD}"
'ServiceConfiguration:ChangeNotificationServers:0': "tcp://service-changenotification.service.consul:14050"
'ServiceConfiguration:ExternalUri': "https://${DEVICESERVER_HOSTNAME}"
lwm2m-server: lwm2m-server.service.consul
env_file:
- ./appsettings.env
expose:
- 8080
image: 'creatordev/ds-mono-webservice-deviceserver:latest'
networks:
- DeviceServerNet
restart: always
tty: true
volumes:
- ./docker/ds/CA.pem:/app/CA.pem:ro
- ./docker/ds/Root.pem:/app/Root.pem:ro