-
Notifications
You must be signed in to change notification settings - Fork 114
Expand file tree
/
Copy pathtraefik.yml
More file actions
188 lines (174 loc) · 6 KB
/
Copy pathtraefik.yml
File metadata and controls
188 lines (174 loc) · 6 KB
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
---
hostname: traefik.flyingrabb.it
galaxy_active_users_script: /usr/local/bin/galaxy_active_users
telegraf_plugins_extra:
galaxy_active_users:
plugin: 'exec'
config:
- commands = ["{{ galaxy_active_users_script }}"]
- timeout = "15s"
- data_format = "influx"
- interval = "1m"
listen_galaxy_routes:
plugin: "prometheus"
config:
- urls = ["http://127.0.0.1:8082"]
- metric_version = 2
- name_override = "traefik"
traefik_force_validation: true
traefik_manage_secrets: true
traefik_no_service_log: false
traefik_log_dir: /var/log/traefik
traefik_dir: /etc/traefik
traefik_user: centos
traefik_group: centos
lp_logrotate_confd:
- path: traefik
conf: |
{{ traefik_log_dir }}/*.log {
daily
missingok
rotate 1
compress
delaycompress
notifempty
create 0644 root root
sharedscripts
postrotate
# kill & restart container which contains "traefik" in name
docker kill --signal="USR1" $(docker ps | grep traefik | awk '{print $1}')
endscript
}
traefik_copy_rules: true
traefik_domain: "{{ hostname }}"
traefik_networks:
traefik:
internal: false
driver: overlay
traefik_containers:
- name: traefik
replicas: 1
image: traefik:v3.7.0
url: "https://traefik.{{ tailscale_domain }}/dashboard/#/"
environment:
AWS_SHARED_CREDENTIALS_FILE: "/run/secrets/aws_shared_credentials"
AWS_REGION: "us-east-1"
networks:
- traefik
command:
- --ping
- --ping.entryPoint=websecure
- --api=true
- "--providers.swarm.exposedByDefault=false"
- "--providers.swarm.endpoint=unix:///var/run/docker.sock"
- --api.dashboard=true
- --api.insecure=false
- --global.sendAnonymousUsage=false
- --global.checkNewVersion=false
- --entryPoints.web.address=:80
- --entryPoints.websecure.address=:443
- --entryPoints.amqps.address=:5671
- --entryPoints.influxdb.address=:8086
- --entryPoints.cvmfs-rsync.address=:5432
- --entryPoints.web.http.redirections.entryPoint.to=websecure
- --entryPoints.web.http.redirections.entryPoint.scheme=https
- --entryPoints.metrics.address=:8082
#- "--entryPoints.websecure.http.tls.domains[0].main={{ traefik_domain }}"
#- --entryPoints.https.http.tls.certresolver=route53
#- "--entryPoints.websecure.http.tls.domains[0].sans=*.{{ traefik_domain }}"
# Prometheus Metrics
- --metrics.prometheus=true
- --metrics.prometheus.buckets=0.1,0.3,1.2,5.0
- --metrics.prometheus.addEntryPointsLabels=true
- --metrics.prometheus.addrouterslabels=true
- --metrics.prometheus.addServicesLabels=true
- --metrics.prometheus.entryPoint=metrics
- --metrics.prometheus.headerlabels.origin=Origin
- "--providers.file.directory=/rules"
- "--providers.file.watch=true"
## DNS Challenge
- --certificatesResolvers.ts.tailscale=true
- --certificatesResolvers.route53.acme.storage=/letsencrypt/acme.json
- --certificatesResolvers.route53.acme.dnsChallenge.provider=route53
- --certificatesresolvers.route53.acme.caserver=https://acme-v02.api.letsencrypt.org/directory
- "--certificatesresolvers.route53.acme.email={{ traefik_letsencrypt_mail }}"
# Enable Logging
- "--log.level=INFO" # DEBUG, PANIC, FATAL, ERROR, WARN, INFO
- "--accesslog=true"
- "--accesslog.filepath={{ traefik_log_dir }}/access.log"
labels:
"traefik.enable": "true"
"traefik.http.routers.traefik.rule": "Host(`traefik.{{ tailscale_domain }}`)"
"traefik.http.routers.traefik.entrypoints": "websecure"
"traefik.http.routers.traefik.tls": "true"
"traefik.http.routers.traefik.tls.certresolver": "ts"
"traefik.http.routers.traefik.tls.domains[0].main": "traefik.{{ tailscale_domain }}"
"traefik.http.routers.traefik.service": "api@internal"
"traefik.http.services.dummy-svc.loadbalancer.server.port": "9999" # dummy needed by swarm
security_opts:
- "label:type:container_runtime_t"
mode: global
mounts:
- source: "/var/run/docker.sock"
target: "/var/run/docker.sock"
type: bind
readonly: true
- source: "/var/run/tailscale"
target: "/var/run/tailscale"
type: bind
readonly: true
- source: "/etc/traefik/rules/"
target: "/rules"
type: bind
readonly: true
- source: "/etc/traefik/acme.json"
target: "/letsencrypt/acme.json"
type: bind
readonly: false
- source: "{{ traefik_log_dir }}/"
target: "{{ traefik_log_dir }}"
type: bind
readonly: false
publish:
- target_port: 80
published_port: 80
protocol: tcp
mode: host
- target_port: 443
published_port: 443
protocol: tcp
mode: host
- target_port: 5671
published_port: 5671
protocol: tcp
mode: host
- target_port: 8082
published_port: 8082
protocol: tcp
mode: host
- target_port: 8086
published_port: 8086
protocol: tcp
mode: host
- target_port: 5432
published_port: 5432
protocol: tcp
mode: host
secrets:
- secret_name: aws_shared_credentials
# Leave for testing and example if more containers are added
- name: whoami
image: "traefik/whoami"
url: "https://traefik.{{ tailscale_domain }}/whoami"
replicas: 2
mode: replicated
labels:
"traefik.enable": "true"
"traefik.http.routers.whoami.rule": "Host(`traefik.{{ tailscale_domain }}`) && PathPrefix(`/whoami`)"
"traefik.http.routers.whoami.entrypoints": "websecure"
"traefik.http.routers.whoami.service": "whoami-app"
"traefik.http.services.whoami-app.loadbalancer.server.port": "80"
"traefik.http.routers.whoami.tls.domains[0].main": "traefik.{{ tailscale_domain }}"
"traefik.http.routers.whoami.tls.certresolver": "ts"
networks:
- traefik