-
Notifications
You must be signed in to change notification settings - Fork 7
/
traefik-stack-dd.yml
138 lines (131 loc) · 4.62 KB
/
traefik-stack-dd.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
version: '3.7'
networks:
traefik:
external: true
services:
pink:
image: emilevauge/whoami
environment:
APP_COLOR: 'pink'
deploy:
labels:
- traefik.enable=true
- traefik.http.services.pink.loadbalancer.server.port=80
- traefik.http.routers.pink.rule=Host(`pink.wshihadeh.cloud`)
- traefik.http.routers.pink.service=pink
- traefik.http.routers.pink.entrypoints=web
- traefik.http.routers.pink.middlewares=inflightreq-pink
- traefik.docker.network=traefik
restart_policy:
condition: any
delay: 5s
max_attempts: 3
window: 120s
update_config:
delay: 10s
order: start-first
parallelism: 1
rollback_config:
parallelism: 0
order: stop-first
networks:
- traefik
blue:
image: wshihadeh/whoami:soso
environment:
APP_COLOR: 'blue'
deploy:
labels:
- traefik.enable=true
- traefik.http.services.blue.loadbalancer.server.port=8080
- traefik.http.routers.blue.rule=Host(`blue.wshihadeh.cloud`)
- traefik.http.routers.blue.service=blue
- traefik.http.routers.blue.entrypoints=web
- traefik.http.routers.blue.middlewares=pink-ratelimit
- traefik.docker.network=traefik
restart_policy:
condition: any
delay: 5s
max_attempts: 3
window: 120s
update_config:
delay: 10s
order: start-first
parallelism: 1
rollback_config:
parallelism: 0
order: stop-first
networks:
- traefik
proxy:
image: traefik:v2.2
command:
- '--log.level=DEBUG'
- '--providers.docker=true'
- '--entryPoints.web.address=:80'
- '--entryPoints.metrics.address=:8082'
- '--providers.providersThrottleDuration=2s'
- '--providers.docker.watch=true'
- '--providers.docker.swarmMode=true'
- '--providers.docker.swarmModeRefreshSeconds=15s'
- '--providers.docker.exposedbydefault=false'
- '--providers.docker.defaultRule=Host("wshihadeh.cloud")'
- '--api=true'
- '--api.dashboard=true'
- '--api.insecure=true'
- '--ping.entryPoint=web'
- '--accesslog=true'
- '--accessLog.bufferingSize=0'
- '--accesslog.format=json'
- '--accesslog.fields.defaultmode=keep'
- '--accesslog.fields.names.ClientUsername=keep'
- '--accesslog.fields.headers.defaultmode=keep'
volumes:
- '/var/run/docker.sock:/var/run/docker.sock:ro'
ports:
- '80:80'
- '8080:8080'
deploy:
labels:
- traefik.enable=true
- traefik.docker.network=traefik
- traefik.http.middlewares.my-basic-auth.basicauth.users=traefik:$$apr1$$SnHDtk1N$$cpc7xSXXrMVnPYdF01WdC0
# IP whiteList
- traefik.http.middlewares.ipwhitelist-prom.ipwhitelist.sourcerange=0.0.0.0/0
#- traefik.http.middlewares.ipwhitelist-prom.ipwhitelist.ipStrategy.excludedIPs=10.0.0.1,10.0.0.2
# inflightreq
- traefik.http.middlewares.inflightreq-pink.inflightreq.amount=10
- traefik.http.middlewares.inflightreq-pink.inflightreq.sourcecriterion.ipstrategy.excludedips=127.0.0.1
- traefik.http.middlewares.inflightreq-pink.inflightreq.sourcecriterion.requestheadername=X-Forwarded-Server
- traefik.http.middlewares.inflightreq-pink.inflightreq.sourcecriterion.requesthost=true
# ratelimit
- traefik.http.middlewares.pink-ratelimit.ratelimit.average=10
- traefik.http.middlewares.pink-ratelimit.ratelimit.period=10s
- traefik.http.middlewares.pink-ratelimit.ratelimit.burst=1
- traefik.http.middlewares.pink-ratelimit.ratelimit.sourcecriterion.ipstrategy.excludedips=10.0.0.4
- traefik.http.middlewares.pink-ratelimit.ratelimit.sourcecriterion.requestheadername=X-Real-Ip
- traefik.http.middlewares.pink-ratelimit.ratelimit.sourcecriterion.requesthost=true
# Dashboard Router
- traefik.http.services.traefik-dashboard.loadbalancer.server.port=8080
- traefik.http.routers.traefik-dashboard.rule=Host(`dashboard.wshihadeh.cloud`)
- traefik.http.routers.traefik-dashboard.service=traefik-dashboard
- traefik.http.routers.traefik-dashboard.entrypoints=web
restart_policy:
condition: any
delay: 5s
max_attempts: 3
window: 120s
update_config:
delay: 10s
order: start-first
parallelism: 1
rollback_config:
parallelism: 0
order: stop-first
logging:
driver: json-file
options:
'max-size': '10m'
'max-file': '5'
networks:
- traefik