forked from IMGIITRoorkee/omniport-docker
-
Notifications
You must be signed in to change notification settings - Fork 0
/
docker-compose.yml
660 lines (524 loc) · 17.6 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
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
# The version of the docker-compose standard being followed here
version: '3.4'
# Services are groups of containers handling one aspect of the application
services:
database: # PostgreSQL
# Use the PostgreSQL image we made ourselves by running ./scripts/build/postgres.sh
image: omniport-postgres:latest
# No matter what, if the container stops, start it again
restart: always
# Check the health of the container periodically
healthcheck:
test: ['CMD', 'checkhealth']
retries: 4
interval: 16m
timeout: 16s
start_period: 2m
# Expose the port 5432 used by PostgreSQL to other containers
expose:
- "5432"
# Run the container as the non-root user
user: postgres
# Set the environment variables
env_file:
- postgres/database.env
# Mount the volumes on the database container
volumes:
# Mount 'database' as the place where PostgreSQL stores all its data
- type: volume
source: database
target: /var/lib/postgresql/data
read_only: false
# Connect to the custom default network
networks:
- network
channel-layer: # Redis
# Use the Redis image we made ourselves by running ./scripts/build/redis.sh
image: omniport-redis:latest
# Check the health of the container periodically
healthcheck:
test: ['CMD', 'checkhealth']
retries: 4
interval: 16m
timeout: 16s
start_period: 2m
# No matter what, if the container stops, start it again
restart: always
# Expose the port 6379 used by Redis to other containers
expose:
- "6379"
# Run the container as the non-root user
user: redis
# Mount the volumes on the channel layer container
volumes:
# Mount 'channel_layer' as the place where Redis stores its dumps
- type: volume
source: channel_layer
target: /data
read_only: false
# Connect to the custom default network
networks:
- network
session-store: # Redis
# Use the Redis image we made ourselves by running ./scripts/build/redis.sh
image: omniport-redis:latest
# Check the health of the container periodically
healthcheck:
test: ['CMD', 'checkhealth']
retries: 4
interval: 16m
timeout: 16s
start_period: 2m
# No matter what, if the container stops, start it again
restart: always
# Expose the port 6379 used by Redis to other containers
expose:
- "6379"
# Run the container as the non-root user
user: redis
# Mount the volumes on the session store container
volumes:
# Mount 'session_store' as the place where Redis stores all its dumps
- type: volume
source: session_store
target: /data
read_only: false
# Connect to the custom default network
networks:
- network
communication-store: # Redis
# Use the Redis image we made ourselves by running ./scripts/build/redis.sh
image: omniport-redis:latest
# Check the health of the container periodically
healthcheck:
test: ['CMD', 'checkhealth']
retries: 4
interval: 16m
timeout: 16s
start_period: 2m
# No matter what, if the container stops, start it again
restart: always
# Expose the port 6379 used by Redis to other containers
expose:
- "6379"
# Run the container as the non-root user
user: redis
# Mount the volumes on the communication store container
volumes:
# Mount 'communication_store' as the place where Redis stores its dumps
- type: volume
source: communication_store
target: /data
read_only: false
# Connect to the custom default network
networks:
- network
verification-store: # Redis
# Use the Redis image we made ourselves by running ./scripts/build/redis.sh
image: omniport-redis:latest
# Check the health of the container periodically
healthcheck:
test: ['CMD', 'checkhealth']
retries: 4
interval: 16m
timeout: 16s
start_period: 2m
# No matter what, if the container stops, start it again
restart: always
# Expose the port 6379 used by Redis to other containers
expose:
- "6379"
# Run the container as the non-root user
user: redis
# Mount the volumes on the session store container
volumes:
# Mount 'verification_store' as the place where Redis stores all its dumps
- type: volume
source: verification_store
target: /data
read_only: false
# Connect to the custom default network
networks:
- network
application-store: # Redis
# Use the Redis image we made ourselves by running ./scripts/build/redis.sh
image: omniport-redis:latest
# Check the health of the container periodically
healthcheck:
test: ['CMD', 'checkhealth']
retries: 4
interval: 16m
timeout: 16s
start_period: 2m
# No matter what, if the container stops, start it again
restart: always
# Expose the port 6379 used by Redis to other containers
expose:
- "6379"
# Run the container as the non-root user
user: redis
# Mount the volumes on the application store container
volumes:
# Mount 'application_store' as the place where Redis stores all its dumps
- type: volume
source: application_store
target: /data
read_only: false
# Connect to the custom default network
networks:
- network
redis-gui: # Redis Commander
# Use the Redis Commander image as is
image: rediscommander/redis-commander:latest
# Check the health of the container periodically
healthcheck:
test: ['CMD', 'nc', '-z', '127.0.0.1', '8081']
retries: 4
interval: 16m
timeout: 16s
start_period: 2m
# No matter what, if the container stops, start it again
restart: always
# Expose the port 8081 used by Redis commander to the host
ports:
- "8081:8081"
# Set the REDIS_HOSTS environment variable so that the Redis servers can be connected
environment:
- 'REDIS_HOSTS=
channel-layer:channel-layer,
session-store:session-store,
communication-store:communication-store,
application-store:application-store,
verification-store:verification-store'
# The services that need to be ready before this one
depends_on:
- channel-layer
- session-store
- communication-store
- verification-store
# Connect to the custom default network
networks:
- network
cache: # Memcached
# Use the Memcached image we made ourselves by running ./scripts/build/memcached.sh
image: omniport-memcached:latest
# Check the health of the container periodically
healthcheck:
test: ['CMD', 'netcat', '-z', '127.0.0.1', '11211']
retries: 4
interval: 16m
timeout: 16s
start_period: 2m
# No matter what, if the container stops, start it again
restart: always
# Expose the port 5672 used by RabbitMQ to other containers
expose:
- "11211"
# Run the container as the non-root user
user: memcache
# Connect to the custom default network
networks:
- network
message-broker: # RabbitMQ
# Use the RabbitMQ image we made ourselves by running ./scripts/build/rabbitmq.sh
image: omniport-rabbitmq:latest
# Check the health of the container periodically
healthcheck:
test: ['CMD', 'checkhealth']
retries: 4
interval: 16m
timeout: 16s
start_period: 2m
# No matter what, if the container stops, start it again
restart: always
# Expose the port 5672 used by RabbitMQ to other containers
expose:
- "5672"
# Expose the ports 15672 to the host at 5672 and 15672
ports:
- "15672:15672"
# Run the container as the non-root user
user: rabbitmq
# Set the environment variables
env_file:
- rabbitmq/message_broker.env
# Mount the volumes on the message broker container
volumes:
# Mount 'rabbitmq-data' as the place where RabbitMQ stores its data
- type: volume
source: rabbitmq_data
target: /var/lib/rabbitmq
read_only: false
# Connect to the custom default network
networks:
- network
intranet-server: # Django = Gunicorn + Daphne
# Use the Django image we made ourselves by running ./scripts/build/django.sh
image: omniport-django:latest
# No matter what, if the container stops, start it again
restart: always
# Expose the ports 8000 and 8001 used by Gunicorn and Daphne to other containers
expose:
- "8000"
- "8001"
# Run the container as the non-root user
user: django
# Set the SITE_ID environment variable so that the right YAML is processed
environment:
- SITE_ID=1
- NAME=intranet-server
command: ["supervisord", "-c", "/supervisord.conf"]
# Mount the volumes on the Django container
volumes:
# Mount the code from the 'omniport' folder in the root of the container
- type: bind
source: ./codebase/omniport-backend/omniport
target: /omniport
read_only: true
# Mount the YAML files from the 'configuration' folder in the root of the container
- type: bind
source: ./codebase/omniport-backend/configuration
target: /configuration
read_only: true
# Mount the imagery from the 'branding' folder in the root of the container
- type: bind
source: ./codebase/omniport-backend/branding
target: /branding
read_only: true
# Mount the third-party service certificates from the 'certificates' folder in the root of the container
- type: bind
source: ./codebase/omniport-backend/certificates
target: /certificates
read_only: true
# Mount 'network_storage' as 'network_storage' in the root of the container
- type: bind
source: ./codebase/omniport-backend/network_storage
target: /network_storage
read_only: false
# Mount 'static_files' as its namesake in the root of the container
- type: volume
source: static_files
target: /static_files
read_only: false
# Mount 'media_files' as its namesake in the root of the container
- type: volume
source: media_files
target: /media_files
read_only: false
# Mount 'personal_files' as its namesake in the root of the container
- type: volume
source: personal_files
target: /personal_files
read_only: false
# Mount 'supervisor.d' as its namesake in the root of the container
- type: volume
source: supervisor.d
target: /supervisor.d
read_only: false
# Mount 'web_server_logs' as its namesake in the root of the container
- type: volume
source: web_server_logs
target: /web_server_logs
read_only: false
# mount '.history' as its namesake in the root of the container
- type: volume
source: .history
target: /.history
read_only: false
# The services that need to be ready before this one
depends_on:
- database
- channel-layer
- session-store
- communication-store
- application-store
- message-broker
# Connect to the custom default network
networks:
- network
internet-server: # Django = Gunicorn + Daphne
# Use the Django image we made ourselves by running ./scripts/build/django.sh
image: omniport-django:latest
# No matter what, if the container stops, start it again
restart: always
# Expose the ports 8000 and 8001 used by Gunicorn and Daphne to other containers
expose:
- "8000"
- "8001"
# Run the container as the non-root user
user: django
# Set the SITE_ID environment variable so that the right YAML is processed
environment:
- SITE_ID=2
- NAME=internet-server
command: ["supervisord", "-c", "/supervisord.conf"]
# Mount the volumes on the Django container
volumes:
# Mount the code from the 'omniport' folder in the root of the container
- type: bind
source: ./codebase/omniport-backend/omniport
target: /omniport
read_only: true
# Mount the YAML files from the 'configuration' folder in the root of the container
- type: bind
source: ./codebase/omniport-backend/configuration
target: /configuration
read_only: true
# Mount the imagery from the 'branding' folder in the root of the container
- type: bind
source: ./codebase/omniport-backend/branding
target: /branding
read_only: true
# Mount the third-party service certificates from the 'certificates' folder in the root of the container
- type: bind
source: ./codebase/omniport-backend/certificates
target: /certificates
read_only: true
# Mount a network storage form the 'network_storage' folder in the root of the container
- type: bind
source: ./codebase/omniport-backend/network_storage
target: /network_storage
read_only: false
# Mount 'static_files' as its namesake in the root of the container
- type: volume
source: static_files
target: /static_files
read_only: false
# Mount 'media_files' as its namesake in the root of the container
- type: volume
source: media_files
target: /media_files
read_only: false
# Mount 'personal_files' as its namesake in the root of the container
- type: volume
source: personal_files
target: /personal_files
read_only: false
# Mount 'supervisor.d' as its namesake in the root of the container
- type: volume
source: supervisor.d
target: /supervisor.d
read_only: false
# Mount 'web_server_logs' as its namesake in the root of the container
- type: volume
source: web_server_logs
target: /web_server_logs
read_only: false
# Mount '.history' as its namesake in the root of the container
- type: volume
source: .history
target: /.history
read_only: false
# The services that need to be ready before this one
depends_on:
- database
- channel-layer
- session-store
- communication-store
- application-store
- message-broker
# Connect to the custom default network
networks:
- network
reverse-proxy: # NGINX
# Use the NGINX image we made ourselves by running ./scripts/build/nginx.sh
image: omniport-nginx:latest
# No matter what, if the container stops, start it again
restart: always
# Expose the port 80 and 443 used by NGINX to other containers
expose:
- "80"
- "443"
# Expose the ports 80 and 443 used by NGINX to the host
ports:
- "80:80"
- "443:443"
# Mount the volumes on the NGINX container
volumes:
# Mount the imagery from the 'branding' folder in the root of the container
- type: bind
source: ./codebase/omniport-backend/branding
target: /branding
read_only: true
# Mount 'build' as 'frontend' in the root of the container
- type: bind
source: ./codebase/omniport-frontend/omniport/build
target: /frontend
read_only: true
# Mount 'network_storage' as 'network_storage' in the root of the container
- type: bind
source: ./codebase/omniport-backend/network_storage
target: /network_storage
read_only: true
# Mount 'cert' as 'cert' in the root of the container
- type: bind
source: ./cert
target: /cert
read_only: true
# Mount 'static_files' as its namesake in the root of the container
- type: volume
source: static_files
target: /static_files
read_only: true
# Mount 'media_files' as its namesake in the root of the container
- type: volume
source: media_files
target: /media_files
read_only: true
# Mount 'personal_files' as its namesake in the root of the container
- type: volume
source: personal_files
target: /personal_files
read_only: true
# Mount 'reverse_proxy_logs' as its namesake in the root of the container
- type: volume
source: reverse_proxy_logs
target: /reverse_proxy_logs
read_only: false
# The services that need to be ready before this one
depends_on:
- intranet-server
- internet-server
# Connect to the custom default network
networks:
- network
# Volumes are virtual drives connected to containers
volumes:
# This volume contains the database and PostgreSQL configuration files
database:
# This volume contains periodic dumps of the database for backup
database_backup:
# This volume contains reverse proxy logs
reverse_proxy_logs:
# This volume contains web server logs
web_server_logs:
# This volume contains the static files
static_files:
# This volume contains the media files
media_files:
# This volume contains periodic dumps of the media files for backup
media_files_backup:
# This volume contains the personal media files
personal_files:
# This volume contains periodic dumps of the personal files for backup
personal_files_backup:
# This volume contains the supervisor.d conf files
supervisor.d:
# This volume contains the history files
.history:
# RabbitMQ needs a volume at /var/lib/rabbitmq/
rabbitmq_data:
# Periodic dumps taken by Redis acting as channel layer
channel_layer:
# Periodic dumps taken by Redis acting as session store
session_store:
# Periodic dumps taken by Redis acting as communication store
communication_store:
# Periodic dumps taken by Redis acting as verification store
verification_store:
# Periodic dumps taken by Redis acting as application store
application_store:
# Networks specify how containers communicate with each other and the host
networks:
# Create a network to override Docker's ambiguously named default
network: