-
Notifications
You must be signed in to change notification settings - Fork 0
/
docker-compose.yml
444 lines (424 loc) · 15 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
version: "3.7"
# https://www.smarthomebeginner.com/traefik-2-docker-tutorial/#Basic_Docker_Commands_to_Know
########################### 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
########################### 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/traefik2/acme/acme.json
# chmod 600 $DOCKERDIR/traefik2/acme/acme.json
# touch $DOCKERDIR/traefik2/traefik.log
traefik:
container_name: traefik
image: traefik:latest # picodon v2.3.x # chevrotin v2.2.x
restart: always
command: # CLI arguments
- --global.checkNewVersion=true
- --global.sendAnonymousUsage=true
- --entryPoints.http.address=:80
- --entryPoints.https.address=:443
- --entryPoints.wireguard.address=:51820/udp
- --entryPoints.traefik.address=:8080
- --api.insecure=true
- --api.dashboard=true
#- --pilot.token=$TRAEFIK_PILOT_TOKEN
- --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
# Automatically set Host rule for services
- --providers.docker.defaultrule=Host(`{{ index .Labels "com.docker.compose.service" }}.$DOMAINNAME`)
- --providers.docker.exposedByDefault=false
- --entrypoints.https.http.tls.certresolver=dns-route53
- --entrypoints.https.http.tls.domains[0].main=$DOMAINNAME
- --entrypoints.https.http.tls.domains[0].sans=*.$DOMAINNAME
- --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.watch=true # Only works on top level files in the rules folder
#- --certificatesResolvers.dns-route53.acme.caServer=https://acme-staging-v02.api.letsencrypt.org/directory # LetsEncrypt Staging Server - uncomment when testing
- --certificatesResolvers.dns-route53.acme.storage=/acme.json
- --certificatesResolvers.dns-route53.acme.dnsChallenge.provider=route53
- --certificatesResolvers.dns-route53.acme.dnsChallenge.delayBeforeCheck=20 # To delay DNS check and reduce LE hitrate
networks:
t2_proxy:
ipv4_address: 192.168.90.254 # You can specify a static IP
socket_proxy:
security_opt:
- no-new-privileges:true
#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
published: 8080
protocol: tcp
mode: host
- target: 51820
published: 51820
protocol: udp
mode: host
volumes:
- $DOCKERDIR/traefik2/rules:/rules # file provider directory
- /var/run/docker.sock:/var/run/docker.sock:ro # Use Docker Socket Proxy instead for improved security
- $DOCKERDIR/traefik2/acme/acme.json:/acme.json # cert location - you must touch this file and change permissions to 600
- $DOCKERDIR/traefik2/traefik.log:/traefik.log # for fail2ban - make sure to touch file before starting container
environment:
- AWS_ACCESS_KEY_ID=$AK
- AWS_SECRET_ACCESS_KEY=$ASK
- HTPASSWD_FILE=/run/secrets/htpasswd # HTPASSWD_FILE can be whatever as it is not used/called anywhere.
labels:
- "com.centurylinklabs.watchtower.enable=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`)"
- "traefik.http.routers.traefik-rtr.tls=true"
## Services - API
- "traefik.http.routers.traefik-rtr.service=api@internal"
## Healthcheck/ping
#- "traefik.http.routers.ping.rule=Host(`traefik.$DOMAINNAME0`) && Path(`/ping`)"
#- "traefik.http.routers.ping.tls=true"
#- "traefik.http.routers.ping.service=ping@internal"
## Middlewares
#- "traefik.http.routers.traefik-rtr.middlewares=middlewares-rate-limit"
# Portainer - WebUI for Containers
portainer:
container_name: portainer
image: portainer/portainer-ce:latest
restart: unless-stopped
command: -H unix:///var/run/docker.sock
networks:
- t2_proxy
security_opt:
- no-new-privileges:true
# ports:
# - "$PORTAINER_PORT:9000"
volumes:
- /var/run/docker.sock:/var/run/docker.sock:ro
- $DOCKERDIR/portainer/data:/data
environment:
- TZ=$TZ
labels:
- "com.centurylinklabs.watchtower.enable=true"
- "traefik.enable=true"
## HTTP Routers
- "traefik.http.routers.portainer-rtr.entrypoints=https"
- "traefik.http.routers.portainer-rtr.rule=Host(`portainer.$DOMAINNAME`)"
- "traefik.http.routers.portainer-rtr.tls=true"
## Middlewares
## HTTP Services
- "traefik.http.routers.portainer-rtr.service=portainer-svc"
- "traefik.http.services.portainer-svc.loadbalancer.server.port=9000"
# MariaDB - MySQL Database
mariadb:
container_name: mariadb
image: linuxserver/mariadb:latest
restart: always
networks:
t2_proxy:
ipv4_address: 192.168.90.240 # You can specify a static IP
security_opt:
- no-new-privileges:true
ports:
- "3306:3306"
volumes:
- $DOCKERDIR/mariadb/data:/config
#- /etc/timezone:/usr/share/zoneinfo:ro
- /etc/localtime:/etc/localtime:ro
environment:
- PUID=$PUID
- PGID=$PGID
- MYSQL_ROOT_PASSWORD=$MYSQL_ROOT_PASSWORD
- TZ=$TZ
labels:
- "com.centurylinklabs.watchtower.enable=true"
# phpMyAdmin - Database management
phpmyadmin:
image: phpmyadmin/phpmyadmin:latest
container_name: phpmyadmin
restart: unless-stopped
hostname: pma.$DOMAINNAME
networks:
- t2_proxy
- default
depends_on:
- mariadb
security_opt:
- no-new-privileges:true
# ports:
# - "$PHPMYADMIN_PORT:80"
# The volumes caused an overwrite of the standard above and hence no login with user /pass possible, diabled and working now T.M
# volumes:
# - $DOCKERDIR/phpmyadmin:/etc/phpmyadmin
# - $DOCKERDIR/phpmyadmin/ini/php.ini:/usr/local/etc/php/php.ini
environment:
#- PMA_PORT=3306
- PMA_ARBITRARY=1
- PMA_HOST=mariadb
labels:
- "com.centurylinklabs.watchtower.enable=true"
- "traefik.enable=true"
## HTTP Routers
- "traefik.http.routers.phpmyadmin-rtr.entrypoints=https"
- "traefik.http.routers.phpmyadmin-rtr.rule=Host(`pma.$DOMAINNAME`)"
## Middlewares
#- "traefik.http.routers.phpmyadmin-rtr.middlewares=chain-oauth@file"
## HTTP Services
- "traefik.http.routers.phpmyadmin-rtr.service=phpmyadmin-svc"
- "traefik.http.services.phpmyadmin-svc.loadbalancer.server.port=80"
# Dozzle - Real-time Docker Log Viewer
dozzle:
image: amir20/dozzle:latest
container_name: dozzle
restart: unless-stopped
networks:
- t2_proxy
- socket_proxy
#depends_on:
# - socket_proxy
security_opt:
- no-new-privileges:true
# ports:
# - "$DOZZLE_PORT:8080"
environment:
DOZZLE_LEVEL: info
DOZZLE_TAILSIZE: 300
DOZZLE_FILTER: "status=running"
volumes:
- /var/run/docker.sock:/var/run/docker.sock # Use Docker Socket Proxy instead for improved security
labels:
- "com.centurylinklabs.watchtower.enable=true"
- "traefik.enable=true"
## HTTP Routers
- "traefik.http.routers.dozzle-rtr.entrypoints=https"
- "traefik.http.routers.dozzle-rtr.rule=Host(`dozzle.$DOMAINNAME`)"
## Middlewares
## HTTP Services
- "traefik.http.routers.dozzle-rtr.service=dozzle-svc"
- "traefik.http.services.dozzle-svc.loadbalancer.server.port=8080"
# Guacamole Daemon - Needed for Guacamole
guacd:
image: guacamole/guacd
container_name: guacd
restart: unless-stopped
security_opt:
- no-new-privileges:true
networks:
- t2_proxy
labels:
- "com.centurylinklabs.watchtower.enable=true"
# Guacamole - Remote desktop, SSH, on Telnet on any HTML5 Browser
# Create all databases and tables first
guacamole:
image: guacamole/guacamole:latest
container_name: guacamole
restart: unless-stopped
networks:
- t2_proxy
security_opt:
- no-new-privileges:true
# ports:
# - "8080:8080"
volumes:
- $DOCKERDIR/guacamole:/opt/local
environment:
GUACD_HOSTNAME: guacd
MYSQL_HOSTNAME: mariadb
# MYSQL_PORT: 3306
MYSQL_DATABASE: guacamole
MYSQL_USER: guacdb_user
MYSQL_PASSWORD: Poll0000
GUACAMOLE_HOME: /opt/local
labels:
- "com.centurylinklabs.watchtower.enable=true"
- "traefik.enable=true"
## HTTP Routers
- "traefik.http.routers.guacamole-rtr.entrypoints=https"
- "traefik.http.routers.guacamole-rtr.rule=Host(`guac.$DOMAINNAME`)"
- "traefik.http.routers.guacamole-rtr.tls=true"
# ## Middlewares
- "traefik.http.routers.guacamole-rtr.middlewares=add-guacamole"
- "traefik.http.middlewares.add-guacamole.addPrefix.prefix=/guacamole"
# ## HTTP Services
- "traefik.http.routers.guacamole-rtr.service=guacamole-svc"
- "traefik.http.services.guacamole-svc.loadbalancer.server.port=8080"
# Firefox - Web Broswer
# VNC password not working - check
firefox:
image: jlesage/firefox:latest
container_name: firefox
restart: unless-stopped
networks:
- t2_proxy
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/firefox:/config
- $DOCKERDIR/firefox/downloads:/data/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: 1920
DISPLAY_HEIGHT: 1080
labels:
- "com.centurylinklabs.watchtower.enable=true"
- "traefik.enable=true"
## HTTP Routers
- "traefik.http.routers.firefox-rtr.entrypoints=https"
- "traefik.http.routers.firefox-rtr.rule=Host(`firefox.$DOMAINNAME`)"
## Middlewares
## HTTP Services
- "traefik.http.routers.firefox-rtr.service=firefox-svc"
- "traefik.http.services.firefox-svc.loadbalancer.server.port=5800"
# Heimdall - Unified Frontend Alternative
# Putting all services behind Oragnizr slows things down.
heimdall:
container_name: heimdall
image: linuxserver/heimdall:latest
restart: unless-stopped
networks:
- t2_proxy
security_opt:
- no-new-privileges:true
# ports:
# - "$HEIMDALL_PORT:80"
volumes:
- $DOCKERDIR/heimdall:/config
environment:
- PUID=$PUID
- PGID=$PGID
- TZ=$TZ
labels:
- "com.centurylinklabs.watchtower.enable=true"
- "traefik.enable=true"
## HTTP Routers
- "traefik.http.routers.heimdall-rtr.entrypoints=https"
- "traefik.http.routers.heimdall-rtr.rule=Host(`heimdall.$DOMAINNAME`)"
## Middlewares
## HTTP Services
- "traefik.http.routers.heimdall-rtr.service=heimdall-svc"
- "traefik.http.services.heimdall-svc.loadbalancer.server.port=80"
# Traefik Certs Dumper - Extract LetsEncrypt Certificates - Traefik2 Compatible
certdumper:
container_name: traefik_certdumper
image: humenius/traefik-certs-dumper:latest
network_mode: none
security_opt:
- no-new-privileges:true
# command: --restart-containers container1,container2,container3
volumes:
- $DOCKERDIR/traefik2/acme:/traefik:ro
- $DOCKERDIR/shared/certs:/output:rw
# - /var/run/docker.sock:/var/run/docker.sock:ro # Only needed if restarting containers (use Docker Socket Proxy instead)
# Dumps all domains T.M
#environment:
# DOMAIN: $DOMAINNAME
labels:
- "com.centurylinklabs.watchtower.enable=true"
# updates images
watchtower:
command: --label-enable --cleanup --interval 43200
image: containrrr/watchtower
labels:
- "com.centurylinklabs.watchtower.enable=true"
network_mode: none
restart: always
volumes:
- /var/run/docker.sock:/var/run/docker.sock
# VPN Server Software
wireguard:
image: linuxserver/wireguard
container_name: wireguard
# network_mode: service:traefik
networks:
t2_proxy:
ipv4_address: 192.168.90.230
cap_add:
- NET_ADMIN
- SYS_MODULE
environment:
- PUID=$PUID
- PGID=$PGID
- TZ=$TZ
- SERVERURL=$DOMAINNAME
- SERVERPORT=51820
- PEERS=5
- PEERDNS=auto
- INTERNAL_SUBNET=10.50.50.0
volumes:
- $DOCKERDIR/wireguard/config:/config
- /usr/src:/usr/src
- /lib/modules:/lib/modules
sysctls:
- net.ipv4.conf.all.src_valid_mark=1
restart: unless-stopped
labels:
- "traefik.enable=true"
- "traefik.docker.network=t2_proxy"
## UDP Routers
- "traefik.udp.routers.wireguard-udp.entrypoints=wireguard"
## UDP Services
- "traefik.udp.routers.wireguard-udp.service=wireguard-udp-svc"
- "traefik.udp.services.wireguard-udp-svc.loadbalancer.server.port=51820"
#This sets the DNS on Route53 should the need DNS change
R53DDNS:
container_name: R53DDNS
restart: unless-stopped
environment:
- AWS_ACCESS_KEY_ID=$AK
- AWS_SECRET_ACCESS_KEY=$ASK
- AWS_REGION=$AWS_REGION
- ROUTE53_HOSTED_ZONE_ID=$ROUTE53_HOSTED_ZONE_ID
- ROUTE53_DOMAIN=$DOMAINNAME
- ROUTE53_TYPE=A
- ROUTE53_TTL=60
- SEND_EMAIL_SES=true
- SES_TO_ADDRESS=$SES_TO_ADDRESS
- SES_FROM_ADDRESS=$SES_TO_ADDRESS
image: 'sjmayotte/route53-dynamic-dns:latest'