-
Notifications
You must be signed in to change notification settings - Fork 49
Expand file tree
/
Copy pathcompose.yaml
More file actions
1114 lines (1029 loc) · 34.5 KB
/
compose.yaml
File metadata and controls
1114 lines (1029 loc) · 34.5 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
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
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
# This document uses the open "Docker Compose V2" file specification.
# More info: https://www.compose-spec.io and https://github.com/compose-spec/compose-spec/blob/master/spec.md
# Please note this is different from the "Compose file version 2" specification. Which is for Docker Compose V1.
# Hence no `version` is specified in this file.
services:
# nginx proxy container, also runs certbot
webserver:
platform: linux/amd64
image: ${DOCKER_IMAGE_WEBSERVER:-${DOCKER_REGISTRY:-ghcr.io/internetstandards}/webserver:${RELEASE}}
restart: unless-stopped
logging:
driver: $LOGGING_DRIVER
options:
tag: '{{.Name}}'
mem_limit: $DEFAULT_MEMORY_LIMIT
# disable swap by settings swap to the memory limit
memswap_limit: $DEFAULT_MEMORY_LIMIT
networks:
internal:
public-internet: {}
ports:
- $WEBSERVER_PORT
- $WEBSERVER_PORT_TLS/tcp
- $WEBSERVER_PORT_TLS/udp
- $WEBSERVER_PORT_IPV6/tcp
- $WEBSERVER_PORT_IPV6_TLS/tcp
- $WEBSERVER_PORT_IPV6_TLS/udp
environment:
- INTERNETNL_DOMAINNAME
- IPV6_TEST_ADDR
- MONITORING_AUTH_RAW
- AUTH_ALL_URLS
- ALLOW_LIST
# required for authentication.sh to restrict access when debug is on
- DEBUG
- ENABLE_BATCH
- LETSENCRYPT_STAGING
- LETSENCRYPT_EMAIL
- CERTBOT_SERVER
- CERTBOT_EAB_KID
- CERTBOT_EAB_HMAC_KEY
- REDIRECT_DOMAINS
- NGINX_PROXY_CACHE
- INTERNETNL_BRANDING
- LANGUAGES
# webserver does not depend on any of the other services directly. So it can
# be started and kept running independently from the other services to
# provide stale cache or a maintenance page.
depends_on: {}
volumes:
# persist certbot configuration between restarts
- certbot-config:/etc/letsencrypt
- htpasswd-files:/etc/nginx/htpasswd/external
- nginx-logs-exporter:/var/log/nginx/prometheus-nginxlog-exporter/
healthcheck:
test: ["CMD", "service", "nginx", "status"]
interval: $HEALTHCHECK_INTERVAL
start_interval: $HEALTHCHECK_START_INTERVAL
start_period: 1m
retries: 10
# django container
app:
platform: linux/amd64
image: ${DOCKER_IMAGE_APP:-${DOCKER_REGISTRY:-ghcr.io/internetstandards}/internet.nl:${RELEASE}}
restart: unless-stopped
logging:
driver: $LOGGING_DRIVER
options:
tag: '{{.Name}}'
mem_limit: $HIGH_MEMORY_LIMIT
# disable swap by settings swap to the memory limit
memswap_limit: $HIGH_MEMORY_LIMIT
networks:
internal:
public-internet: {}
entrypoint: uwsgi
command: >
--module=internetnl.wsgi:application
--http=0.0.0.0:8080
--master
--processes=4
--stats 127.0.0.1:1717 --stats-http
depends_on:
db-migrate:
# wait for DB migration to be completed
condition: service_completed_successfully
redis:
condition: service_healthy
rabbitmq:
condition: service_healthy
postgres:
condition: service_healthy
unbound:
condition: service_healthy
required: false
resolver-validating:
# restart this service when the resolver is restarted and possibly has a new IP, so the old IP is no longer used
restart: true
condition: service_healthy
# set hostname for Sentry
hostname: app
environment:
- INTERNET_NL_CHECK_SUPPORT_IPV6
- INTERNET_NL_CHECK_SUPPORT_DNSSEC
- INTERNET_NL_CHECK_SUPPORT_MAIL
- INTERNET_NL_CHECK_SUPPORT_TLS
- INTERNET_NL_CHECK_SUPPORT_APPSECPRIV
- INTERNET_NL_CHECK_SUPPORT_RPKI
- PUBLIC_SUFFIX_LIST_URL
- ENABLE_BATCH
- ENABLE_HOF
- RABBIT_HOST=rabbitmq:15672
- SECRET_KEY
- GENERATE_SECRET_KEY
- DB_HOST=postgres
- DB_NAME=internetnl_db1
- DB_USER=internetnl
- DB_PASSWORD=password
- CELERY_BROKER_URL=amqp://guest:guest@rabbitmq:5672//
- CELERY_RESULT_BACKEND=redis://redis:6379/0
- CACHE_LOCATION=redis://redis:6379/0
- ROUTINATOR_URL
- DJANGO_IS_PROXIED=True
- STATSD_HOST=statsd
- ALLOWED_HOSTS
- DEBUG
- DEBUG_LOG
- DEBUG_LOG_UNBOUND
- INTEGRATION_TESTS
- INTERNETNL_LOG_LEVEL
- INTERNETNL_CACHE_TTL
- CONN_TEST_DOMAIN
- SMTP_EHLO_DOMAIN
- IPV6_TEST_ADDR
- SENTRY_DSN
- SENTRY_ENVIRONMENT
- SENTRY_SERVER_NAME
- MATOMO_URL
- MATOMO_SITEID
- MATOMO_SUBDOMAIN_TRACKING
- MANUAL_HOF_PAGES
- CLIENT_RATE_LIMIT
- INTERNETNL_BRANDING
- INTERNETNL_DOMAINNAME
- USER_AGENT_URL
- LANGUAGES
- PAGE_CACHE_TIME_SECONDS
healthcheck:
test: ["CMD", "nc", "-z", "127.0.0.1", "8080"]
interval: $HEALTHCHECK_INTERVAL
start_interval: $HEALTHCHECK_START_INTERVAL
start_period: 1m
retries: 10
volumes:
- batch_results:/app/batch_results
- manual-hof:/app/manual-hall-of-fame/
# django DB migrations, runs to completion and exits with 0
db-migrate:
platform: linux/amd64
image: ${DOCKER_IMAGE_APP:-${DOCKER_REGISTRY:-ghcr.io/internetstandards}/internet.nl:${RELEASE}}
networks:
- internal
command: migrate
# this container runs to completion and exits with 0
restart: on-failure
logging:
driver: $LOGGING_DRIVER
options:
tag: '{{.Name}}'
depends_on:
postgres:
condition: service_healthy
environment:
- RABBIT_HOST=rabbitmq:15672
- SECRET_KEY
- GENERATE_SECRET_KEY
- DB_HOST=postgres
- DB_NAME=internetnl_db1
- DB_USER=internetnl
- DB_PASSWORD=password
# disable redis cache as it is not used in db migrations
- CACHE_LOCATION=
# disable batch checks
- ENABLE_BATCH=False
- ENABLE_HOF=False
- DEBUG
- DEBUG_LOG
- DEBUG_LOG_UNBOUND
- INTERNETNL_LOG_LEVEL
- INTERNETNL_CACHE_TTL
- WORKER_CONCURRENCY
worker: &worker
platform: linux/amd64
image: ${DOCKER_IMAGE_APP:-${DOCKER_REGISTRY:-ghcr.io/internetstandards}/internet.nl:${RELEASE}}
deploy:
replicas: $WORKER_REPLICAS
restart: unless-stopped
mem_limit: $WORKER_MEMORY_LIMIT
# disable swap by setting swap to the memory limit
memswap_limit: $WORKER_MEMORY_LIMIT
logging:
driver: $LOGGING_DRIVER
options:
tag: '{{.Name}}'
networks:
- internal
- public-internet
# run as root because permission need to be set on batch_results directory, drop privileges in entrypoint.sh
user: root
entrypoint: /entrypoint-worker.sh
command: celery --app internetnl worker --without-gossip --pool=eventlet --time-limit=300 --concurrency=$WORKER_CONCURRENCY
--queues default,celery,db_worker,ipv6_worker,mail_worker,web_worker,resolv_worker,dnssec_worker,rpki_worker,batch_main,batch_callback,batch_scheduler
# time after which a SIGKILL is sent to celery after a SIGTERM (warm shutdown), default 10s
# insufficient short grace period causes issues on batch when tasks are killed during the hourly worker restart
stop_grace_period: 10m
depends_on:
db-migrate:
# wait for DB migration to be completed
condition: service_completed_successfully
redis:
condition: service_healthy
rabbitmq:
condition: service_healthy
postgres:
condition: service_healthy
routinator:
# TODO: convert to service_healthy when healthcheck is added to routinator
condition: service_started
# routinator can sometimes be disabled in profiles
required: false
unbound:
condition: service_healthy
required: false
resolver-validating:
# restart this service when the resolver is restarted and possibly has a new IP, so the old IP is no longer used
restart: true
condition: service_healthy
# set hostname for Sentry
hostname: worker
environment:
- INTERNET_NL_CHECK_SUPPORT_IPV6
- INTERNET_NL_CHECK_SUPPORT_DNSSEC
- INTERNET_NL_CHECK_SUPPORT_MAIL
- INTERNET_NL_CHECK_SUPPORT_TLS
- INTERNET_NL_CHECK_SUPPORT_APPSECPRIV
- INTERNET_NL_CHECK_SUPPORT_RPKI
- PUBLIC_SUFFIX_LIST_URL
- ENABLE_BATCH
- ENABLE_HOF
- RABBIT_HOST=rabbitmq:15672
- SECRET_KEY
- GENERATE_SECRET_KEY
- DB_HOST=postgres
- DB_NAME=internetnl_db1
- DB_USER=internetnl
- DB_PASSWORD=password
- CELERY_BROKER_URL=amqp://guest:guest@rabbitmq:5672//
- CELERY_RESULT_BACKEND=redis://redis:6379/0
- CACHE_LOCATION=redis://redis:6379/0
- DJANGO_SETTINGS_MODULE=internetnl.settings
- STATSD_HOST=statsd
- DEBUG
- DEBUG_LOG
- DEBUG_LOG_UNBOUND
- CELERY_LOG_LEVEL
- INTEGRATION_TESTS
- INTERNETNL_LOG_LEVEL
- INTERNETNL_CACHE_TTL
- ROUTINATOR_URL
- CONN_TEST_DOMAIN
- SMTP_EHLO_DOMAIN
- INTERNETNL_BRANDING
- INTERNETNL_DOMAINNAME
- USER_AGENT_URL
- SENTRY_DSN
- SENTRY_ENVIRONMENT
- SENTRY_SERVER_NAME
# even though eventlet is used and childs are not really threads or processes, this settings reduces
# issues with high memory usage, probably because some objects are freed?
- CELERYD_MAX_TASKS_PER_CHILD=100
volumes:
- batch_results:/app/batch_results
healthcheck:
test: ["CMD", "/bin/sh", "-c", "celery --app=internetnl inspect ping --destination=celery@$(hostname)"]
interval: $HEALTHCHECK_INTERVAL
start_interval: $HEALTHCHECK_START_INTERVAL
start_period: 1m
retries: 10
# worker for queue with potential memory leak
worker-nassl:
# copy all attributes from 'worker' service and overwrite specific settings below
<<: *worker
mem_limit: $WORKER_NASSL_MEMORY_LIMIT
# disable swap by settings swap to the memory limit
memswap_limit: $WORKER_NASSL_MEMORY_LIMIT
command: celery --app internetnl worker --without-gossip --pool=eventlet --time-limit=300 --concurrency=$WORKER_CONCURRENCY
--queues nassl_worker,batch_nassl
# set hostname for Sentry
hostname: worker-nassl
# required because current version of nassl cannot be compile for ARM (eg: Apple Silicon)
platform: linux/amd64
# worker for slow and long running tasks that could require a lot of memory (eg: hof update)
worker-slow:
# copy all attributes from 'worker' service and overwrite specific settings below
<<: *worker
mem_limit: $WORKER_SLOW_MEMORY_LIMIT
# disable swap by settings swap to the memory limit
memswap_limit: $WORKER_SLOW_MEMORY_LIMIT
deploy:
replicas: $WORKER_SLOW_REPLICAS
command: celery --app internetnl worker --without-gossip --pool=eventlet --time-limit=600 --concurrency=$WORKER_SLOW_CONCURRENCY
--queues slow_db_worker,batch_slow
# celery task queue
beat:
platform: linux/amd64
image: ${DOCKER_IMAGE_APP:-${DOCKER_REGISTRY:-ghcr.io/internetstandards}/internet.nl:${RELEASE}}
restart: unless-stopped
logging:
driver: $LOGGING_DRIVER
options:
tag: '{{.Name}}'
mem_limit: $DEFAULT_MEMORY_LIMIT
# disable swap by settings swap to the memory limit
memswap_limit: $DEFAULT_MEMORY_LIMIT
networks:
- internal
- public-internet
entrypoint: celery
command: --app internetnl beat
depends_on:
db-migrate:
# wait for DB migration to be completed
condition: service_completed_successfully
redis:
condition: service_healthy
rabbitmq:
condition: service_healthy
postgres:
condition: service_healthy
routinator:
# TODO: convert to service_healthy when healthcheck is added to routinator
condition: service_started
# routinator can sometimes be disabled in profiles
required: false
environment:
- INTERNET_NL_CHECK_SUPPORT_IPV6
- INTERNET_NL_CHECK_SUPPORT_DNSSEC
- INTERNET_NL_CHECK_SUPPORT_MAIL
- INTERNET_NL_CHECK_SUPPORT_TLS
- INTERNET_NL_CHECK_SUPPORT_APPSECPRIV
- INTERNET_NL_CHECK_SUPPORT_RPKI
- ENABLE_BATCH
- ENABLE_HOF
- RABBIT_HOST=rabbitmq:15672
- SECRET_KEY
- GENERATE_SECRET_KEY
- DB_HOST=postgres
- DB_NAME=internetnl_db1
- DB_USER=internetnl
- DB_PASSWORD=password
- CELERY_BROKER_URL=amqp://guest:guest@rabbitmq:5672//
- CELERY_RESULT_BACKEND=redis://redis:6379/0
- CACHE_LOCATION=redis://redis:6379/0
- DJANGO_SETTINGS_MODULE=internetnl.settings
- STATSD_HOST=statsd
- DEBUG
- DEBUG_LOG
- DEBUG_LOG_UNBOUND
- INTEGRATION_TESTS
- INTERNETNL_LOG_LEVEL
- INTERNETNL_CACHE_TTL
- ROUTINATOR_URL
- CONN_TEST_DOMAIN
- SMTP_EHLO_DOMAIN
- BATCH_SCHEDULER_INTERVAL
- SENTRY_DSN
- SENTRY_ENVIRONMENT
- SENTRY_SERVER_NAME
healthcheck:
test: ["CMD", "pgrep", "-f", "celery"]
interval: $HEALTHCHECK_INTERVAL
start_interval: $HEALTHCHECK_START_INTERVAL
start_period: 1m
retries: 10
# redis caches state, also used for:
# - MAC address lookup
# - Django page cache
# - client DNS resolver IPs in connectiontest
redis:
image: ${DOCKER_IMAGE_REDIS}
restart: unless-stopped
logging:
driver: $LOGGING_DRIVER
options:
tag: '{{.Name}}'
mem_limit: $DEFAULT_MEMORY_LIMIT
# disable swap by settings swap to the memory limit
memswap_limit: $DEFAULT_MEMORY_LIMIT
networks:
internal:
healthcheck:
test: ["CMD", "redis-cli","ping"]
interval: $HEALTHCHECK_INTERVAL
start_interval: $HEALTHCHECK_START_INTERVAL
start_period: 1m
retries: 10
volumes:
- redis:/data
# rabbitmq message-broker
rabbitmq:
image: ${DOCKER_IMAGE_RABBITMQ}
configs:
- source: rabbitmq_config
target: /etc/rabbitmq/rabbitmq.conf
# permissions should be set correctly, temporary workaround until fix is released:
# https://github.com/docker/compose/pull/12666
mode: 0444
restart: unless-stopped
logging:
driver: $LOGGING_DRIVER
options:
tag: '{{.Name}}'
mem_limit: $DEFAULT_MEMORY_LIMIT
# disable swap by settings swap to the memory limit
memswap_limit: $DEFAULT_MEMORY_LIMIT
user: rabbitmq
networks:
internal:
ports:
# expose admin GUI to localhost
- $RABBITMQ_GUI
healthcheck:
test: ["CMD", "rabbitmq-diagnostics", "--quiet", "check_running"]
interval: $HEALTHCHECK_INTERVAL
start_interval: $HEALTHCHECK_START_INTERVAL
# rabbitmq can initially take a long time to start
start_period: 5m
retries: 10
volumes:
- rabbitmq:/var/lib/rabbitmq
# database
postgres:
image: ${DOCKER_IMAGE_POSTGRES}
restart: unless-stopped
logging:
driver: $LOGGING_DRIVER
options:
tag: '{{.Name}}'
mem_limit: $HIGH_MEMORY_LIMIT
# disable swap by settings swap to the memory limit
memswap_limit: $HIGH_MEMORY_LIMIT
networks:
internal:
environment:
- POSTGRES_USER
- POSTGRES_PASSWORD
- POSTGRES_DB
healthcheck:
test: pg_isready -U $POSTGRES_USER -d $POSTGRES_DB
interval: $HEALTHCHECK_INTERVAL
start_interval: $HEALTHCHECK_START_INTERVAL
start_period: 1m
retries: 10
volumes:
- postgres:/var/lib/postgresql/data
# for RPKI
routinator:
image: ${DOCKER_IMAGE_ROUTINATOR}
restart: unless-stopped
logging:
driver: $LOGGING_DRIVER
options:
tag: '{{.Name}}'
mem_limit: $HIGH_MEMORY_LIMIT
# disable swap by settings swap to the memory limit
memswap_limit: $HIGH_MEMORY_LIMIT
networks:
internal:
public-internet: {}
volumes:
- routinator:/home/routinator/.rpki-cache/
healthcheck:
# verify routinator webserver is responsive
test: wget -q -O/dev/null http://127.0.0.1:9556/
# TODO: should verify the API endpoint status, but because it takes a long time to start
# needs refactoring like splitting up the api and sync parts
# test: wget -q -O/dev/null http://127.0.0.1:9556/api/v1/status
interval: $HEALTHCHECK_INTERVAL
start_interval: $HEALTHCHECK_START_INTERVAL
# routinator has to rsync a lot of data initally which can take a long time
start_period: 30m
retries: 10
profiles:
- routinator
# unbound DNS server used for connection test
unbound:
platform: linux/amd64
image: ${DOCKER_IMAGE_UNBOUND:-${DOCKER_REGISTRY:-ghcr.io/internetstandards}/unbound:${RELEASE}}
depends_on:
redis:
condition: service_healthy
restart: unless-stopped
logging:
driver: $LOGGING_DRIVER
options:
tag: '{{.Name}}'
mem_limit: $DEFAULT_MEMORY_LIMIT
# disable swap by settings swap to the memory limit
memswap_limit: $DEFAULT_MEMORY_LIMIT
networks:
internal:
public-internet: {}
ports:
- $UNBOUND_PORT_TCP
- $UNBOUND_PORT_UDP
- $UNBOUND_PORT_IPV6_TCP
- $UNBOUND_PORT_IPV6_UDP
environment:
- DEBUG_LOG_UNBOUND
- IPV4_IP_PUBLIC
- IPV6_IP_PUBLIC
- CONN_TEST_DOMAIN
volumes:
# stores DNSSEC key information and signed zone files
- unbound-zones:/opt/unbound/etc/unbound/zones/
healthcheck:
test: ["CMD", "unbound-control", "status"]
interval: $HEALTHCHECK_INTERVAL
start_interval: $HEALTHCHECK_START_INTERVAL
start_period: 1m
retries: 10
# unbound resolver used for ldns-dane that require DNSSEC validation
resolver-validating:
platform: linux/amd64
image: ${DOCKER_IMAGE_UNBOUND:-${DOCKER_REGISTRY:-ghcr.io/internetstandards}/unbound:${RELEASE}}
entrypoint: /entrypoint-resolver.sh
command: ["resolver-validating.conf"]
restart: unless-stopped
logging:
driver: $LOGGING_DRIVER
options:
tag: '{{.Name}}'
mem_limit: $DEFAULT_MEMORY_LIMIT
# disable swap by settings swap to the memory limit
memswap_limit: $DEFAULT_MEMORY_LIMIT
networks:
internal:
public-internet: {}
environment:
- DEBUG_LOG_UNBOUND
- INTERNETNL_CACHE_TTL
healthcheck:
test: ["CMD", "unbound-control", "-c", "/opt/unbound/etc/unbound/resolver-validating.conf", "status"]
interval: $HEALTHCHECK_INTERVAL
start_interval: $HEALTHCHECK_START_INTERVAL
start_period: 1m
retries: 10
# cron with periodic tasks
cron:
platform: linux/amd64
image: ${DOCKER_IMAGE_UTIL:-${DOCKER_REGISTRY:-ghcr.io/internetstandards}/util:${RELEASE}}
command: crond -f -d7
environment:
- HOSTERS_HOF_URL
- DB_HOST=postgres
- DB_NAME=internetnl_db1
- DB_USER=internetnl
- DB_PASSWORD=password
- CRON_DAILY_POSTGRESQL_BACKUP
- CRON_WEEKLY_POSTGRESQL_BACKUP
- CRON_DAILY_DELETE_BATCH_RESULTS
- CRON_15MIN_RUN_TESTS
- CRON_DAILY_TRUNCATE_EXPORTER_LOGS
- INTERNETNL_DOMAINNAME
- INTERNETNL_CACHE_TTL
- TEST_DOMAINS_SITE
- TEST_DOMAINS_MAIL
restart: unless-stopped
logging:
driver: $LOGGING_DRIVER
options:
tag: '{{.Name}}'
mem_limit: $DEFAULT_MEMORY_LIMIT
# disable swap by settings swap to the memory limit
memswap_limit: $DEFAULT_MEMORY_LIMIT
networks:
internal: {}
public-internet: {}
volumes:
- manual-hof:/app/manual-hall-of-fame/
- postgres-backups:/var/lib/postgresql/backups
- nginx-logs-exporter:/var/log/nginx/prometheus-nginxlog-exporter/
- prometheus-textfile-directory:/prometheus-textfile-directory
- batch_results:/app/batch_results
healthcheck:
test: ["CMD", "pgrep", "crond"]
interval: $HEALTHCHECK_INTERVAL
start_interval: $HEALTHCHECK_START_INTERVAL
start_period: 1m
retries: 10
# cron daemon with access to Docker socket but no networking
cron-docker:
platform: linux/amd64
image: ${DOCKER_IMAGE_UTIL:-${DOCKER_REGISTRY:-ghcr.io/internetstandards}/util:${RELEASE}}
command: crond -f -d7 -c /etc/crontabs-docker
environment:
- AUTO_UPDATE_TO
- WORKER_SLOW_REPLICAS
- DOCKER_REGISTRY
- CRON_DAILY_DATABASE_CLEANUP
- CRON_WORKER_RESTART
- INTERNETNL_INSTALL_BASE
restart: unless-stopped
logging:
driver: $LOGGING_DRIVER
options:
tag: '{{.Name}}'
mem_limit: $DEFAULT_MEMORY_LIMIT
# disable swap by settings swap to the memory limit
memswap_limit: $DEFAULT_MEMORY_LIMIT
network_mode: "none"
volumes:
- /var/run/docker.sock:/var/run/docker.sock
- $INTERNETNL_INSTALL_BASE:/opt/Internet.nl
grafana:
platform: linux/amd64
image: ${DOCKER_IMAGE_GRAFANA:-${DOCKER_REGISTRY:-ghcr.io/internetstandards}/grafana:${RELEASE}}
environment:
- GF_AUTH_ANONYMOUS_ENABLED=true
- GF_AUTH_ANONYMOUS_ORG_NAME=Main Org.
- GF_AUTH_ANONYMOUS_ORG_ROLE=Admin
- GF_AUTH_BASIC_ENABLED=false
- GF_AUTH_DISABLE_LOGIN_FORM=true
- GF_AUTH_DISABLE_SIGNOUT_MENU=true
- GF_USERS_ALLOW_SIGN_UP=false
- GF_DASHBOARDS_DEFAULT_HOME_DASHBOARD_PATH=/etc/dashboards/home.json
- GF_SERVER_ROOT_URL=http://localhost:8080/grafana/
- GF_SERVER_SERVE_FROM_SUB_PATH=true
# disable grafana from trying to reach out and filling logging with failed DNS queries
- GF_ANALYTICS_CHECK_FOR_UPDATES=false
- GF_ANALYTICS_REPORTING_ENABLED=false
- GF_ANALYTICS_CHECK_FOR_PLUGIN_UPDATES=false
# disables live functionality which is not used, because it uses websockets which don't play well with authentication
- GF_LIVE_MAX_CONNECTIONS=0
- INTERNETNL_DOMAINNAME
volumes:
- grafana-data:/var/lib/grafana
restart: unless-stopped
logging:
driver: $LOGGING_DRIVER
options:
tag: '{{.Name}}'
mem_limit: $DEFAULT_MEMORY_LIMIT
# disable swap by settings swap to the memory limit
memswap_limit: $DEFAULT_MEMORY_LIMIT
networks:
internal:
profiles:
- monitoring
prometheus:
image: ${DOCKER_IMAGE_PROMETHEUS}
command:
- --config.file=/prometheus.yaml
- --web.external-url=/prometheus/
- --storage.tsdb.retention.time=$PROMETHEUS_RETENTION_TIME
- --storage.tsdb.retention.size=$PROMETHEUS_RETENTION_SIZE
- --web.enable-admin-api
configs:
- source: prometheus_config
target: /prometheus.yaml
# permissions should be set correctly, temporary workaround until fix is released:
# https://github.com/docker/compose/pull/12666
mode: 0444
- source: prometheus_rules_config
target: /prometheus-rules.yaml
# permissions should be set correctly, temporary workaround until fix is released:
# https://github.com/docker/compose/pull/12666
mode: 0444
restart: unless-stopped
logging:
driver: $LOGGING_DRIVER
options:
tag: '{{.Name}}'
mem_limit: $DEFAULT_MEMORY_LIMIT
# disable swap by settings swap to the memory limit
memswap_limit: $DEFAULT_MEMORY_LIMIT
networks:
internal:
volumes:
- prometheus-data:/prometheus
profiles:
- monitoring
# requires monitoring profile
alertmanager:
image: ${DOCKER_IMAGE_PROMETHEUS_ALERTMANAGER}
command:
- --config.file=/alertmanager.yaml
- --web.external-url=https://$INTERNETNL_DOMAINNAME/alertmanager/
- --cluster.listen-address=
configs:
- source: alertmanager_config
target: /alertmanager.yaml
# permissions should be set correctly, temporary workaround until fix is released:
# https://github.com/docker/compose/pull/12666
mode: 0444
restart: unless-stopped
logging:
driver: $LOGGING_DRIVER
options:
tag: '{{.Name}}'
networks:
internal:
public-internet: {}
profiles:
- alertmanager
postgresql-exporter:
image: ${DOCKER_IMAGE_POSTGRESQL_EXPORTER}
environment:
- DATA_SOURCE_NAME=postgresql://$POSTGRES_USER:$POSTGRES_PASSWORD@postgres:5432/$POSTGRES_DB?sslmode=disable
restart: unless-stopped
logging:
driver: $LOGGING_DRIVER
options:
tag: '{{.Name}}'
mem_limit: $DEFAULT_MEMORY_LIMIT
# disable swap by settings swap to the memory limit
memswap_limit: $DEFAULT_MEMORY_LIMIT
networks:
- internal
profiles:
- monitoring
redis-exporter:
image: ${DOCKER_IMAGE_REDIS_EXPORTER}
environment:
- REDIS_ADDR=redis://redis:6379
restart: unless-stopped
logging:
driver: $LOGGING_DRIVER
options:
tag: '{{.Name}}'
mem_limit: $DEFAULT_MEMORY_LIMIT
# disable swap by settings swap to the memory limit
memswap_limit: $DEFAULT_MEMORY_LIMIT
networks:
- internal
profiles:
- monitoring
statsd-exporter:
image: ${DOCKER_IMAGE_STATSD_EXPORTER}
command:
- --statsd.listen-udp=:8125
- --statsd.listen-tcp=:8125
restart: unless-stopped
logging:
driver: $LOGGING_DRIVER
options:
tag: '{{.Name}}'
mem_limit: $DEFAULT_MEMORY_LIMIT
# disable swap by settings swap to the memory limit
memswap_limit: $DEFAULT_MEMORY_LIMIT
networks:
internal:
aliases:
- statsd
profiles:
- monitoring
celery-exporter:
platform: linux/amd64
image: ${DOCKER_IMAGE_CELERY_EXPORTER}
command:
- --broker-url=amqp://guest:guest@rabbitmq:5672/
- --accept-content=json,pickle
# retry connecting to broker on failure
- --retry-interval=10
restart: unless-stopped
logging:
driver: $LOGGING_DRIVER
options:
tag: '{{.Name}}'
mem_limit: $DEFAULT_MEMORY_LIMIT
# disable swap by settings swap to the memory limit
memswap_limit: $DEFAULT_MEMORY_LIMIT
networks:
- internal
depends_on:
rabbitmq:
condition: service_healthy
profiles:
- monitoring
node-exporter:
# https://github.com/prometheus/node_exporter#docker
image: ${DOCKER_IMAGE_NODE_EXPORTER}
command:
- --path.rootfs=/host
- --collector.systemd
# disable metrics about the exporter itself
- --web.disable-exporter-metrics
# ignore docker container interfaces
- --collector.netdev.device-exclude=veth
# ignore docker container interfaces
- --collector.netclass.ignored-devices=veth
- --collector.textfile
- --collector.textfile.directory=/prometheus-textfile-directory
restart: unless-stopped
logging:
driver: $LOGGING_DRIVER
options:
tag: '{{.Name}}'
mem_limit: $DEFAULT_MEMORY_LIMIT
# disable swap by settings swap to the memory limit
memswap_limit: $DEFAULT_MEMORY_LIMIT
pid: host
networks:
- internal
volumes:
- /:/host:ro
- /var/run/dbus/system_bus_socket:/var/run/dbus/system_bus_socket
- prometheus-textfile-directory:/prometheus-textfile-directory
profiles:
- monitoring
docker_stats_exporter:
# https://github.com/jan4843/docker_stats_exporter
platform: linux/amd64
image: ${DOCKER_IMAGE_DOCKER_STATSD_EXPORTER}
environment:
LABEL_state: '{{.Container.State}}'
LABEL_compose_project: '{{index .Container.Labels "com.docker.compose.project"}}'
restart: unless-stopped
logging:
driver: $LOGGING_DRIVER
options:
tag: '{{.Name}}'
mem_limit: $DEFAULT_MEMORY_LIMIT
# disable swap by settings swap to the memory limit
memswap_limit: $DEFAULT_MEMORY_LIMIT
networks:
- internal
volumes:
- /var/run/docker.sock:/var/run/docker.sock
profiles:
- monitoring
nginx_logs_exporter:
platform: linux/amd64
image: ${DOCKER_IMAGE_NGINX_LOGS_EXPORTER}
command:
- -config-file=/config.hcl
configs:
- source: nginx_logs_exporter_config
target: /config.hcl
# permissions should be set correctly, temporary workaround until fix is released:
# https://github.com/docker/compose/pull/12666
mode: 0444
restart: unless-stopped
logging:
driver: $LOGGING_DRIVER
options:
tag: '{{.Name}}'
mem_limit: $DEFAULT_MEMORY_LIMIT
# disable swap by settings swap to the memory limit
memswap_limit: $DEFAULT_MEMORY_LIMIT
networks:
- internal
volumes:
- nginx-logs-exporter:/var/log/nginx/prometheus-nginxlog-exporter/
profiles:
- monitoring
volumes:
postgres: {}
postgres-backups: {}
redis: {}
rabbitmq: {}
routinator: {}
batch_results: {}
certbot-config: {}
htpasswd-files: {}
unbound-zones: {}
# permanent storage for Prometheus metrics
prometheus-data: {}
# prometheus metric textfile shared volume
prometheus-textfile-directory: {}
# permanent storage for Grafana custom dashboards
grafana-data: {}
# shares hosters HoF file between cron and app
manual-hof: {}
# shares nginx log files with log exporter
nginx-logs-exporter: {}
configs:
nginx_logs_exporter_config:
content: |
namespace "nginx" {
format = "$$remote_addr $$host $$remote_user [$$time_local] $$proxy_host \"$$request\" $$status $$body_bytes_sent \"$$http_referer\" \"$$http_user_agent\" \"$$http_x_forwarded_for\""
source = {
files = ["/var/log/nginx/prometheus-nginxlog-exporter/access.log"]
}
relabel "proxy_host" { from = "proxy_host" }
relabel "remote_user" { from = "remote_user" }
}
rabbitmq_config:
content: |
# RabbitMQ requires messages to be acked in 30 minutes or else it will mark a client as stale. This conflicts
# with Celery tasks that have a countdown or eta set beyond 30 minutes as they are not acked before this time.
# Setting this timeout to 1 year here to work around this issue. Related error and info:
# amqp.exceptions.PreconditionFailed: (0, 0): (406) PRECONDITION_FAILED - consumer ack timed out on channel 1
# https://github.com/celery/celery/issues/6760
consumer_timeout = 31622400000
prometheus_config:
content: |
global:
scrape_interval: 10s
scrape_timeout: 5s
rule_files:
- /prometheus-rules.yaml
alerting:
alertmanagers:
- path_prefix: /alertmanager
static_configs:
- targets:
- alertmanager:9093