This repository has been archived by the owner on Oct 5, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
docker-compose.yml
125 lines (122 loc) · 6.23 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
version: '3'
services:
traefik:
image: traefik:v2.9
restart: always
volumes:
- /srv/traefik/config/:/etc/traefik:z
- /srv/traefik/acme.json:/acme.json:z
- /var/run/docker.sock:/var/run/docker.sock:z,ro
ports:
- 80:80
- 443:443
networks:
- proxy
command:
# entrypoints redirect to https on http and default certResolver is letsencrypt prod
- "--entryPoints.http.address=:80"
- "--entryPoints.http.transport.respondingTimeouts.readTimeout=42"
- "--entryPoints.http.transport.respondingTimeouts.writeTimeout=42"
- "--entryPoints.http.transport.respondingTimeouts.idleTimeout=10"
- "--entryPoints.http.http.redirections.entryPoint.to=https"
- "--entryPoints.http.http.redirections.entryPoint.scheme=https"
- "--entryPoints.http.http.redirections.entryPoint.permanent=true"
- "--entryPoints.https.address=:443"
- "--entryPoints.https.transport.respondingTimeouts.readTimeout=42"
- "--entryPoints.https.transport.respondingTimeouts.writeTimeout=0"
- "--entryPoints.https.transport.respondingTimeouts.idleTimeout=180"
# global static config
- "--global.checkNewVersion=false"
- "--global.sendAnonymousUsage=false"
- "--pilot.dashboard=false"
# traefik log to stdout
- "--log.level=ERROR"
- "--log.format=json"
# enable prometheus metrics
- "--metrics.prometheus=true"
- "--metrics.prometheus.manualrouting=true"
- "--metrics.prometheus.buckets=0.100000, 0.300000, 1.200000, 5.000000"
- "--metrics.prometheus.addEntryPointsLabels=true"
- "--metrics.prometheus.addrouterslabels=true"
- "--metrics.prometheus.addServicesLabels=true"
# disabled traefik api
#- "--api.dashboard=true"
# docker provider
- "--providers.docker.exposedByDefault=false"
- "--providers.docker.network=proxy"
# dynamic yaml file provider
- "--providers.file.filename=/etc/traefik/traefik-dynamic.yml"
- "--providers.file.watch=true"
# cert dns acme cloudflare
#- "--certificatesResolvers.le.acme.caserver=https://acme-staging-v02.api.letsencrypt.org/directory"
- "--certificatesResolvers.le.acme.storage=/acme.json"
- "--certificatesResolvers.le.acme.keyType=EC384"
- "--certificatesResolvers.le.acme.dnsChallenge.provider=cloudflare"
- "--certificatesResolvers.le.acme.dnsChallenge.resolvers=1.1.1.1:53,8.8.8.8:53"
- "--certificatesResolvers.le.acme.dnsChallenge.delayBeforeCheck=0"
labels:
- traefik.enable=true
# all wildcards domain certs for the instance
- traefik.http.routers.traefik.tls.domains[0].main=paulgo.io
- traefik.http.routers.traefik.tls.domains[0].sans=*.paulgo.io
- traefik.http.routers.traefik.tls.domains[1].main=paulgo.net
- traefik.http.routers.traefik.tls.domains[1].sans=*.paulgo.net
- traefik.http.routers.traefik.tls.domains[2].main=paulgo.dev
- traefik.http.routers.traefik.tls.domains[2].sans=*.paulgo.dev
- traefik.http.routers.traefik.tls.domains[3].main=staging.paulgo.io
- traefik.http.routers.traefik.tls.domains[3].sans=*.staging.paulgo.io
# block hostname with internal-secure chain and noop service
- traefik.http.routers.traefik.rule=Host(`${HOSTNAME}`)&&Method(`GET`,`HEAD`)
- traefik.http.routers.traefik.entrypoints=https
- traefik.http.routers.traefik.tls.certresolver=le
- traefik.http.routers.traefik.service=noop@internal
- traefik.http.routers.traefik.middlewares=internal-secure
# manual router for node exporter metrics
- traefik.http.routers.node.rule=Host(`${HOSTNAME}`)&&Path(`/node/metrics`)&&Method(`GET`,`HEAD`)
- traefik.http.routers.node.entrypoints=https
- traefik.http.routers.node.tls=true
- traefik.http.routers.node.service=node-service@file
- traefik.http.routers.node.middlewares=internal-secure,auth-metrics,metrics-path
- traefik.http.middlewares.metrics-path.replacepath.path=/metrics
# manual router for traefik prometheus metrics
- traefik.http.routers.prometheus.rule=Host(`${HOSTNAME}`)&&Path(`/traefik/metrics`)&&Method(`GET`,`HEAD`)
- traefik.http.routers.prometheus.entrypoints=https
- traefik.http.routers.prometheus.tls=true
- traefik.http.routers.prometheus.service=prometheus@internal
- traefik.http.routers.prometheus.middlewares=internal-secure,auth-metrics,metrics-path
# default middleware chains for external and internal
- traefik.http.middlewares.internal-secure.chain.middlewares=secure-headers,rate-limit,gzip-compress
- traefik.http.middlewares.external-secure.chain.middlewares=secure-headers,gzip-compress
# internal middlewares basic auth, ipwhitelist and ratelimiting
- traefik.http.middlewares.auth-metrics.basicauth.users=${PROMETHEUS_AUTH}
- traefik.http.middlewares.rate-limit.ratelimit.average=100
- traefik.http.middlewares.rate-limit.ratelimit.burst=50
# secure headers basic params, hsts 2 years all domains, remove x-powered-by
- traefik.http.middlewares.secure-headers.headers.customFrameOptionsValue=SAMEORIGIN
- traefik.http.middlewares.secure-headers.headers.browserXssFilter=true
- traefik.http.middlewares.secure-headers.headers.contentTypeNosniff=true
- traefik.http.middlewares.secure-headers.headers.referrerPolicy=no-referrer
- traefik.http.middlewares.secure-headers.headers.stsPreload=true
- traefik.http.middlewares.secure-headers.headers.stsIncludeSubdomains=true
- traefik.http.middlewares.secure-headers.headers.stsSeconds=63113904
- traefik.http.middlewares.secure-headers.headers.forceSTSHeader=true
- traefik.http.middlewares.secure-headers.headers.customResponseHeaders.X-Powered-By=
# default add gzip compression
- traefik.http.middlewares.gzip-compress.compress=true
environment:
- CF_API_EMAIL={EMAIL}
- CF_API_KEY={KEY1}
node:
image: quay.io/prometheus/node-exporter:latest
restart: always
command:
- "--path.rootfs=/host"
volumes:
- /:/host:ro,rslave,z
pid: host
network_mode: host
# labels defined in traefik dynamic config
networks:
proxy:
external: true