-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathdocker-compose.yml
536 lines (520 loc) · 20.3 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
version: '3.7'
# Build directory structure:
#
# ~/docker
# docker-compose.yml
# README.md
#
# home-assistant/
#
# plex/
#
# traefik/
# duckDNSToken
# acme/
# acme.json # cert location that needs to be touched an 600 permissions set
#
# Ports 48130-48555, 48620-48652 are all unassigned according to iana.org...
# https://www.iana.org/assignments/service-names-port-numbers/service-names-port-numbers.xhtml?search=unassigned
#
# Ports used by containers:
# Traefik:
# System Internal Service
# 80 80 HTTP
# 443 443 HTTPS
# 8180 8080 Traefik frontend
# HomeAssistant:
# System Internal Service
# 8213 8123 HomeAssistant frontend
# ZwaveJS:
# System Internal Service
# 3001 3000 ZwaveJS
# GitLab:
# System Internal Service
# 48620 --> 80 HTTP
# 48621 --> 443 HTTPS
# 48622 --> 22 SSH
# Calibre:
# System Internal Service
# 8083 8083 Calibre
# Plex:
# System Internal Service
# 32400 32400 Plex frontend
# 3005 3005 tcp
# 8324 8324 tcp
# 32469 32469 tcp
# 1900 1900 udp
# 32410 32410 udp
# 32412 32412 udp
# 32413 32413 udp
# 32414 32414 udp
# Transmission:
# System Internal Service
# 9091 9091 Transmission communication
# 51413 51413
# 51413 51413 udp - specifying that traffic can run over plain and udp
# AdGuard:
# System Internal Service
# 53 53 tcp
# 53 53 udp
# 67 67 udp
# 68 68 tcp
# 68 68 udp
# 48623 --> 80 tcp
# 48624 --> 443 tcp
# 853 853 tcp
# 3000 3000 tcp
# Syncthing:
# System Internal Service
# 8384 8384
# 22000 22000
# 21027 21027 udp
# NextCloud:
# 48625 --> 80
# Unifi:
# System Internal Service
# 3478 3478 udp
# 10001 10001 udp
# 8080 8080
# 8081 8081
# 8443 8443
# 8843 8843
# 8880 8880
# 6789 6789
#
# Environment Variables (stored in .env)
# - MYDIR = /path/to/working/directory
# - WEBSITE = mysite.example.com
# - EMAIL = [email protected]
# - SMTPEMAIL = [email protected] (used for sending emails in gitlab)
# - SMTPPASS = hunter2 (password for smtp)
# - PLEXTOKEN = tokenForPlexPass
# - TRANSUSER = username
# - TRANSPASS = hunter2
# --------------------------------------------------------
# Defining all of the different Applications that will run
# --------------------------------------------------------
services:
# ----------------------------
# Setting up the reverse proxy
# ----------------------------
traefik:
container_name: traefik # The name to call the created image
image: traefik:v3.1 # The official v3 Traefik docker image source
restart: always
# Enables the web UI and tells Traefik to listen to docker
command:
- "--api=true"
- "--api.insecure=true"
- "--providers.docker=true"
- "--providers.docker.exposedbydefault=true"
- "--entrypoints.web.address=:80"
- "--entrypoints.websecure.address=:443"
- "--entrypoints.ssh.address=:2222"
- "--entrypoints.http.forwardedHeaders.trustedIPs=127.0.0.1/31, 192.168.1.55/24"
#- "--entrypoints.http.proxyProtocol=true"
#- "--entrypoints.http.proxyProtocol.trustedIPs=127.0.0.1/31, 192.168.1.55/24"
- "--certificatesresolvers.myresolver.acme.dnschallenge=true"
- "--certificatesresolvers.myresolver.acme.dnschallenge.provider=namecheap"
- "--certificatesresolvers.myresolver.acme.email=${EMAIL}"
- "--certificatesresolvers.myresolver.acme.storage=/traefik/acme/acme.json"
- "--log=true"
- "--log.level=INFO" # (Default: error) DEBUG, INFO, WARN, ERROR, FATAL, PANIC
- "--log.filePath=/traefik/traefik.log"
# - "--providers.file.filename=traefik/traefik-config.yml"
# - "--providers.file.watch=true"
environment:
- "NAMECHEAP_API_KEY=${NAMECHEAP_API}"
- "NAMECHEAP_API_USER=${NAMECHEAP_USER}"
volumes:
# So that Traefik can listen to the Docker events
- "/var/run/docker.sock:/var/run/docker.sock:ro"
- "${MYDIR}/traefik:/traefik"
network_mode: bridge
ports:
# This long port section requires docker-compose version 3.2+
# The SSH Port
- target: 2222
published: 2222
protocol: tcp
mode: host
# The HTTP port
- target: 80
published: 80
protocol: tcp
mode: host
# The HTTPS port
- target: 443
published: 443
protocol: tcp
mode: host
# The Web UI (enabled by --api.insecure=true)
- "8180:8080"
extra_hosts:
- host.docker.internal:172.17.0.1 # Needed to avoid bad gateway
labels:
# Dashboard
- "traefik.http.routers.traefik.rule=Host(`api.${WEBSITE}`)" # These ` are backticks, NOT single quotes '
- "traefik.http.routers.traefik.service=api@internal"
- "traefik.http.routers.traefik.middlewares=admin"
- "traefik.http.routers.traefik.tls.certresolver=myresolver"
- "traefik.http.routers.traefik.entrypoints=websecure"
- "traefik.http.middlewares.admin.basicauth.usersfile=/traefik/.htpasswd"
# middleware redirect
- "traefik.http.middlewares.redirect-to-https.redirectscheme.scheme=https"
# global redirect to https
- "traefik.http.routers.redirs.rule=hostregexp(`{host:.+}`)"
- "traefik.http.routers.redirs.entrypoints=web"
- "traefik.http.routers.redirs.middlewares=redirect-to-https"
# ------------------------------------
# Setting up the Home-Assistant server
# ------------------------------------
homeassistant:
container_name: homeassistant # The name to call the image
image: homeassistant/home-assistant:stable # The source of the container
restart: always # Sets the container to restart whenever it stops/crashes
# devices:
# - /dev/ttyACM0:/dev/ttyACM0
environment:
- TZ=America/New_York
volumes:
- /Pool1-Working/Applications/HomeAutomation:/config
- /Pool1-Working/Applications/wakeonlan:/root/.ssh
- /run/dbus:/run/dbus:ro
network_mode: host
# ports: # Port hosting isn't allowed for host mode
# - '8123:8123'
labels:
# Reverse proxy config
- "traefik.enable=true"
- "traefik.http.routers.homeassistant.tls=true"
- "traefik.http.routers.homeassistant.tls.certresolver=myresolver"
- "traefik.http.routers.homeassistant.rule=Host(\"hass.${WEBSITE}\")" # Setting the prefix to access the site
- "traefik.http.routers.homeassistant.entrypoints=websecure"
- "traefik.http.services.homeassistant.loadbalancer.server.port=8123" # Needs to point to the internal port
# --------------------------
# Setting up Zwave JS server
# --------------------------
zwavejs:
container_name: zwavejs
image: kpine/zwave-js-server:latest
restart: always
devices:
- /dev/serial/by-id/usb-0658_0200-if00:/dev/zwave
environment:
S0_LEGACY_KEY: "${ZWAVES0LEGACY}"
ZWAVEJS_DISABLE_SOFT_RESET: 1
volumes:
- /Pool1-Working/Applications/zwaveJs:/cache
network_mode: bridge
ports:
- '3001:3000'
# ------------------------
# Setting up GitLab Server
# ------------------------
GitLab:
container_name: gitlab # The name to call the image
image: 'gitlab/gitlab-ce:latest' # The source of the container
restart: always # Sets the container to restart whenever it stops/crashes
# hostname: 'gitlab.example.com'
environment:
GITLAB_OMNIBUS_CONFIG: |
external_url 'https://gitlab.${WEBSITE}'
# gitlab_rails['gitlab_shell_ssh_port'] = 48622
nginx['enable'] = false # Disabled since Traefik is performing that role
# nginx['redirect_http_to_https'] = false
# nginx['listen_port'] = 80
# nginx['listen_https'] = false
# Add any other gitlab.rb configuration here, each on its own line
#
# Enabling the ability for gitlab to send emails
gitlab_rails['smtp_enable'] = true
gitlab_rails['smtp_address'] = "smtp.gmail.com"
gitlab_rails['smtp_port'] = 587
gitlab_rails['smtp_user_name'] = "${SMTPEMAIL}"
gitlab_rails['smtp_password'] = "${SMTPPASS}"
gitlab_rails['smtp_domain'] = "smtp.gmail.com"
gitlab_rails['smtp_authentication'] = "login"
gitlab_rails['smtp_enable_starttls_auto'] = true
gitlab_rails['smtp_tls'] = false
gitlab_rails['smtp_openssl_verify_mode'] = 'peer'
# Can be: 'none', 'peer', 'client_once', 'fail_if_no_peer_cert', see...
# http://api.rubyonrails.org/classes/ActionMailer/Base.html
# Increase Timeout
gitlab_rails['env'] = {'GITLAB_RAILS_RACK_TIMEOUT' => 570}
puma['worker_timeout'] = 600
gitlab_workhorse['timeout'] = '600s'
# gitlab_rails['max_request_duration_seconds'] = 570
# gitlab_rails['lfs_enabled'] = false # Disabling LFS allows version 16.4 to start
gitlab_rails['content_security_policy'] = {enabled: true, report_only: false, directives: {frame_ancestors: "gitlab.${WEBSITE}"}}
volumes:
- '/Pool1-Working/Applications/GitLab/config:/etc/gitlab'
- '/Pool1-Working/Applications/GitLab/logs:/var/log/gitlab'
- '/Pool1-Working/Applications/GitLab/data:/var/opt/gitlab'
ports:
- '48620:80' # Unassigned port to internal port
- '48621:443' # Unassigned port to internal port
- '48622:22' # Unassigned port to internal port
network_mode: bridge
labels:
# Reverse proxy config
- "traefik.enable=true"
- "traefik.http.routers.gitlab.tls=true"
- "traefik.http.routers.gitlab.tls.certresolver=myresolver"
- "traefik.http.routers.gitlab.rule=Host(\"gitlab.${WEBSITE}\")" # Setting the prefix to access the site
- "traefik.http.routers.gitlab.entrypoints=websecure"
- "traefik.http.services.gitlab.loadbalancer.server.port=80" # Needs to point to the internal port
# SSH config (May or may not work)
- "traefik.tcp.routers.gitlab-ssh.rule=HostSNI(`*`)"
- "traefik.tcp.routers.gitlab-ssh.entrypoints=ssh"
- "traefik.tcp.routers.gitlab-ssh.service=gitlab-ssh-svc"
- "traefik.tcp.services.gitlab-ssh-svc.loadbalancer.server.port=22" # Needs to point to the internal port
# -------------------------
# Setting up Calibre Server
# -------------------------
calibre-web:
container_name: calibre-web
image: linuxserver/calibre-web
restart: unless-stopped
environment:
- PUID=1000
- PGID=1000
- TZ=America/New_York
- DOCKER_MODS=linuxserver/calibre-web:calibre
- DOCKER_MODS=linuxserver/mods:universal-calibre
volumes:
- /Pool1-Working/Applications/Calibre:/config
- /Pool1-Working/Storage/Media/Books:/books
- /home/michaelg/docker/calibre-news/recipies:/recipies
ports:
- '8083:8083'
network_mode: bridge
labels:
# Reverse proxy config
- "traefik.enable=true"
- "traefik.http.routers.calibre-web.tls=true"
- "traefik.http.routers.calibre-web.tls.certresolver=myresolver"
- "traefik.http.routers.calibre-web.rule=Host(\"calibre.${WEBSITE}\")" # Setting the prefix to access the site
- "traefik.http.routers.calibre-web.entrypoints=websecure"
- "traefik.http.services.calibre-web.loadbalancer.server.port=8083" # Needs to point to the internal port
# ----------------------
# Setting up Plex Server
# ----------------------
plex:
container_name: plex
image: plexinc/pms-docker
restart: unless-stopped
environment:
- PUID=1000
- PGID=1000
- TZ=America/New_York
- PLEX_CLAIM="${PLEXTOKEN}"
- ADVERTISE_IP="192.168.1.55:32400/"
volumes:
- /Pool1-Working/Applications/Plex/config:/config
- /Pool1-Working/Applications/Plex/transcode:/transcode
- /Pool1-Working/Storage/Media/Music:/data/Music
- /Pool1-Working/Storage/Media/Pictures:/data/Pictures
- /Pool1-Working/Storage/Media/Movies:/data/Movies
- /Pool1-Working/Storage/Media/TV:/data/TV
devices:
- "/dev/dri:/dev/dri"
ports:
- 32400:32400/tcp
- 3005:3005/tcp
- 8324:8324/tcp
- 32469:32469/tcp
- 1900:1900/udp
- 32410:32410/udp
- 32412:32412/udp
- 32413:32413/udp
- 32414:32414/udp
network_mode: bridge
labels:
# Reverse proxy config
- "traefik.enable=true"
- "traefik.http.routers.plex.tls=true"
- "traefik.http.routers.plex.tls.certresolver=myresolver"
- "traefik.http.routers.plex.rule=Host(\"plex.${WEBSITE}\")" # Setting the prefix to access the site
- "traefik.http.routers.plex.entrypoints=websecure"
- "traefik.http.services.plex.loadbalancer.server.port=32400" # Needs to point to the internal port
# -----------------------
# Setting up Transmission
# -----------------------
transmission:
container_name: transmission
image: linuxserver/transmission
restart: unless-stopped
environment:
- PUID=1000
- PGID=1000
- TZ=America/New_York
# - TRANSMISSION_WEB_HOME=/combustion-release/ #optional
- USER=${TRANSUSER} #optional
- PASS=${TRANSPASS} #optional
volumes:
- /Pool1-Working/Applications/Transmission/config:/config
- /Pool1-Working/Applications/Transmission/progress:/downloads
- /Pool1-Working/Applications/Transmission/watch:/watch
ports:
- 9091:9091
- 51413:51413
- 51413:51413/udp
network_mode: bridge
labels:
# Reverse proxy config
- "traefik.enable=true"
- "traefik.http.routers.transmission.tls=true"
- "traefik.http.routers.transmission.tls.certresolver=myresolver"
- "traefik.http.routers.transmission.rule=Host(\"transmission.${WEBSITE}\")" # Setting the prefix to access the site
- "traefik.http.routers.transmission.entrypoints=websecure"
- "traefik.http.services.transmission.loadbalancer.server.port=9091" # Needs to point to the internal port
# ------------------
# Setting up AdGuard
# ------------------
adguard:
image: adguard/adguardhome
container_name: adguard
restart: unless-stopped
volumes:
- /Pool1-Working/Applications/Adguard/workdir:/opt/adguardhome/work
- /Pool1-Working/Applications/Adguard/confdir:/opt/adguardhome/conf
ports:
- 53:53/tcp
- 53:53/udp
- 67:67/udp
- 68:68/tcp
- 68:68/udp
- 48623:80/tcp
- 48624:443/tcp
- 853:853/tcp
- 3000:3000/tcp
network_mode: bridge
labels:
- "traefik.enable=true"
- "traefik.http.routers.adguard.tls=true"
- "traefik.http.routers.adguard.tls.certresolver=myresolver"
- "traefik.http.routers.adguard.rule=Host(\"adguard.${WEBSITE}\")" # Setting the prefix to access the site
- "traefik.http.routers.adguard.entrypoints=websecure"
- "traefik.http.services.adguard.loadbalancer.server.port=80" # Needs to point to the internal port
# --------------------
# Setting up Syncthing
# --------------------
syncthing:
image: linuxserver/syncthing
container_name: syncthing
restart: unless-stopped
environment:
- PUID=1000
- PGID=1000
- TZ=America/New_York
# - UMASK_SET=<022>
volumes:
- /Pool1-Working/Applications/Syncthing:/config
- /Pool1-Working/Storage/Media/Syncthing:/data
ports:
- 8384:8384
- 22000:22000
- 21027:21027/udp
network_mode: bridge
labels:
- "traefik.enable=false"
# --------------------------------
# Setting up LinuxServer/NextCloud
# --------------------------------
nextcloud:
image: ghcr.io/linuxserver/nextcloud:latest
container_name: nextcloud
restart: unless-stopped
environment:
- PUID=1000
- PGID=1000
- TZ=America/New_York
volumes:
- /Pool1-Working/Applications/Nextcloud/linuxServerConfig:/config
- /Pool1-Working/Applications/Nextcloud/linuxServerData:/data
- /Pool1-Working/Storage/Media/Syncthing:/externalData
ports:
- 48626:443
network_mode: bridge
labels:
- "traefik.enable=true"
- "traefik.http.routers.nextcloud.tls=true"
- "traefik.http.routers.nextcloud.tls.certresolver=myresolver"
- "traefik.http.routers.nextcloud.rule=Host(\"nextcloud.${WEBSITE}\")" # Setting the prefix to access the site
- "traefik.http.routers.nextcloud.entrypoints=web"
- "traefik.http.services.nextcloud.loadbalancer.server.port=80" # Needs to point to the internal port
- "traefik.http.middlewares.nc-rep.redirectregex.regex=https://(.*)/.well-known/(card|cal)dav"
- "traefik.http.middlewares.nc-rep.redirectregex.replacement=https://$$1/remote.php/dav/"
- "traefik.http.middlewares.nc-rep.redirectregex.permanent=true"
- "traefik.http.middlewares.nextcloud-header.headers.referrerPolicy=no-referrer"
- "traefik.http.middlewares.nextcloud-header.headers.stsSeconds=31536000"
- "traefik.http.middlewares.nextcloud-header.headers.forceSTSHeader=true"
- "traefik.http.middlewares.nextcloud-header.headers.stsPreload=true"
- "traefik.http.middlewares.nextcloud-header.headers.stsIncludeSubdomains=true"
- "traefik.http.middlewares.nextcloud-header.headers.browserXssFilter=true"
- "traefik.http.middlewares.nextcloud-header.headers.customRequestHeaders.X-Forwarded-Proto=https"
- "traefik.tcp.routers.nextcloud.tls.passthrough=true"
- "traefik.tcp.routers.nextcloud.tls.certresolver=myresolver"
- "traefik.tcp.routers.nextcloud.rule=HostSNI(\"nextcloud.${WEBSITE}\")" # Setting the prefix to access the site
- "traefik.tcp.routers.nextcloud.entrypoints=websecure"
- "traefik.http.routers.nextcloud.middlewares=nextcloud-header,nc-rep"
- "traefik.tcp.services.nextcloud.loadbalancer.server.port=443" # Needs to point to the internal port
# ---------------------------
# Setting up Unifi controller
# ---------------------------
unifi-controller:
image: linuxserver/unifi-controller
container_name: unifi-controller
restart: unless-stopped
environment:
- PUID=1000
- PGID=1000
# - MEM_LIMIT=1024M # Optional
volumes:
- /Pool1-Working/Applications/unifi/config:/config
# - /Pool1-Working/Applications/unifi/data:/usr/lib/unifi/
network_mode: host
# ports: # Port mapping isn't allowed in host mode
# - 3478:3478/udp
# - 10001:10001/udp
# - 8080:8080
# - 8081:8081
# - 8443:8443
# - 8843:8843
# - 8880:8880
# - 6789:6789
labels:
- "traefik.enable=true"
# - "traefik.http.routers.unifi.tls=true"
# - "traefik.http.routers.unifi.tls.certresolver=myresolver"
# - "traefik.http.routers.unifi.rule=Host(\"unifi.${WEBSITE}\")" # Setting the prefix to access the site
# - "traefik.http.routers.unifi.entrypoints=websecure"
# - "traefik.http.services.unifi.loadbalancer.server.port=8443" # Needs to point to the internal port
# - "traefik.http.middlewares.internal-addresses.ipallowlist.sourcerange=127.0.0.1/32, 192.168.1.0/24" # Only allow internal IP
# - "traefik.http.routers.unifi.middlewares=internal-addresses"
# - "traefik.http.services.unifi.loadbalancer.server.scheme=https"
- "traefik.tcp.routers.unifi.tls.passthrough=true"
- "traefik.tcp.routers.unifi.tls.certresolver=myresolver"
- "traefik.tcp.routers.unifi.rule=HostSNI(\"unifi.${WEBSITE}\")" # Setting the prefix to access the site
- "traefik.tcp.routers.unifi.entrypoints=websecure"
- "traefik.tcp.services.unifi.loadbalancer.server.port=8443" # Needs to point to the internal port
- "traefik.tcp.middlewares.internal-addresses.ipallowlist.sourcerange=127.0.0.1/32, 192.168.1.0/24" # Only allow internal IP
- "traefik.tcp.routers.unifi.middlewares=internal-addresses"
# -----------------
# ESPHome Dashboard
# -----------------
esphome:
image: esphome/esphome
container_name: esphome
restart: unless-stopped
environment:
- puid=1000
- PGID=1000
volumes:
- /Pool1-Working/Applications/HomeAutomation/esphome:/config
network_mode: host
# ports: # Port mapping isn't allowed in host mode
# - 6052:6052
labels:
- "traefik.enable=false"