-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdocker-compose.yml
1738 lines (1691 loc) · 60.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
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
# version: "3"
########################### NETWORKS
networks:
default:
driver: bridge
# https://mlohr.com/docker-mtu/
# driver_opts:
# com.docker.network.driver.mtu: 1454
ipam:
config:
- subnet: 172.18.0.0/24
traefik:
name: traefik
driver: bridge
ipam:
config:
- subnet: 172.19.0.0/24
pihole:
name: pihole
driver: bridge
ipam:
config:
- subnet: 172.20.0.0/24
metrics:
name: metrics
driver: bridge
ipam:
config:
- subnet: 172.21.0.0/24
socket_proxy:
name: socket_proxy
driver: bridge
ipam:
config:
- subnet: 172.22.0.0/24
########################### EXTENSION FIELDS
#
# Common environment values
x-environment: &default-tz-puid-pgid
TZ: $TZ
PUID: $PUID
PGID: $PGID
########################### SERVICES
services:
# Homepage/bookmark service
heimdall:
container_name: heimdall
image: linuxserver/heimdall:latest
restart: unless-stopped
entrypoint:
- /init
environment:
<<: *default-tz-puid-pgid
PATH: "/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
S6_BEHAVIOUR_IF_STAGE2_FAILS: 2
networks:
- traefik
ports:
- "$HEIMDALL_PORT:80/tcp"
volumes:
- $DOCKERDIR/heimdall:/config
labels:
## Auto-update
com.centurylinklabs.watchtower.enable: true
## Traefik
traefik.enable: true
traefik.docker.network: traefik
traefik.http.routers.heimdall-rtr.entrypoints: https
traefik.http.routers.heimdall-rtr.rule: Host(`heimdall.$DOMAINNAME`)
traefik.http.routers.heimdall-rtr.tls.certresolver: dns-cloudflare
traefik.http.routers.heimdall-rtr.middlewares: chain-oauth@file
traefik.http.routers.heimdall-rtr.service: heimdall-svc
traefik.http.services.heimdall-svc.loadbalancer.server.port: 80
healthcheck:
test: ["CMD", "curl", "-slIf", "http://localhost"]
interval: 120s
timeout: 10s
retries: 4
# Homepage - Application Dashboard
homepage:
image: ghcr.io/gethomepage/homepage:latest
container_name: homepage
security_opt:
- no-new-privileges:true
restart: unless-stopped
networks:
- traefik
- socket_proxy
ports:
- "$HOMEPAGE_PORT:3000"
volumes:
- $DOCKERDIR/homepage:/app/config
environment:
<<: *default-tz-puid-pgid
labels:
## Auto-update
com.centurylinklabs.watchtower.enable: true
traefik.enable: true
## HTTP Routers
traefik.http.routers.homepage-rtr.entrypoints: https
traefik.http.routers.homepage-rtr.rule: Host(`homepage.$DOMAINNAME1`) || Host(`www.$DOMAINNAME1`) || Host(`$DOMAINNAME1`)
traefik.http.routers.homepage-rtr.tls.certresolver: dns-cloudflare
traefik.http.routers.homepage-rtr.middlewares: chain-oauth@file
traefik.http.routers.homepage-rtr.service: homepage-svc
traefik.http.services.homepage-svc.loadbalancer.server.port: 3000
esphome:
container_name: esphome
image: ghcr.io/esphome/esphome:stable
restart: unless-stopped
volumes:
- $DOCKERDIR/esphome-config:/config
- "/etc/localtime:/etc/localtime:ro"
privileged: true
environment:
<<: *default-tz-puid-pgid
network_mode: host
# networks:
# - traefik
# ports:
# - "6052:6052/tcp"
labels:
## Auto-update
com.centurylinklabs.watchtower.enable: true
## Traefik (moved to rules file)
# traefik.enable: true
# traefik.docker.network: traefik
# traefik.http.routers.esphome-rtr.entrypoints: https
# traefik.http.routers.esphome-rtr.rule: Host(`esphome.$DOMAINNAME`)
# traefik.http.routers.esphome-rtr.tls.certresolver: dns-cloudflare
# traefik.http.routers.esphome-rtr.middlewares: chain-oauth@file
# traefik.http.routers.esphome-rtr.service: esphome-svc
# traefik.http.services.esphome-svc.loadbalancer.server.port: 6052
# mdns_reflector:
# container_name: mdns_reflector
# image: docker.io/yuxzhu/mdns-reflector:latest
# command: mdns-reflector -fnl info -- eno1 br-59962d08e1b2
# network_mode: host
# restart: no
# # privileged: true
# environment:
# <<: *default-tz-puid-pgid
zwavejs2mqtt:
container_name: zwavejs2mqtt
image: zwavejs/zwave-js-ui:latest
# image: zwavejs/zwave-js-ui:8.22.0
restart: unless-stopped
tty: true
stop_signal: SIGINT
depends_on:
- mosquitto # I don't think this is true
environment:
<<: *default-tz-puid-pgid
# devices:
# - '/dev/serial/by-id/usb-Silicon_Labs_HubZ_Smart_Home_Controller_C1300387-if00-port0:/dev/zwave'
volumes:
- $DOCKERDIR/zwavejs2mqtt:/usr/src/app/store
networks:
- traefik
ports:
- "$ZWAVEJS_WEB_PORT:8091/tcp"
- "$ZWAVEJS_WS_PORT:3000"
labels:
## Auto-update
com.centurylinklabs.watchtower.enable: true
## Traefik
traefik.enable: true
traefik.docker.network: traefik
traefik.http.routers.zwavejs2mqtt-rtr.entrypoints: https
traefik.http.routers.zwavejs2mqtt-rtr.rule: Host(`zwavejs2mqtt.$DOMAINNAME`) || Host(`zwavejs.$DOMAINNAME`)
traefik.http.routers.zwavejs2mqtt-rtr.tls.certresolver: dns-cloudflare
traefik.http.routers.zwavejs2mqtt-rtr.middlewares: chain-oauth@file
traefik.http.routers.zwavejs2mqtt-rtr.service: zwavejs2mqtt-svc
traefik.http.services.zwavejs2mqtt-svc.loadbalancer.server.port: 8091
healthcheck:
test: ["CMD-SHELL", "wget -S -O - --header 'Accept: text/plain' http://localhost:$ZWAVEJS_WEB_PORT/health/zwave"]
interval: 120s
timeout: 10s
retries: 4
mosquitto:
container_name: mosquitto
image: eclipse-mosquitto:latest
restart: unless-stopped
networks:
- default
volumes:
- $DOCKERDIR/mosquitto:/mosquitto
ports:
- "$MOSQUITTO_HTTP_PORT:1883" #http
- "9001:9001" #websockets
environment:
<<: *default-tz-puid-pgid
zigbee2mqtt:
container_name: zigbee2mqtt
image: koenkk/zigbee2mqtt
restart: unless-stopped
depends_on:
- mosquitto
devices:
- '/dev/serial/by-id/usb-1a86_USB_Serial-if00-port0:/dev/ttyUSB0'
networks:
- traefik
extra_hosts:
- "host.docker.internal:$SERVER_IP"
ports:
- "$ZIGBEE2MQTT_WEB_PORT:8080/tcp"
volumes:
- $DOCKERDIR/zigbee2mqtt:/app/data
- /run/udev:/run/udev:ro
environment:
<<: *default-tz-puid-pgid
labels:
## Auto-update
com.centurylinklabs.watchtower.enable: true
## Traefik
traefik.enable: true
traefik.docker.network: traefik
traefik.http.routers.zigbee2mqtt-rtr.entrypoints: https
traefik.http.routers.zigbee2mqtt-rtr.rule: Host(`zigbee2mqtt.$DOMAINNAME`)
traefik.http.routers.zigbee2mqtt-rtr.tls.certresolver: dns-cloudflare
traefik.http.routers.zigbee2mqtt-rtr.middlewares: chain-oauth@file
traefik.http.routers.zigbee2mqtt-rtr.service: zigbee2mqtt-svc
traefik.http.services.zigbee2mqtt-svc.loadbalancer.server.port: 8080
healthcheck:
test: ["CMD-SHELL", "wget -S -O - --header 'Accept: text/plain' http://localhost:8080"]
interval: 120s
timeout: 10s
retries: 4
scrypted:
image: koush/scrypted
container_name: scrypted
restart: unless-stopped
network_mode: host
# networks:
# - traefik
# ports:
# - "$SCRYPTED_PORT:10443/tcp"
environment:
<<: *default-tz-puid-pgid
# uncomment this and a line below as needed.
# devices:
# zwave usb serial device
# - /dev/ttyACM0:/dev/ttyACM0
# all usb devices, such as coral tpu
# - /dev/bus/usb:/dev/bus/usb
volumes:
- $DOCKERDIR/scrypted:/server/volume
# logging is noisy and will unnecessarily wear on flash storage.
# scrypted has per device in memory logging that is preferred.
logging:
driver: "json-file"
options:
max-size: "10m"
max-file: "10"
labels:
## Auto-update
com.centurylinklabs.watchtower.enable: true
## Traefik (moved to rules file)
# traefik.enable: true
# traefik.docker.network: traefik
# traefik.http.routers.scrypted-rtr.entrypoints: https
# traefik.http.routers.scrypted-rtr.rule: Host(`scrypted.$DOMAINNAME`)
# traefik.http.routers.scrypted-rtr.tls.certresolver: dns-cloudflare
# traefik.http.routers.scrypted-rtr.middlewares: chain-oauth@file
# traefik.http.routers.scrypted-rtr.service: scrypted-svc
# traefik.http.services.scrypted-svc.loadbalancer.server.port: 10443
healthcheck:
test: ["CMD", "curl", "-f", "-k", "-L", "https://localhost:10443/"]
interval: 1m30s
timeout: 10s
retries: 3
home-assistant:
image: homeassistant/home-assistant:stable
container_name: home-assistant
restart: unless-stopped
depends_on:
- zwavejs2mqtt
- zigbee2mqtt
volumes:
- $DOCKERDIR/home-assistant:/config
- /run/dbus:/run/dbus:ro # enable bluetooth
# devices:
# - '/dev/serial/by-id/usb-Silicon_Labs_HubZ_Smart_Home_Controller_C1300387-if01-port0:/dev/zigbee'
# - '/sys/class/bluetooth/hci0/device:/dev/bluetooth'
network_mode: "host"
# ports:
# - "$HOMEASSISTANT_PORT:8123/tcp"
environment:
<<: *default-tz-puid-pgid
labels:
## Auto-update
com.centurylinklabs.watchtower.enable: true
## Traefik (moved to rules file)
# traefik.enable: true
# traefik.docker.network: traefik
# traefik.http.routers.homeassistant-rtr.entrypoints: https
# traefik.http.routers.homeassistant-rtr.rule: Host(`homeassistant.$DOMAINNAME`)
# traefik.http.routers.homeassistant-rtr.tls.certresolver: dns-cloudflare
# traefik.http.routers.homeassistant-rtr.middlewares: chain-oauth@file
# traefik.http.routers.homeassistant-rtr.service: homeassistant-svc
# traefik.http.services.homeassistant-svc.loadbalancer.server.port: 8123
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:8123"]
interval: 60s
timeout: 5s
retries: 5
# DNSSec for pihole
cloudflared:
image: crazymax/cloudflared:latest
container_name: cloudflared
restart: unless-stopped
environment:
<<: *default-tz-puid-pgid
# Prometheus metrics host and port
TUNNEL_DNS_METRICS: "0.0.0.0:49312"
# Listen on all interfaces
TUNNEL_DNS_ADDRESS: "0.0.0.0"
# Listen on an unprivileged port
TUNNEL_DNS_PORT: 5053
TUNNEL_DNS_UPSTREAM: "https://1.1.1.3/dns-query,https://1.0.0.3/dns-query"
networks:
pihole:
ipv4_address: 172.20.0.3
labels:
## Auto-update
com.centurylinklabs.watchtower.enable: true
# DNS cache and blacklist
pihole:
image: pihole/pihole:latest
container_name: pihole
restart: unless-stopped
dns:
- 127.0.0.1
# cloudflare
# - 1.1.1.3
# cleanbrowsing.org
- 185.228.169.10
- 185.228.169.11
secrets:
- pihole_password
cap_add:
- NET_ADMIN
depends_on:
- cloudflared
networks:
traefik:
pihole:
ipv4_address: 172.20.0.2
ports:
- "$SERVER_IP:53:53/tcp"
- "$SERVER_IP:53:53/udp"
# - "53:53/tcp"
# - "53:53/udp"
- "67:67/udp"
- "8053:80/tcp"
environment:
<<: *default-tz-puid-pgid
PROXY_LOCATION: pihole
VIRTUAL_HOST: pihole.$DOMAINNAME
VIRTUAL_PORT: 80
WEBPASSWORD_FILE: /run/secrets/pihole_password
ServerIP: $SERVER_IP
PATH: /opt/pihole:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
ARCH: amd64
FTL_CMD: no-daemon
DNSMASQ_USER: root
VERSION: v4.4
DNS1: "172.20.0.3#5053"
# DNS2: "1.1.1.3"
DNS2: "185.228.169.10"
DNS3: "185.228.169.11"
volumes:
- $DOCKERDIR/pihole/etc-dnsmasq.d:/etc/dnsmasq.d
- $DOCKERDIR/pihole/etc-pihole:/etc/pihole
- $DOCKERDIR/pihole/pihole.log:/var/log/pihole.log
labels:
## Auto-update
com.centurylinklabs.watchtower.enable: true
## Traefik
traefik.enable: true
traefik.docker.network: traefik
traefik.http.routers.pihole-rtr.entrypoints: https
traefik.http.routers.pihole-rtr.rule: Host(`pihole.$DOMAINNAME`)
traefik.http.routers.pihole-rtr.tls.certresolver: dns-cloudflare
traefik.http.routers.pihole-rtr.middlewares: chain-oauth@file
traefik.http.routers.pihole-rtr.service: pihole-svc
traefik.http.services.pihole-svc.loadbalancer.server.port: 80
# Plex Media Server
plex:
image: plexinc/pms-docker:plexpass
container_name: plex
hostname: Flatline
restart: unless-stopped
ipc: private
entrypoint:
- /init
secrets:
- plex_apitoken
environment:
<<: *default-tz-puid-pgid
PLEX_UID: $PUID
PLEX_GID: $PGID
PATH: /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
LC_ALL: C.UTF-8
HOME: /config
ADVERTISE_IP: "http://$SERVER_IP:$PLEX_PORT/"
LANG: $LANG
PLEX_CLAIM: $PLEX_CLAIM
PLEX_APITOKEN_FILE: /run/secrets/plex_apitoken
networks:
- traefik
ports:
- "1900:1900/udp"
- "3005:3005/tcp"
- "$PLEX_PORT:32400/tcp"
- "32410:32410/udp"
- "32412:32412/udp"
- "32413:32413/udp"
- "32414:32414/udp"
- "32469:32469/tcp"
- "8324:8324/tcp"
devices:
- /dev/dri:/dev/dri
# - /dev/dvb:/dev/dvb
volumes:
- $DOCKERDIR/plex:/config
- $MEDIADIR:/data
# - $DOCKERDIR/plex-transcode:/transcode
- /dev/shm:/transcode
labels:
## Traefik
traefik.enable: true
traefik.docker.network: traefik
traefik.http.routers.plex-rtr.entrypoints: https
traefik.http.routers.plex-rtr.rule: Host(`plex.$DOMAINNAME`)
traefik.http.routers.plex-rtr.tls.certresolver: dns-cloudflare
traefik.http.routers.plex-rtr.middlewares: chain-oauth@file
traefik.http.routers.plex-rtr.service: plex-svc
traefik.http.services.plex-svc.loadbalancer.server.port: 32400
healthcheck:
test: ["CMD-SHELL", "curl -slIf --header @$${PLEX_APITOKEN_FILE} http://localhost:32400"]
interval: 60s
timeout: 5s
retries: 4
# Usenet download service
sabnzbd:
container_name: sabnzbd
image: lscr.io/linuxserver/sabnzbd:latest
restart: unless-stopped
secrets:
- sabnzbd_password
environment:
<<: *default-tz-puid-pgid
FILE__PASSWORD: /run/secrets/sabnzbd_password
volumes:
- $DOCKERDIR/sabnzbd:/config
- $MEDIADIR/Downloads/completed:/downloads
- $MEDIADIR/Downloads/incomplete:/incomplete-downloads
networks:
- traefik
ports:
- "$SABNZBD_PORT:8080/tcp"
labels:
## Auto-update
com.centurylinklabs.watchtower.enable: true
## Traefik
traefik.enable: true
traefik.docker.network: traefik
traefik.http.routers.sabnzbd-rtr.entrypoints: https
traefik.http.routers.sabnzbd-rtr.rule: Host(`sabnzbd.$DOMAINNAME`)
traefik.http.routers.sabnzbd-rtr.tls.certresolver: dns-cloudflare
traefik.http.routers.sabnzbd-rtr.middlewares: chain-oauth@file
traefik.http.routers.sabnzbd-rtr.service: sabnzbd-svc
traefik.http.services.sabnzbd-svc.loadbalancer.server.port: 8080
healthcheck:
test: ["CMD", "curl", "-slf", "http://localhost:8080/api?output=json&mode=version"]
interval: 120s
timeout: 10s
retries: 4
# Movie aggregation service
radarr:
container_name: radarr
image: linuxserver/radarr:latest
restart: unless-stopped
ipc: private
entrypoint:
- /init
secrets:
- radarr_apikey
environment:
<<: *default-tz-puid-pgid
RADARR_APIKEY_FILE: /run/secrets/radarr_apikey
volumes:
- $DOCKERDIR/radarr:/config
- $MEDIADIR/Downloads/completed:/downloads
- $MEDIADIR/Movies:/movies
networks:
- traefik
ports:
- "$RADARR_PORT:7878/tcp"
labels:
## Auto-update
com.centurylinklabs.watchtower.enable: true
## Traefik
traefik.enable: true
traefik.docker.network: traefik
traefik.http.routers.radarr-rtr.entrypoints: https
traefik.http.routers.radarr-rtr.rule: Host(`radarr.$DOMAINNAME`)
traefik.http.routers.radarr-rtr.tls.certresolver: dns-cloudflare
traefik.http.routers.radarr-rtr.middlewares: chain-oauth@file
traefik.http.routers.radarr-rtr.service: radarr-svc
traefik.http.services.radarr-svc.loadbalancer.server.port: 7878
healthcheck:
test: ["CMD-SHELL", "curl --header @$${RADARR_APIKEY_FILE} http://localhost:$RADARR_PORT/api/v3/system/status"]
interval: 120s
timeout: 10s
retries: 4
# TV aggregation service
sonarr:
container_name: sonarr
image: linuxserver/sonarr:latest
ipc: private
restart: unless-stopped
entrypoint:
- /init
secrets:
- sonarr_apikey
environment:
<<: *default-tz-puid-pgid
SONARR_APIKEY_FILE: /run/secrets/sonarr_apikey
networks:
- traefik
ports:
- "$SONARR_PORT:8989/tcp"
volumes:
- $DOCKERDIR/sonarr:/config
- $MEDIADIR/Downloads/completed:/downloads
- '$MEDIADIR/TV Shows:/tv'
labels:
## Auto-update
com.centurylinklabs.watchtower.enable: true
## Traefik
traefik.enable: true
traefik.docker.network: traefik
traefik.http.routers.sonarr-rtr.entrypoints: https
traefik.http.routers.sonarr-rtr.rule: Host(`sonarr.$DOMAINNAME`)
traefik.http.routers.sonarr-rtr.tls.certresolver: dns-cloudflare
traefik.http.routers.sonarr-rtr.middlewares: chain-oauth@file
traefik.http.routers.sonarr-rtr.service: sonarr-svc
traefik.http.services.sonarr-svc.loadbalancer.server.port: 8989
healthcheck:
test: ["CMD-SHELL", "curl --header @$${SONARR_APIKEY_FILE} http://localhost:$SONARR_PORT/api/system/status"]
interval: 120s
timeout: 10s
retries: 4
# Music aggregation service
lidarr:
image: linuxserver/lidarr:latest
container_name: lidarr
restart: unless-stopped
security_opt:
- no-new-privileges:true
secrets:
- lidarr_apikey
environment:
<<: *default-tz-puid-pgid
LIDARR_APIKEY_FILE: /run/secrets/lidarr_apikey
volumes:
- $DOCKERDIR/lidarr:/config
- $MEDIADIR/Downloads/completed:/downloads
- $MEDIADIR/Music:/music
- "/etc/localtime:/etc/localtime:ro"
networks:
- traefik
ports:
- "$LIDARR_PORT:8686"
labels:
## Auto-update
com.centurylinklabs.watchtower.enable: true
## Traefik
traefik.enable: true
traefik.docker.network: traefik
traefik.http.routers.lidarr-rtr.entrypoints: https
traefik.http.routers.lidarr-rtr.rule: Host(`lidarr.$DOMAINNAME`)
traefik.http.routers.lidarr-rtr.tls.certresolver: dns-cloudflare
traefik.http.routers.lidarr-rtr.middlewares: chain-oauth@file
traefik.http.routers.lidarr-rtr.service: lidarr-svc
traefik.http.services.lidarr-svc.loadbalancer.server.port: 8686
healthcheck:
test: ["CMD-SHELL", "curl --header @$${LIDARR_APIKEY_FILE} http://localhost:$LIDARR_PORT/api/v1/system/status"]
interval: 120s
timeout: 10s
retries: 4
# Password Management Service
vaultwarden:
image: vaultwarden/server:latest
container_name: vaultwarden
restart: unless-stopped
environment:
<<: *default-tz-puid-pgid
ADMIN_TOKEN_FILE: /run/secrets/bitwarden_admin_token
SMTP_HOST_FILE: /run/secrets/bitwarden_smtp_host
SMTP_FROM_FILE: /run/secrets/bitwarden_smtp_from
SMTP_USERNAME_FILE: /run/secrets/bitwarden_smtp_username
SMTP_PASSWORD_FILE: /run/secrets/bitwarden_smtp_password
SMTP_PORT: $BITWARDEN_SMTP_PORT
SMTP_SSL: "true"
ROCKET_ENV: staging
ROCKET_PORT: 80
ROCKET_WORKERS: 10
PUSH_ENABLED: "true"
PUSH_INSTALLATION_ID_FILE: /run/secrets/bitwarden_installation_push_id
PUSH_INSTALLATION_KEY_FILE: /run/secrets/bitwarden_installation_push_key
secrets:
- bitwarden_admin_token
- bitwarden_installation_push_id
- bitwarden_installation_push_key
- bitwarden_smtp_host
- bitwarden_smtp_from
- bitwarden_smtp_username
- bitwarden_smtp_password
networks:
- traefik
ports:
- "$BITWARDEN_PORT:80/tcp"
- "$BITWARDEN_WS_PORT:3012/tcp"
volumes:
- $DOCKERDIR/bitwarden:/data
working_dir: /
labels:
## Auto-update
com.centurylinklabs.watchtower.enable: true
## Traefik
traefik.enable: true
traefik.docker.network: traefik
# UI
traefik.http.routers.bitwarden-ui-http.entrypoints: http
traefik.http.routers.bitwarden-ui-http.middlewares: redirect-https
traefik.http.routers.bitwarden-ui-http.rule: Host(`bitwarden.$DOMAINNAME`, `vault.$DOMAINNAME`)
traefik.http.routers.bitwarden-ui-http.service: bitwarden-ui-svc
traefik.http.routers.bitwarden-ui-https.entrypoints: https
traefik.http.routers.bitwarden-ui-https.rule: Host(`bitwarden.$DOMAINNAME`, `vault.$DOMAINNAME`)
traefik.http.routers.bitwarden-ui-https.service: bitwarden-ui-svc
traefik.http.routers.bitwarden-ui-https.tls.certresolver: dns-cloudflare
traefik.http.services.bitwarden-ui-svc.loadbalancer.server.port: 80
# Enable OAuth
traefik.http.routers.bitwarden-ui-https.middlewares: chain-oauth@file
# Disable OAuth
# traefik.http.routers.bitwarden-ui-https.middlewares: chain-no-auth@file
# Websocket
traefik.http.routers.bitwarden-websocket-http.entrypoints: http
traefik.http.routers.bitwarden-websocket-http.middlewares: redirect-https
traefik.http.routers.bitwarden-websocket-http.service: bitwarden-websocket-svc
traefik.http.routers.bitwarden-websocket-http.rule: Host(`bitwarden.$DOMAINNAME`, `vault.$DOMAINNAME`) && PathPrefix(`/notifications/hub`)
traefik.http.routers.bitwarden-websocket-https.entrypoints: https
traefik.http.routers.bitwarden-websocket-https.rule: Host(`bitwarden.$DOMAINNAME`, `vault.$DOMAINNAME`) && PathPrefix(`/notifications/hub`)
traefik.http.routers.bitwarden-websocket-https.service: bitwarden-websocket-svc
traefik.http.routers.bitwarden-websocket-https.tls.certresolver: dns-cloudflare
traefik.http.services.bitwarden-websocket-svc.loadbalancer.server.port: 3012
# Redirect
traefik.http.middlewares.redirect-https.redirectScheme.permanent: true
traefik.http.middlewares.redirect-https.redirectScheme.scheme: https
# OAuth Bypass
traefik.http.routers.bitwarden-rtr-bypass.entrypoints: https
# FIXME - May also need PathPrefix(`/api/accounts/prelogin`)
traefik.http.routers.bitwarden-rtr-bypass.rule: "Host(`bitwarden.$DOMAINNAME`, `vault.$DOMAINNAME`) && (HeadersRegexp(`Origin`, `^(moz|safari-web|chrome)-extension://.*`) || HeadersRegexp(`User-Agent`, `Bitwarden_Mobile.*`) || PathPrefix(`/api/sync`))"
traefik.http.routers.bitwarden-rtr-bypass.priority: 100
traefik.http.routers.bitwarden-rtr-bypass.service: bitwarden-ui-svc
traefik.http.routers.bitwarden-rtr-bypass.middlewares: chain-no-auth@file
traefik.http.routers.bitwarden-rtr-bypass.tls.certresolver: dns-cloudflare
# Backup service for bitwarden
bitwarden_backup:
image: bruceforce/vaultwarden-backup
container_name: bitwarden_backup
restart: unless-stopped
entrypoint:
- entrypoint.sh
network_mode: none
volumes:
- $DOCKERDIR/bitwarden:/data
- $DOCKERDIR/bitwarden_backup:/backup
environment:
<<: *default-tz-puid-pgid
UID: $PUID
GID: $PGID
CRON_TIME: "0 4 * * *"
TIMESTAMP: "true"
DELETE_AFTER: 6
LOG_LEVEL: DEBUG
LOG_DIR: /backup/logs
LOG_DIR_PERMISSIONS: 755
VW_DATA_FOLDER: /data
BACKUP_DIR: /backup
BACKUP_DIR_PERMISSIONS: 700
BACKUP_ADD_DATABASE: "true"
BACKUP_ADD_CONFIG_JSON: "true"
BACKUP_ADD_ATTACHMENTS: "true"
BACKUP_ADD_RSA_KEY: "true"
# - CRONFILE=/etc/crontabs/root
healthcheck:
test: ["CMD-SHELL", "stat $${VW_DATABASE_URL} $${BACKUP_DIR}/$$(date +'%Y-%m-%d')-*backup.tar.xz"]
interval: 120s
timeout: 5s
retries: 4
# Container Management Service
portainer:
image: portainer/portainer-ce:latest
container_name: portainer
restart: unless-stopped
command: -H tcp://socket-proxy:$SOCKET_PROXY_PORT
security_opt:
- no-new-privileges:true
environment:
<<: *default-tz-puid-pgid
networks:
- traefik
- socket_proxy
ports:
- "$PORTAINER_PORT:9000/tcp"
volumes:
- $DOCKERDIR/portainer:/data:rw
labels:
## Auto-update
com.centurylinklabs.watchtower.enable: true
## Traefik
traefik.enable: true
traefik.docker.network: traefik
traefik.http.routers.portainer-rtr.entrypoints: https
traefik.http.routers.portainer-rtr.rule: Host(`portainer.$DOMAINNAME`)
traefik.http.routers.portainer-rtr.tls.certresolver: dns-cloudflare
traefik.http.routers.portainer-rtr.middlewares: chain-oauth@file # Google OAuth 2.0
traefik.http.routers.portainer-rtr.service: portainer-svc
traefik.http.services.portainer-svc.loadbalancer.server.port: 9000
# Dozzle - Real-time Docker Log Viewer
dozzle:
image: amir20/dozzle:latest
container_name: dozzle
security_opt:
- no-new-privileges:true
restart: unless-stopped
networks:
- traefik
- socket_proxy
ports:
- "$DOZZLE_PORT:8080/tcp"
environment:
<<: *default-tz-puid-pgid
DOZZLE_LEVEL: info
DOZZLE_TAILSIZE: 300
DOZZLE_FILTER: "status=running"
# DOZZLE_FILTER: "label=log_me" # limits logs displayed to containers with this label
DOCKER_HOST: tcp://socket-proxy:$SOCKET_PROXY_PORT
labels:
## Auto-update
com.centurylinklabs.watchtower.enable: true
## Traefik
traefik.enable: true
traefik.docker.network: traefik
traefik.http.routers.dozzle-rtr.entrypoints: https
traefik.http.routers.dozzle-rtr.rule: Host(`dozzle.$DOMAINNAME`)
traefik.http.routers.dozzle-rtr.tls.certresolver: dns-cloudflare
traefik.http.routers.dozzle-rtr.middlewares: chain-oauth@file # Google OAuth 2.0
traefik.http.routers.dozzle-rtr.service: dozzle-svc
traefik.http.services.dozzle-svc.loadbalancer.server.port: 8080
# Reverse Proxy Service
traefik:
image: traefik:2.10
container_name: traefik
entrypoint:
- /entrypoint.sh
command: # CLI arguments
- --global.checkNewVersion=true
- --global.sendAnonymousUsage=false
- --entrypoints.http.address=:80
- --entrypoints.https.address=:443
# Allow these IPs to set the X-Forwarded-* headers - Cloudflare IPs: https://www.cloudflare.com/ips/
- --entrypoints.https.forwardedHeaders.trustedIPs=$CLOUDFLARE_IPS,$LOCAL_IPS
- --entrypoints.traefik.address=:8080
# - --entrypoints.ping.address=:8081
# - --api=true
- --api.dashboard=true
- --api.insecure=true
- --ping=true
- --log=true
- --log.level=DEBUG
- --log.filePath=/logs/traefik.log
- --log.format=json
- --accessLog=true
- --accessLog.filePath=/logs/access.log
- --accessLog.bufferingSize=100
- --accessLog.format=json
- --accessLog.fields.defaultMode=keep
- --accessLog.fields.headers.defaultMode=keep
- --accessLog.filters.statusCodes=204-299,400-499,500-599
- --providers.docker=true
- --providers.docker.endpoint=tcp://socket-proxy:$SOCKET_PROXY_PORT
# Automatically set Host rule for services
# - --providers.docker.defaultrule=Host(`{{ index .Labels "com.docker.compose.service" }}.$DOMAINNAME`)
# - --providers.docker.defaultrule="Host(`{{ trimPrefix `/` .Name }}.$DOMAINNAME`)"
- --providers.docker.exposedByDefault=false
- --providers.docker.network=traefik
- --providers.docker.swarmMode=false
- --providers.file.directory=/rules # Load dynamic configuration from one or more .toml or .yml files in a directory
# - --providers.file.filename=/path/to/file # Load dynamic configuration from a file
- --providers.file.watch=true # Only works on top level files in the rules folder
# Needed to enable unifi-cloudkey and other passthrough applications
- --serversTransport.insecureSkipVerify=true
# - --entrypoints.https.http.middlewares=chain-oauth@file
- --entrypoints.https.http.tls.options=tls-opts@file
# Add dns-cloudflare as default certresolver for all services. Also enables TLS and no need to specify on individual services
- --entrypoints.https.http.tls.certresolver=dns-cloudflare
- --entrypoints.https.http.tls.domains[0].main=$DOMAINNAME1
- --entrypoints.https.http.tls.domains[0].sans=*.$DOMAINNAME1
# - --entrypoints.https.http.tls.domains[1].main=$DOMAINNAME2 # Pulls main cert for domain
# - --entrypoints.https.http.tls.domains[1].sans=*.$DOMAINNAME2 # Pulls wildcard cert for domain
# - --entrypoints.https.http.tls.domains[2].main=$DOMAINNAME3 # Pulls main cert for domain
# - --entrypoints.https.http.tls.domains[2].sans=*.$DOMAINNAME3 # Pulls wildcard cert for domain
# - --certificatesresolvers.dns-cloudflare.acme.caserver=https://acme-staging-v02.api.letsencrypt.org/directory # LetsEncrypt Staging Server - uncomment when testing
- --certificatesresolvers.dns-cloudflare.acme.email=$CLOUDFLARE_EMAIL
- --certificatesresolvers.dns-cloudflare.acme.storage=/letsencrypt/acme.json
- --certificatesresolvers.dns-cloudflare.acme.dnsChallenge.provider=cloudflare
- --certificatesresolvers.dns-cloudflare.acme.dnsChallenge.resolvers=1.1.1.1:53,1.0.0.1:53
- --certificatesresolvers.dns-cloudflare.acme.dnsChallenge.delayBeforeCheck=90 # To delay DNS check and reduce LE hitrate
# InfluxDB metrics exporter type.
# - --metrics.influxdb=true
# - --metrics.influxdb.address=influxdb:$INFLUXDB_PORT
# - --metrics.influxdb.database=traefik
# - --metrics.influxdb.pushinterval=30
# Prometheus metrics exporter type.
- --metrics.prometheus=true
networks:
traefik:
# ipv4_address: 172.19.0.254
socket_proxy:
ports:
- "443:443/tcp"
- "80:80/tcp"
- "$TRAEFIK_PORT:8080/tcp"
restart: unless-stopped
volumes:
# - $DOCKERDIR/traefik/traefik.yml:/etc/traefik/traefik.yml
- $DOCKERDIR/traefik/letsencrypt:/letsencrypt
- $DOCKERDIR/traefik/logs:/logs
- $DOCKERDIR/traefik/rules:/rules
secrets:
- traefik_htpasswd
- cloudflare_email
- cloudflare_zone_api_key
- cloudflare_dns_api_key
environment:
CF_API_EMAIL_FILE: /run/secrets/cloudflare_email
# CF_API_KEY_FILE: /run/secrets/cloudflare_global_api_key
CF_ZONE_API_TOKEN_FILE: /run/secrets/cloudflare_zone_api_key
CF_DNS_API_TOKEN_FILE: /run/secrets/cloudflare_dns_api_key
DOMAINNAME: $DOMAINNAME
DOMAINNAME1: $DOMAINNAME1
# DOMAINNAME2: $DOMAINNAME2
# DOMAINNAME3: $DOMAINNAME3
SERVER_IP: $SERVER_IP
CKG2_IP: $CKG2_IP
UDM_PRO_IP: $UDM_PRO_IP
PRINTER_IP: $PRINTER_IP
HDHOMERUN_IP: $HDHOMERUN_IP
SYNOLOGY_IP: $SYNOLOGY_IP
USG_IP: $USG_IP
POWERWALL_IP: $POWERWALL_IP
FLATLINE_IP: $FLATLINE_IP
WINTERMUTE_IP: $WINTERMUTE_IP
ARMITAGE_IP: $ARMITAGE_IP
RASPBERRYPI_IP: $RASPBERRYPI_IP
COCKPIT_PORT: $COCKPIT_PORT
HOMEASSISTANT_IP: $HOMEASSISTANT_IP
HOMEASSISTANT_PORT: $HOMEASSISTANT_PORT
HOMEBRIDGE_IP: $HOMEBRIDGE_IP
HOMEBRIDGE_PORT: $HOMEBRIDGE_PORT
SCRYPTED_PORT: $SCRYPTED_PORT
ESPHOME_PORT: $ESPHOME_PORT
labels:
# Auto-update
com.centurylinklabs.watchtower.enable: false
## Traefik
traefik.enable: true
# traefik.docker.network: traefik
# Basic auth admin password
# traefik.http.middlewares.admin.basicauth.usersfile: /run/secrets/traefik_htpasswd
# HTTP-to-HTTPS Redirect
traefik.http.routers.http-catchall.rule: HostRegexp(`{host:.+}`)
traefik.http.routers.http-catchall.entrypoints: http
traefik.http.routers.http-catchall.middlewares: redirect-to-https
traefik.http.routers.http-catchall.service: noop@internal
traefik.http.middlewares.redirect-to-https.redirectscheme.scheme: https
# Dashboard
traefik.http.routers.traefik-rtr.entrypoints: https
traefik.http.routers.traefik-rtr.rule: Host(`traefik.$DOMAINNAME`)
traefik.http.routers.traefik-rtr.tls: true
traefik.http.routers.traefik-rtr.tls.certresolver: dns-cloudflare
traefik.http.routers.traefik-rtr.tls.domains[0].main: "$DOMAINNAME1"
traefik.http.routers.traefik-rtr.tls.domains[0].sans: "*.$DOMAINNAME1"
# traefik.http.routers.traefik-rtr.tls.domains[1].main: "$DOMAINNAME2" # Pulls main cert for second domain
# traefik.http.routers.traefik-rtr.tls.domains[1].sans: "*.$DOMAINNAME2" # Pulls wildcard cert for second domain
# traefik.http.routers.traefik-rtr.tls.domains[2].main: "$DOMAINNAME3" # Pulls main cert for second domain
# traefik.http.routers.traefik-rtr.tls.domains[2].sans: "*.$DOMAINNAME3" # Pulls wildcard cert for second domain
traefik.http.routers.traefik-rtr.middlewares: chain-oauth@file
traefik.http.routers.traefik-rtr.service: api@internal
traefik.http.services.api-svc.loadbalancer.server.port: 8080
traefik.http.services.traefik-svc.loadbalancer.server.port: 8080
healthcheck:
test: ["CMD", "traefik", "healthcheck", "--ping"]
interval: 60s
timeout: 5s
retries: 4
# Google OAuth - Single Sign On using OAuth 2.0
# https://hub.docker.com/r/thomseddon/traefik-forward-auth
# https://www.smarthomebeginner.com/google-oauth-with-traefik-docker/
oauth:
container_name: oauth
image: thomseddon/traefik-forward-auth:latest
restart: unless-stopped
security_opt:
- no-new-privileges:true
networks:
- traefik
secrets:
- source: traefik-forward-auth
target: /config
environment:
- CONFIG=/config
- COOKIE_DOMAIN=$DOMAINNAME
- INSECURE_COOKIE=false
- AUTH_HOST=oauth.$DOMAINNAME
- URL_PATH=/_oauth
- LIFETIME=$OAUTH_LIFETIME
- LOG_LEVEL=info
- LOG_FORMAT=text
- DEFAULT_ACTION=auth
- DEFAULT_PROVIDER=google
labels:
# Auto-update
com.centurylinklabs.watchtower.enable: true
## Traefik
traefik.enable: true
traefik.docker.network: traefik
traefik.http.routers.oauth-rtr.entrypoints: https
traefik.http.routers.oauth-rtr.rule: Host(`oauth.$DOMAINNAME`)
# traefik.http.routers.oauth-rtr.tls: true
traefik.http.routers.oauth-rtr.tls.certresolver: dns-cloudflare
traefik.http.routers.oauth-rtr.middlewares: chain-oauth@file
traefik.http.routers.oauth-rtr.service: oauth-svc
traefik.http.services.oauth-svc.loadbalancer.server.port: 4181
# Docker-GC - Automatic Docker Garbage Collection
# Create docker-gc-exclude file
docker-gc:
image: clockworksoul/docker-gc-cron
container_name: docker-gc
restart: unless-stopped
networks:
- socket_proxy
volumes:
- $DOCKERDIR/docker-gc/docker-gc-exclude:/etc/docker-gc-exclude
environment:
CRON: 0 0 * * *
FORCE_IMAGE_REMOVAL: 1
FORCE_CONTAINER_REMOVAL: 0
GRACE_PERIOD_SECONDS: 604800
DRY_RUN: 0
CLEAN_UP_VOLUMES: 1
TZ: $TZ
DOCKER_HOST: tcp://socket-proxy:$SOCKET_PROXY_PORT
watchtower:
container_name: watchtower
image: containrrr/watchtower
restart: unless-stopped
environment:
TZ: $TZ
WATCHTOWER_SCHEDULE: 0 0 2 * * *
WATCHTOWER_LABEL_ENABLE: 1