-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathdocker-compose.yaml
328 lines (314 loc) · 10 KB
/
docker-compose.yaml
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
version: "3.3"
volumes:
portainer_data:
name: "portainer_data"
elasticsearch_data:
name: "elasticsearch_data"
heimdall_data:
name: "heimdall_data"
pihole_data:
name: "pihole_data"
services:
# Authentication
tfa:
container_name: tfa
image: npawelek/traefik-forward-auth:latest
restart: unless-stopped
environment:
- PROVIDERS_GOOGLE_CLIENT_ID=${GOOGLE_CLIENT_ID}
- PROVIDERS_GOOGLE_CLIENT_SECRET=${GOOGLE_CLIENT_SECRET}
- SECRET=${SECRET_SALT}
- COOKIE_DOMAIN=${HOME_URL}
- AUTH_HOST=auth.${HOME_URL}
- LOG_LEVEL=${LOG_LEVEL}
- WHITELIST=${WHITELISTED}
- LIFETIME=${AUTH_LOGIN_TOKEN_EXPIRY}
labels:
- "traefik.enable=true"
- "traefik.http.routers.tfa.rule=Host(`auth.${HOME_URL}`)"
- "traefik.http.routers.tfa.entrypoints=websecure"
- "traefik.http.routers.tfa.service=tfa"
- "traefik.http.routers.tfa.tls.certresolver=homeinfra"
- "traefik.http.middlewares.tfa.forwardauth.address=http://tfa:4181"
- "traefik.http.middlewares.tfa.forwardauth.authResponseHeaders=X-Forwarded-User"
- "traefik.http.services.tfa.loadbalancer.server.port=4181"
- "traefik.http.routers.tfa.middlewares=tfa"
logging:
driver: gelf
options:
gelf-address: udp://localhost:12201
tag: "tfa"
# Reverse Proxy
traefik:
container_name: traefik
image: traefik:v2.3.6
depends_on:
- tfa
restart: unless-stopped
environment:
- CLOUDFLARE_DNS_API_TOKEN=${CF_KEY}
command:
- --log.level=${LOG_LEVEL}
- --entrypoints.web.address=:80
- --entrypoints.websecure.address=:443
- --providers.docker
- --api.insecure=false
- --certificatesresolvers.homeinfra.acme.caserver=https://acme-v02.api.letsencrypt.org/directory
- --certificatesresolvers.homeinfra.acme.email=${CF_EMAIL}
- --certificatesresolvers.homeinfra.acme.storage=/acme.json
- --certificatesresolvers.homeinfra.acme.dnschallenge=true
- --certificatesresolvers.homeinfra.acme.dnschallenge.provider=cloudflare
ports:
- "80:80"
- "443:443"
volumes:
- "/var/run/docker.sock:/var/run/docker.sock:ro"
- "./acme.json:/acme.json"
labels:
# Dashboard
- "traefik.enable=true"
- "traefik.http.routers.traefik.rule=Host(`traefik.${HOME_URL}`)"
- "traefik.http.routers.traefik.service=api@internal"
# Wildcard cert
- "traefik.http.routers.traefik.tls.domains[0].main=${HOME_URL}"
- "traefik.http.routers.traefik.tls.domains[0].sans=*.${HOME_URL}"
- "traefik.http.routers.traefik.tls.certresolver=homeinfra"
# Auth
- "traefik.http.routers.traefik.entrypoints=websecure"
- "traefik.http.routers.traefik.middlewares=tfa"
# global redirect to https
- "traefik.http.routers.http-catchall.rule=hostregexp(`{host:.+}`)"
- "traefik.http.routers.http-catchall.entrypoints=web"
- "traefik.http.routers.http-catchall.middlewares=redirect-to-https"
# middleware redirect
- "traefik.http.middlewares.redirect-to-https.redirectscheme.scheme=https"
extra_hosts:
- host.docker.internal:172.17.0.1
logging:
driver: gelf
options:
gelf-address: udp://localhost:12201
tag: "traefik"
# Dashboard
heimdall:
container_name: heimdall
image: ghcr.io/linuxserver/heimdall
depends_on:
- traefik
restart: unless-stopped
environment:
- PUID=${PUID}
- PGID=${PGID}
- TZ=${TZ}
volumes:
- heimdall_data:/config
labels:
- "traefik.enable=true"
- "traefik.http.routers.heimdall.rule=Host(`${HOME_URL}`)"
- "traefik.http.routers.heimdall.entrypoints=websecure"
- "traefik.http.services.heimdall.loadbalancer.server.port=80"
- "traefik.http.routers.heimdall.service=heimdall"
- "traefik.http.routers.heimdall.tls.certresolver=homeinfra"
- "traefik.http.routers.heimdall.middlewares=tfa"
logging:
driver: gelf
options:
gelf-address: udp://localhost:12201
tag: "heimdall"
# Container control
portainer:
container_name: portainer
image: portainer/portainer-ce:2.0.1
depends_on:
- traefik
command: -H unix:///var/run/docker.sock
restart: unless-stopped
volumes:
- /var/run/docker.sock:/var/run/docker.sock
- portainer_data:/data
labels:
# Frontend
- "traefik.enable=true"
- "traefik.http.routers.portainer-frontend.rule=Host(`portainer.${HOME_URL}`)"
- "traefik.http.routers.portainer-frontend.entrypoints=websecure"
- "traefik.http.services.portainer-frontend.loadbalancer.server.port=9000"
- "traefik.http.routers.portainer-frontend.service=portainer-frontend"
- "traefik.http.routers.portainer-frontend.tls.certresolver=homeinfra"
- "traefik.http.routers.portainer-frontend.middlewares=tfa"
# Edge
- "traefik.http.routers.portainer-edge.rule=Host(`edge.${HOME_URL}`)"
- "traefik.http.routers.portainer-edge.entrypoints=websecure"
- "traefik.http.services.portainer-edge.loadbalancer.server.port=8000"
- "traefik.http.routers.portainer-edge.service=portainer-edge"
- "traefik.http.routers.portainer-edge.tls.certresolver=homeinfra"
- "traefik.http.routers.portainer-edge.middlewares=tfa"
logging:
driver: gelf
options:
gelf-address: udp://localhost:12201
tag: "portainer"
# AdBlocking
pihole:
container_name: pihole
depends_on:
- cloudflared
restart: unless-stopped
image: pihole/pihole:latest
network_mode: host
cap_add:
- NET_ADMIN
volumes:
- pihole_data:/etc
environment:
- TZ=${TZ}
- DNS1=127.0.0.1#5053
- WEB_PORT=8001
- VIRTUAL_HOST=pihole.${HOME_URL}
- WEBPASSWORD=
labels:
- "traefik.enable=true"
- "traefik.http.routers.pihole.rule=Host(`pihole.${HOME_URL}`)"
- "traefik.http.routers.pihole.entrypoints=websecure"
- "traefik.http.services.pihole.loadbalancer.server.port=8001"
- "traefik.http.routers.pihole.service=pihole"
- "traefik.http.routers.pihole.tls.certresolver=homeinfra"
- "traefik.http.routers.pihole.middlewares=tfa"
logging:
driver: gelf
options:
gelf-address: udp://localhost:12201
tag: "pihole"
# Home Automation.
homeassistant:
container_name: hass
image: homeassistant/raspberrypi4-64-homeassistant:stable
restart: unless-stopped
depends_on:
- traefik
volumes:
- ./hassio:/config
network_mode: host
environment:
- TZ=${TZ}
labels:
- "traefik.enable=true"
- "traefik.http.routers.hass.rule=Host(`hass.${HOME_URL}`)"
- "traefik.http.routers.hass.entrypoints=websecure"
- "traefik.http.services.hass.loadbalancer.server.port=8123"
- "traefik.http.routers.hass.service=hass"
- "traefik.http.routers.hass.tls.certresolver=homeinfra"
- "traefik.http.routers.hass.middlewares=tfa"
logging:
driver: gelf
options:
gelf-address: udp://localhost:12201
tag: "hass"
# ELK - Stack
elasticsearch:
container_name: elastic
image: elasticsearch:7.9.3
restart: unless-stopped
volumes:
- elasticsearch_data:/usr/share/elasticsearch/data
environment:
- discovery.type=single-node
- "ES_JAVA_OPTS=-Xms512m -Xmx512m"
ports:
- 9200:9200
logging:
driver: gelf
options:
gelf-address: udp://localhost:12201
tag: "elastic"
logstash:
container_name: logs
image: raquette/logstash-oss:7.9.3
restart: unless-stopped
links:
- elasticsearch
volumes:
- ./logstash:/etc/logstash
environment:
- "LS_JAVA_OPTS=-Xms512m -Xmx512m"
command: logstash -f /etc/logstash/logstash.conf
ports:
- 12201:12201/udp
depends_on:
- elasticsearch
logging:
driver: gelf
options:
gelf-address: udp://localhost:12201
tag: "logstash"
kibana:
container_name: kibana
image: raquette/kibana-oss:7.9.3
restart: unless-stopped
ports:
- 5601:5601
depends_on:
- elasticsearch
- logstash
- traefik
labels:
- "traefik.enable=true"
- "traefik.http.routers.kibana.rule=Host(`kibana.${HOME_URL}`)"
- "traefik.http.routers.kibana.entrypoints=websecure"
- "traefik.http.services.kibana.loadbalancer.server.port=5601"
- "traefik.http.routers.kibana.service=kibana"
- "traefik.http.routers.kibana.tls.certresolver=homeinfra"
- "traefik.http.routers.kibana.middlewares=tfa"
logging:
driver: gelf
options:
gelf-address: udp://localhost:12201
tag: "kibana"
# Un-proxied services
# DDNS, let CF know which IP to send traffic to.
cloudflare-ddns:
container_name: ddns
image: oznu/cloudflare-ddns:latest
restart: unless-stopped
environment:
- API_KEY=${CF_KEY}
- ZONE=${BASE_URL}
- SUBDOMAIN=${SUBDOMAIN}
- PROXIED=false
logging:
driver: gelf
options:
gelf-address: udp://localhost:12201
tag: "CF-DDNS"
# This service, adds all subdomains to cloudflare. service.home.domain.tld
cloudflare-companion:
container_name: cloudflare
image: docker.pkg.github.com/jwillmer/docker-traefik-cloudflare-companion/docker-traefik-cloudflare-companion:6.1.2
depends_on:
- traefik
volumes:
- /var/run/docker.sock:/var/run/docker.sock:ro
environment:
- CF_TOKEN=${CF_KEY}
- TARGET_DOMAIN=${HOME_URL}
- DOMAIN1=${BASE_URL}
- DOMAIN1_ZONE_ID=${CF_ZONE}
- DOMAIN1_PROXIED=false
restart: unless-stopped
logging:
driver: gelf
options:
gelf-address: udp://localhost:12201
tag: "cf-companion"
# DNS over HTTPS using Cloudflare.
cloudflared:
container_name: cloudflared
image: crazymax/cloudflared:latest
restart: unless-stopped
network_mode: host
environment:
- TZ=${TZ}
logging:
driver: gelf
options:
gelf-address: udp://localhost:12201
tag: "cloudflared"