forked from anandslab/docker-traefik
-
Notifications
You must be signed in to change notification settings - Fork 0
/
docker-compose-t2-synology.yml
executable file
·893 lines (850 loc) · 31.8 KB
/
docker-compose-t2-synology.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
version: "3.9"
######### IMPORTANT #############
# docker-compose-t2.yml is my main docker compose that runs on a dedicated cloud server with Proxmox.
# You will find only a few apps (only those that I run on Synology NAS for my homelab use) in this docker-compose file.
# You can copy-paste services from one docker-compose file in this repo to another to add other apps.
########################### SYSTEM DESCRIPTION
# DOCKER-COMPOSE FOR SYNOLOGY DS918+
# 8 GB RAM, DSM 7.X
# 1x4TB + 3x8TB
# 2x256GB NVMe SSD Read-Write Cache
# Google Drive mounted using Rclone Docker Container for media
# Docker: 20.10.3
# Docker Compose: 2.10.2
########################### NETWORKS
# There is no need to create any networks outside this docker-compose file.
# You may customize the network subnets (192.168.90.0/24 and 91.0/24) below as you please.
# Docker Compose version 3.5 or higher required to define networks this way.
networks:
t2_proxy:
name: t2_proxy
driver: bridge
ipam:
config:
- subnet: 192.168.90.0/24
default:
driver: bridge
socket_proxy:
name: socket_proxy
driver: bridge
ipam:
config:
- subnet: 192.168.91.0/24
dockervlan:
name: dockervlan
driver: macvlan
driver_opts:
parent: eth1 # using ifconfig
ipam:
config:
- subnet: "192.168.1.0/24"
ip_range: "192.168.1.25/32"
gateway: "192.168.1.1"
########################### SECRETS
secrets:
htpasswd:
file: $DOCKERDIR/secrets/htpasswd
cf_email:
file: $DOCKERDIR/secrets/cf_email
cf_api_key:
file: $DOCKERDIR/secrets/cf_api_key
cf_token:
file: $DOCKERDIR/secrets/cf_token
traefik_forward_auth:
file: $DOCKERDIR/secrets/traefik_forward_auth
mysql_root_password:
file: $DOCKERDIR/secrets/mysql_root_password
plex_claim:
file: $DOCKERDIR/secrets/plex_claim
########################### EXTENSION FIELDS
# Helps eliminate repetition of sections
# More Info on how to use this: https://github.com/htpcBeginner/docker-traefik/pull/228
# Common environment values
x-environment: &default-tz-puid-pgid
TZ: $TZ
PUID: $PUID
PGID: $PGID
# Keys common to some of the services in basic-services.txt
x-common-keys-core: &common-keys-core
networks:
- t2_proxy
security_opt:
- no-new-privileges:true
restart: always
# profiles:
# - core
# Keys common to some of the services in basic-services.txt
x-common-keys-core: &common-keys-monitoring
networks:
- t2_proxy
security_opt:
- no-new-privileges:true
restart: always
# profiles:
# - monitoring
# Keys common to some of the dependent services/apps
x-common-keys-apps: &common-keys-apps
networks:
- t2_proxy
security_opt:
- no-new-privileges:true
restart: unless-stopped
# profiles:
# - apps
# Keys common to some of the services in media-services.txt
x-common-keys-media: &common-keys-media
networks:
- t2_proxy
security_opt:
- no-new-privileges:true
restart: "no"
# profiles:
# - media
########################### SERVICES
services:
############################# FRONTENDS
# Traefik 2 - Reverse Proxy
# touch (create empty files) traefik.log and acme/acme.json. Set acme.json permissions to 600.
# touch $DOCKERDIR/appdata/traefik2/acme/acme.json
# chmod 600 $DOCKERDIR/appdata/traefik2/acme/acme.json
# touch $DOCKERDIR/logs/synology//traefik.log
traefik:
<<: *common-keys-core # See EXTENSION FIELDS at the top
container_name: traefik
image: traefik:2.8
command: # CLI arguments
- --global.checkNewVersion=true
- --global.sendAnonymousUsage=true
- --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=173.245.48.0/20,103.21.244.0/22,103.22.200.0/22,103.31.4.0/22,141.101.64.0/18,108.162.192.0/18,190.93.240.0/20,188.114.96.0/20,197.234.240.0/22,198.41.128.0/17,162.158.0.0/15,104.16.0.0/13,104.24.0.0/14,172.64.0.0/13,131.0.72.0/22
- --entryPoints.traefik.address=:8080
# - --entryPoints.ping.address=:8081
- --api=true
# - --api.insecure=true
- --api.dashboard=true
#- --ping=true
# - --serversTransport.insecureSkipVerify=true
- --log=true
- --log.level=WARN # (Default: error) DEBUG, INFO, WARN, ERROR, FATAL, PANIC
- --accessLog=true
- --accessLog.filePath=/traefik.log
- --accessLog.bufferingSize=100 # Configuring a buffer of 100 lines
- --accessLog.filters.statusCodes=400-499
- --providers.docker=true
# - --providers.docker.endpoint=unix:///var/run/docker.sock # Use Docker Socket Proxy instead for improved security
- --providers.docker.endpoint=tcp://socket-proxy:2375
# Automatically set Host rule for services
# - --providers.docker.defaultrule=Host(`{{ index .Labels "com.docker.compose.service" }}.$DOMAINNAME_HOME_SYNOLOGY`)
- --providers.docker.exposedByDefault=false
# - --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=$DOMAINNAME_HOME_SYNOLOGY
- --entrypoints.https.http.tls.domains[0].sans=*.$DOMAINNAME_HOME_SYNOLOGY
- --providers.docker.network=t2_proxy
- --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
# - --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=/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
# - --metrics.prometheus=true
# - --metrics.prometheus.buckets=0.1,0.3,1.2,5.0
networks:
t2_proxy:
ipv4_address: 192.168.90.254 # You can specify a static IP
socket_proxy:
#healthcheck:
# test: ["CMD", "traefik", "healthcheck", "--ping"]
# interval: 5s
# retries: 3
ports:
- target: 80
published: 80
protocol: tcp
mode: host
- target: 443
published: 443
protocol: tcp
mode: host
# - target: 8080 # insecure api wont work
# published: 8080
# protocol: tcp
# mode: host
volumes:
- $DOCKERDIR/appdata/traefik2/rules/synology:/rules # file provider directory
# - /var/run/docker.sock:/var/run/docker.sock:ro # Use Docker Socket Proxy instead for improved security
- $DOCKERDIR/appdata/traefik2/acme/acme.json:/acme.json # cert location - you must touch this file and change permissions to 600
- $DOCKERDIR/logs/synology/traefik.log:/traefik.log # for fail2ban - make sure to touch file before starting container
environment:
- CF_API_EMAIL_FILE=/run/secrets/cf_email
- CF_API_KEY_FILE=/run/secrets/cf_api_key
- HTPASSWD_FILE=/run/secrets/htpasswd # HTPASSWD_FILE can be whatever as it is not used/called anywhere.
- DOMAINNAME_HOME_SYNOLOGY
secrets:
- cf_email
- cf_api_key
- htpasswd
labels:
#- "autoheal=true"
- "traefik.enable=true"
# HTTP-to-HTTPS Redirect
- "traefik.http.routers.http-catchall.entrypoints=http"
- "traefik.http.routers.http-catchall.rule=HostRegexp(`{host:.+}`)"
- "traefik.http.routers.http-catchall.middlewares=redirect-to-https"
- "traefik.http.middlewares.redirect-to-https.redirectscheme.scheme=https"
# HTTP Routers
- "traefik.http.routers.traefik-rtr.entrypoints=https"
- "traefik.http.routers.traefik-rtr.rule=Host(`traefik.$DOMAINNAME_HOME_SYNOLOGY` )"
## Services - API
- "traefik.http.routers.traefik-rtr.service=api@internal"
## Healthcheck/ping
#- "traefik.http.routers.ping.rule=Host(`traefik.$DOMAINNAME_HOME_SYNOLOGY`) && Path(`/ping`)"
#- "traefik.http.routers.ping.tls=true"
#- "traefik.http.routers.ping.service=ping@internal"
## Middlewares
#- "traefik.http.routers.traefik-rtr.middlewares=chain-oauth@file"
- "traefik.http.routers.traefik-rtr.middlewares=chain-oauth@file"
# Docker Socket Proxy - Security Enchanced Proxy for Docker Socket
socket-proxy:
<<: *common-keys-core # See EXTENSION FIELDS at the top
container_name: socket-proxy
image: tecnativa/docker-socket-proxy
networks:
socket_proxy:
ipv4_address: 192.168.91.254 # You can specify a static IP
# privileged: true # true for VM. False for unprivileged LXC container.
#ports:
# - "127.0.0.1:2375:2375" # Port 2375 should only ever get exposed to the internal network. When possible use this line.
# I use the next line instead, as I want portainer to manage multiple docker endpoints within my home network.
# - "2375:2375"
volumes:
- "/var/run/docker.sock:/var/run/docker.sock"
environment:
- LOG_LEVEL=info # debug,info,notice,warning,err,crit,alert,emerg
## Variables match the URL prefix (i.e. AUTH blocks access to /auth/* parts of the API, etc.).
# 0 to revoke access.
# 1 to grant access.
## Granted by Default
- EVENTS=1
- PING=1
- VERSION=1
## Revoked by Default
# Security critical
- AUTH=0
- SECRETS=0
- POST=1 # Watchtower
# Not always needed
- BUILD=0
- COMMIT=0
- CONFIGS=0
- CONTAINERS=1 # Traefik, portainer, etc.
- DISTRIBUTION=0
- EXEC=0
- IMAGES=1 # Portainer
- INFO=1 # Portainer
- NETWORKS=1 # Portainer
- NODES=0
- PLUGINS=0
- SERVICES=1 # Portainer
- SESSION=0
- SWARM=0
- SYSTEM=0
- TASKS=1 # Portainer
- VOLUMES=1 # Portainer
# Google OAuth - Single Sign On using OAuth 2.0
# https://www.smarthomebeginner.com/google-oauth-with-traefik-docker/
# Also possible to forward all authentication requests to external service. See middlewares-oauth-external and chain-oauth-external.
oauth:
<<: *common-keys-core # See EXTENSION FIELDS at the top
container_name: oauth
image: thomseddon/traefik-forward-auth:latest
# image: thomseddon/traefik-forward-auth:2.1-arm # Use this image with Raspberry Pi
# Allow apps to bypass OAuth. Radarr example below will bypass OAuth if API key is present in the request (eg. from NZB360 mobile app).
# While this is one way, the recommended way is to bypass authentication using Traefik labels shown in some of the apps later.
# command: --rule.radarr.action=allow --rule.radarr.rule="Headers(`X-Api-Key`, `$RADARR_API_KEY`)"
# command: --rule.sabnzbd.action=allow --rule.sabnzbd.rule="HeadersRegexp(`X-Forwarded-Uri`, `$SABNZBD_API_KEY`)"
environment:
- CONFIG=/config
- COOKIE_DOMAIN=$DOMAINNAME_HOME_SYNOLOGY
- INSECURE_COOKIE=false
- AUTH_HOST=oauth.$DOMAINNAME_HOME_SYNOLOGY
- URL_PATH=/_oauth
- LOG_LEVEL=warn
- LOG_FORMAT=text
- LIFETIME=86400 # 1 day
- DEFAULT_ACTION=auth
- DEFAULT_PROVIDER=google
secrets:
- source: traefik_forward_auth
target: /config
labels:
- "traefik.enable=true"
## HTTP Routers
- "traefik.http.routers.oauth-rtr.tls=true"
- "traefik.http.routers.oauth-rtr.entrypoints=https"
- "traefik.http.routers.oauth-rtr.rule=Host(`oauth.$DOMAINNAME_HOME_SYNOLOGY`)"
## Middlewares
- "traefik.http.routers.oauth-rtr.middlewares=chain-oauth@file"
## HTTP Services
- "traefik.http.routers.oauth-rtr.service=oauth-svc"
- "traefik.http.services.oauth-svc.loadbalancer.server.port=4181"
# Portainer - WebUI for Containers
portainer:
<<: *common-keys-core # See EXTENSION FIELDS at the top
container_name: portainer
image: portainer/portainer-ce:latest
# command: -H unix:///var/run/docker.sock # # Use Docker Socket Proxy instead for improved security
command: -H tcp://socket-proxy:2375
networks:
- t2_proxy
- socket_proxy
ports:
- "$PORTAINER_PORT:9000"
volumes:
# - /var/run/docker.sock:/var/run/docker.sock:ro # # Use Docker Socket Proxy instead for improved security
- $DOCKERDIR/appdata/portainer/data:/data # Change to local directory if you want to save/transfer config locally
environment:
- TZ=$TZ
labels:
- "traefik.enable=true"
## HTTP Routers
- "traefik.http.routers.portainer-rtr.entrypoints=https"
- "traefik.http.routers.portainer-rtr.rule=Host(`portainer.$DOMAINNAME_HOME_SYNOLOGY`)"
## Middlewares
- "traefik.http.routers.portainer-rtr.middlewares=chain-oauth@file"
## HTTP Services
- "traefik.http.routers.portainer-rtr.service=portainer-svc"
- "traefik.http.services.portainer-svc.loadbalancer.server.port=9000"
# Autoindex - Simple Directory Index
autoindex:
<<: *common-keys-apps # See EXTENSION FIELDS at the top
container_name: autoindex
image: dceoy/nginx-autoindex:latest
# ports:
# - "$AUTOINDEX_PORT:80"
volumes:
- /volume1:/var/lib/nginx/html:ro # Location you want to index
labels:
- "traefik.enable=true"
## HTTP Routers
- "traefik.http.routers.autoindex-rtr.entrypoints=https"
- "traefik.http.routers.autoindex-rtr.rule=Host(`index.$DOMAINNAME_HOME_SYNOLOGY`)"
## Middlewares
- "traefik.http.routers.autoindex-rtr.middlewares=chain-oauth@file"
## HTTP Services
- "traefik.http.routers.autoindex-rtr.service=autoindex-svc"
- "traefik.http.services.autoindex-svc.loadbalancer.server.port=80"
# Dashy - Application Dashboard
dashy:
<<: *common-keys-apps # See EXTENSION FIELDS at the top
container_name: dashy
image: lissy93/dashy
healthcheck:
test: ['CMD', 'node', '/app/services/healthcheck']
interval: 1m30s
timeout: 10s
retries: 3
start_period: 40s
ports:
- 4000:80
volumes:
- $DOCKERDIR/appdata/dashy/conf.yml:/app/public/conf.yml
- $DOCKERDIR/appdata/dashy:/app/public/item-icons
environment:
- NODE_ENV=production
- UID=$PUID
- GID=$PGID
labels:
- "traefik.enable=true"
## HTTP Routers
- "traefik.http.routers.dashy-rtr.entrypoints=https"
- "traefik.http.routers.dashy-rtr.rule=Host(`$DOMAINNAME_HOME_SYNOLOGY`,`www.$DOMAINNAME_HOME_SYNOLOGY`)"
## Middlewares
- "traefik.http.routers.dashy-rtr.middlewares=chain-oauth@file"
## HTTP Services
- "traefik.http.routers.dashy-rtr.service=dashy-svc"
- "traefik.http.services.dashy-svc.loadbalancer.server.port=80"
# ZeroTier-One - Private Network over Internet
zerotier:
image: zerotier/zerotier-synology:latest
container_name: zerotier
network_mode: host
restart: always
cap_add:
- NET_ADMIN
- SYS_ADMIN
devices:
- /dev/net/tun
volumes:
- $DOCKERDIR/appdata/zerotier:/var/lib/zerotier-one
############################# SMART HOME
# Mosquitto - MQTT Broker
# Create mosquitto.conf, passwd, mosquitto.log files and set permissions to 775 user:docker
# dexec mosquitto /bin/sh -> mosquitto_passwd -b /mosquitto/config/passwd username passwd
mosquitto:
<<: *common-keys-apps # See EXTENSION FIELDS at the top
image: eclipse-mosquitto:latest
container_name: mosquitto
ports:
- "$MOSQUITTO_HTTP_PORT:1883" #http
- "9001:9001" #websockets
# - "$MOSQUITTO_HTTPS_PORT:8883" #https
volumes:
- $DOCKERDIR/appdata/mosquitto/config/mosquitto.conf:/mosquitto/config/mosquitto.conf
- $DOCKERDIR/appdata/mosquitto/config/passwd:/mosquitto/config/passwd
- $DOCKERDIR/shared:/shared
environment:
<<: *default-tz-puid-pgid
############################# DOWNLOADERS
# qBittorrent - Torrent downloader
# Needs trailing / if using PathPrefixStrip
qbittorrent:
<<: *common-keys-apps # See EXTENSION FIELDS at the top
image: lscr.io/linuxserver/qbittorrent
container_name: qbittorrent
# ports:
#- "$QBITTORRENT_PORT:8080"
#- 6881:6881
#- 6881:6881/udp
volumes:
- $DOCKERDIR/appdata/qbittorrent:/config
- $DOWNLOADSDIR:/downloads
environment:
<<: *default-tz-puid-pgid
UMASK: 002
labels:
- "traefik.enable=true"
## HTTP Routers
- "traefik.http.routers.qbittorrent-rtr.entrypoints=https"
- "traefik.http.routers.qbittorrent-rtr.rule=Host(`qbit.$DOMAINNAME_HOME_SYNOLOGY`)"
- "traefik.http.routers.qbittorrent-rtr.tls=true"
## Middlewares
- "traefik.http.routers.qbittorrent-rtr.middlewares=chain-oauth@file"
## HTTP Services
- "traefik.http.routers.qbittorrent-rtr.service=qbittorrent-svc"
- "traefik.http.services.qbittorrent-svc.loadbalancer.server.port=8168"
############################# MEDIA
# Plex - Media Server
plexms:
<<: *common-keys-media # See EXTENSION FIELDS at the top
image: plexinc/pms-docker:public
container_name: plexms
ports:
- "$PLEX_PORT:32400/tcp"
- "3005:3005/tcp"
- "8324:8324/tcp"
- "32469:32469/tcp"
# - "1900:1900/udp" # conflicts with xTeVe and Synology default ports
- "32410:32410/udp"
- "32412:32412/udp"
- "32413:32413/udp"
- "32414:32414/udp"
- "$PLEX_WEB_TOOLS_PORT:33400"
devices:
- /dev/dri:/dev/dri # for hardware transcoding
volumes:
- $DOCKERDIR/appdata/plexms:/config
- $DOWNLOADSDIR:/downloads
- $DS918/media:/media
- /dev/shm:/transcode
environment:
TZ: $TZ
HOSTNAME: "sPlex"
PLEX_CLAIM_FILE: /run/secrets/plex_claim
PLEX_UID: $PUID
PLEX_GID: $PGID
ADVERTISE_IP: http://$ZEROTIER_IP_SYNOLOGY:32400/
secrets:
- plex_claim
labels:
- "traefik.enable=true"
## HTTP Routers
- "traefik.http.routers.plexms-rtr.entrypoints=https"
- "traefik.http.routers.plexms-rtr.rule=Host(`synplex.$DOMAINNAME_HOME_SYNOLOGY`)"
## Middlewares
- "traefik.http.routers.plexms-rtr.middlewares=chain-no-auth@file"
## HTTP Services
- "traefik.http.routers.plexms-rtr.service=plexms-svc"
- "traefik.http.services.plexms-svc.loadbalancer.server.port=32400"
# Plex-Sync - For Syncing watched status between plex servers
plex-sync:
image: patsissons/plex-sync:develop
container_name: plex-sync
security_opt:
- no-new-privileges:true
environment:
INITIAL_RUN: "true"
DRY_RUN: 0
CRON_SCHEDULE: "*/30 * * * *"
SECTION_MAPS: $HOME_PLEX/$HOME_PLEX_MOVIESH $CLOUD_PLEX/$CLOUD_PLEX_MOVIESH | $HOME_PLEX/$HOME_PLEX_SHOWST $CLOUD_PLEX/$CLOUD_PLEX_SHOWST | $HOME_PLEX/$HOME_PLEX_MOVIESI $CLOUD_PLEX/$CLOUD_PLEX_MOVIESI | $HOME_PLEX/$HOME_PLEX_MOVIEST $CLOUD_PLEX/$CLOUD_PLEX_MOVIEST | $HOME_PLEX/$HOME_PLEX_MOVIESK $CLOUD_PLEX/$CLOUD_PLEX_MOVIESK | $HOME_PLEX/$HOME_PLEX_SHOWSK $CLOUD_PLEX/$CLOUD_PLEX_SHOWSK
restart: unless-stopped
############################# MEDIA FILE MANAGEMENT
# Tdarr Server - Library Optimizer
tdarr:
<<: *common-keys-media # See EXTENSION FIELDS at the top
image: haveagitgat/tdarr:latest
container_name: tdarr
#ports:
# - "$TDARR_SERVER_PORT:8266"
# - "$TDARR_WEB_PORT:8265"
# - 8267:8267 # node port. It should be mapped on this container because the node container use the network from the main container
volumes:
- $DOCKERDIR/appdata/tdarr/server:/app/server
- $DOCKERDIR/appdata/tdarr/configs:/app/configs
- $DOCKERDIR/appdata/tdarr/logs:/app/logs
- $DOWNLOADSDIR/transcode/tdarr:/data/temp
- $DATADIR/Photos/zVideos:/data/media:ro
- $DS918/media/zvideos:/data/output
environment:
<<: *default-tz-puid-pgid
serverIP: tdarr # or hostname
serverPort: 8266
webUIPort: 8265
UMASK_SET: 002
labels:
- "traefik.enable=true"
## HTTP Routers
- "traefik.http.routers.tdarr-rtr.entrypoints=https"
- "traefik.http.routers.tdarr-rtr.rule=Host(`tdarr.$DOMAINNAME_HOME_SYNOLOGY`)"
## Middlewares
- "traefik.http.routers.tdarr-rtr.middlewares=chain-oauth@file"
## HTTP Services
- "traefik.http.routers.tdarr-rtr.service=tdarr-svc"
- "traefik.http.services.tdarr-svc.loadbalancer.server.port=8265"
# Tdarr Node - Transcoder Node
tdarr-node1:
<<: *common-keys-media # See EXTENSION FIELDS at the top
image: haveagitgat/tdarr_node:latest
container_name: tdarr-node1
devices:
- /dev/dri:/dev/dri # for hardware transcoding
environment:
<<: *default-tz-puid-pgid
UMASK_SET: 002
nodeID: Node1
nodeIP: tdarr-node1 # or hostname
nodePort: 8267
serverIP: tdarr # or hostname
serverPort: 8266
volumes:
- $DOCKERDIR/appdata/tdarr/configs:/app/configs
- $DOCKERDIR/appdata/tdarr/logs:/app/logs
- $DOWNLOADSDIR/transcode/tdarr:/data/temp
- $DATADIR/Photos/zVideos:/data/media:ro
- $DS918/media/zvideos:/data/output
############################# FILES
# Rclone - Google Drive Mount
# https://github.com/openbridge/ob_bulkstash/issues/19
# https://github.com/romancin/rclonebrowser-docker
# https://hub.docker.com/r/d2dyno/rclone-gui
rclone-drive:
<<: *common-keys-core # See EXTENSION FIELDS at the top
container_name: rclone-drive
image: rclone/rclone:latest
cap_add:
- SYS_ADMIN
security_opt:
- apparmor:unconfined
command:
"mount drive: /data/drive \
--use-mmap \
--allow-other \
--no-modtime \
--allow-non-empty \
--dir-cache-time=1000h \
--poll-interval=15s \
--buffer-size=256M \
--umask=002 \
--uid=1026 \
--gid=100 \
--drive-chunk-size=256M \
--user-agent=DS918 \
--cache-dir=/data/cache/drive \
--vfs-cache-mode=full \
--vfs-cache-max-age=336h \
--vfs-cache-max-size=512G \
--vfs-read-chunk-size=32M \
--vfs-read-chunk-size-limit=2G \
--log-file /config/rclone/logs/drive.log \
--rc \
--rc-web-gui \
--rc-addr :5572 \
--rc-user=$RCLONE_WEBUI_USER \
--rc-pass=$RCLONE_WEBUI_PASS \
--log-level=INFO"
#--bwlimit 150M \
#--bwlimit-file 40M \
devices:
- /dev/fuse
volumes:
- $DOCKERDIR/appdata/rclone:/config/rclone
- $DS918/rclone/drive:/data/drive:shared
- $DS918/rclone/cache/drive:/data/cache/drive
- /etc/passwd:/etc/passwd:ro
- /etc/group:/etc/group:ro
- /etc/fuse.conf:/etc/fuse.conf:ro
environment:
<<: *default-tz-puid-pgid
labels:
- "traefik.enable=true"
## HTTP Routers
- "traefik.http.routers.rclone-drive-rtr.entrypoints=https"
- "traefik.http.routers.rclone-drive-rtr.rule=Host(`rclone.$DOMAINNAME_HOME_SYNOLOGY`)"
## Middlewares
- "traefik.http.routers.rclone-drive-rtr.middlewares=chain-oauth@file"
## HTTP Services
- "traefik.http.routers.rclone-drive-rtr.service=rclone-drive-svc"
- "traefik.http.services.rclone-drive-svc.loadbalancer.server.port=5572"
# Rclone - Google Drive Mount
rclone-crypt:
<<: *common-keys-core # See EXTENSION FIELDS at the top
container_name: rclone-crypt
image: rclone/rclone:latest
cap_add:
- SYS_ADMIN
security_opt:
- apparmor:unconfined
command:
"mount crypt: /data/crypt \
--use-mmap \
--allow-other \
--no-modtime \
--allow-non-empty \
--dir-cache-time=1000h \
--poll-interval=15s \
--buffer-size=256M \
--uid=1026 \
--gid=100 \
--umask=002 \
--drive-chunk-size=256M \
--user-agent=DS918 \
--cache-dir=/data/cache/crypt \
--vfs-cache-mode=full \
--vfs-cache-max-age=336h \
--vfs-cache-max-size=512G \
--vfs-read-chunk-size=32M \
--vfs-read-chunk-size-limit=2G \
--log-file /config/rclone/logs/crypt.log \
--log-level=NOTICE"
#--bwlimit 3M \
# 3M approxmimately equals 253 GB limit per day
# previously buffer 256 buffer 256 chunk size 128 read and limit off
devices:
- /dev/fuse
volumes:
- $DOCKERDIR/appdata/rclone:/config/rclone
- $DS918/rclone/crypt:/data/crypt:shared
- $DS918/rclone/cache/crypt:/data/cache/crypt
- /etc/passwd:/etc/passwd:ro
- /etc/group:/etc/group:ro
- /etc/fuse.conf:/etc/fuse.conf:ro
environment:
<<: *default-tz-puid-pgid
############################# UTILITIES
# Firefox - Web Broswer
# VNC password not working - check
firefox:
<<: *common-keys-apps # See EXTENSION FIELDS at the top
image: jlesage/firefox:latest
container_name: firefox
security_opt:
- no-new-privileges:true
- seccomp:unconfined # October 15, 2020 https://github.com/jlesage/docker-firefox/blob/master/README.md#allowing-the-membarrier-system-call
# ports:
# - "$FIREFOX_PORT:5800"
volumes:
- $DOCKERDIR/appdata/firefox:/config
- $DOWNLOADSDIR:/config/Downloads
- /dev/shm:/dev/shm
environment:
USER_ID: $PUID
GROUP_ID: $PGID
TZ: $TZ
UMASK: 002
KEEP_APP_RUNNING: 1
CLEAN_TMP_DIR: 1
DISPLAY_WIDTH: 1600
DISPLAY_HEIGHT: 960
# VNC_PASSWD: $FIREFOX_VNC_PASSWD # Since OAuth is enabled
labels:
- "traefik.enable=true"
## HTTP Routers
- "traefik.http.routers.firefox-rtr.entrypoints=https"
- "traefik.http.routers.firefox-rtr.rule=Host(`firefox.$DOMAINNAME_HOME_SYNOLOGY`)"
## Middlewares
- "traefik.http.routers.firefox-rtr.middlewares=chain-oauth@file"
## HTTP Services
- "traefik.http.routers.firefox-rtr.service=firefox-svc"
- "traefik.http.services.firefox-svc.loadbalancer.server.port=5800"
# qDirStat - Directory Statistics
qdirstat:
<<: *common-keys-apps # See EXTENSION FIELDS at the top
image: jlesage/qdirstat:latest
container_name: qdirstat
# ports:
# - "$QDIRSTAT_PORT:5800"
volumes:
- /volume1:/storage:ro
- $DOCKERDIR/appdata/qdirstat/config:/config:rw
environment:
USER_ID: $PUID
GROUP_ID: $PGID
UMASK: 002
TZ: $TZ
KEEP_APP_RUNNING: 1
CLEAN_TMP_DIR: 1
DISPLAY_WIDTH: 1600
DISPLAY_HEIGHT: 960
VNC_PASSWORD: $QDIRSTAT_VNC_PASSWD
labels:
- "traefik.enable=true"
## HTTP Routers
- "traefik.http.routers.qdirstat-rtr.entrypoints=https"
- "traefik.http.routers.qdirstat-rtr.rule=Host(`qdir.$DOMAINNAME_HOME_SYNOLOGY`)"
## Middlewares
- "traefik.http.routers.qdirstat-rtr.middlewares=chain-oauth@file"
## HTTP Services
- "traefik.http.routers.qdirstat-rtr.service=qdirstat-svc"
- "traefik.http.services.qdirstat-svc.loadbalancer.server.port=5800"
# SyncThing - Keep folders in Sync
syncthing:
<<: *common-keys-core # See EXTENSION FIELDS at the top
image: lscr.io/linuxserver/syncthing
container_name: syncthing
ports:
- "8384:8384"
- "22000:22000/tcp"
- "22000:22000/udp"
- "21027:21027/udp"
volumes:
- /volume1:/data
- $DOCKERDIR/appdata/syncthing:/config
environment:
<<: *default-tz-puid-pgid
labels:
- "traefik.enable=true"
## HTTP Routers
- "traefik.http.routers.syncthing-rtr.entrypoints=https"
- "traefik.http.routers.syncthing-rtr.rule=Host(`stnas.$DOMAINNAME_HOME_SYNOLOGY`)"
## Middlewares
- "traefik.http.routers.syncthing-rtr.middlewares=chain-oauth@file"
## HTTP Services
- "traefik.http.routers.syncthing-rtr.service=syncthing-svc"
- "traefik.http.services.syncthing-svc.loadbalancer.server.port=8384"
# VSCode - VSCode Editing
vscode:
<<: *common-keys-core # See EXTENSION FIELDS at the top
image: lscr.io/linuxserver/code-server:latest
container_name: vscode
ports:
- "$VSCODE_PORT:8443"
volumes:
- $DOCKERDIR:/data/docker
- $DOCKERDIR/appdata/vscode:/config
- $DS918:/data/ds918
environment:
<<: *default-tz-puid-pgid
# DOCKER_HOST: tcp://socket-proxy:2375
# PASSWORD: $VSCODE_PASSWORD
# HASHED_PASSWORD: #optional
# SUDO_PASSWORD: password #optional
# SUDO_PASSWORD_HASH: #optional
# PROXY_DOMAIN: code-server.my.domain #optional
# DEFAULT_WORKSPACE: /config/data/User/Workspaces/AZ.code-workspace #optional
labels:
- "traefik.enable=true"
## HTTP Routers
- "traefik.http.routers.vscode-rtr.entrypoints=https"
- "traefik.http.routers.vscode-rtr.rule=Host(`code.$DOMAINNAME_HOME_SYNOLOGY`)"
## Middlewares
- "traefik.http.routers.vscode-rtr.middlewares=chain-oauth@file"
## HTTP Services
- "traefik.http.routers.vscode-rtr.service=vscode-svc"
- "traefik.http.services.vscode-svc.loadbalancer.server.port=8443"
# AdGuard Home - DNS AdBlocking
adguardhome:
<<: *common-keys-core # See EXTENSION FIELDS at the top
container_name: adguardhome
image: adguard/adguardhome
networks:
dockervlan:
ipv4_address: 192.168.1.25 # IP address inside defined range
ports:
- 53/udp
- 67/udp
- 68/tcp
- 68/udp
- 80/tcp
- 443/tcp
- 853/tcp
- 3000/tcp
volumes:
- $DOCKERDIR/appdata/adguard/conf:/opt/adguardhome/conf
- $DOCKERDIR/appdata/adguard/work:/opt/adguardhome/work
- $DOCKERDIR/shared/certs/$DOMAINNAME_HOME_SYNOLOGY:/certs
############################# MAINTENANCE
# Docker-GC - Automatic Docker Garbage Collection
# Create docker-gc-exclude file
dockergc:
<<: *common-keys-apps # See EXTENSION FIELDS at the top
image: clockworksoul/docker-gc-cron:latest
container_name: docker-gc
restart: unless-stopped
networks:
- socket_proxy
volumes:
# - /var/run/docker.sock:/var/run/docker.sock # Use Docker Socket Proxy instead for improved security
- $DOCKERDIR/appdata/docker-gc/docker-gc-exclude:/etc/docker-gc-exclude
environment:
CRON: 0 0 0 * * ? # Everyday at midnight. Previously 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:2375
# Traefik Certs Dumper - Extract LetsEncrypt Certificates - Traefik2 Compatible
certdumper:
<<: *common-keys-apps # See EXTENSION FIELDS at the top
container_name: traefik_certdumper
image: humenius/traefik-certs-dumper:latest
# command: --restart-containers container1,container2,container3
volumes:
- $DOCKERDIR/appdata/traefik2/acme:/traefik:ro
- $DOCKERDIR/shared/certs/$DOMAINNAME_HOME_SYNOLOGY:/output:rw
# - /var/run/docker.sock:/var/run/docker.sock:ro # Only needed if restarting containers (use Docker Socket Proxy instead)
environment:
DOMAIN: $DOMAINNAME_HOME_SYNOLOGY
# Cloudflare DDNS - Dynamic DNS Updater
ddns-updater:
image: qmcgaw/ddns-updater
container_name: ddns-updater
restart: always
network_mode: bridge
ports:
- 8000:8000/tcp
volumes:
- $DOCKERDIR/appdata/ddns-updater:/updater/data # Owned by UID 1000
environment:
<<: *default-tz-puid-pgid
PERIOD: 12h
UPDATE_COOLDOWN_PERIOD: 5m
PUBLICIP_DNS_TIMEOUT: 3s
HTTP_TIMEOUT: 10s
# Web UI
LISTENING_PORT: 8000
# Backup
BACKUP_PERIOD: 96h # 0 to disable
BACKUP_DIRECTORY: /updater/data/backups
# Other
LOG_LEVEL: info
SHOUTRRR_ADDRESSES: $DISCORD_SHOUTRRR_ADDRESS