-
Notifications
You must be signed in to change notification settings - Fork 1
/
docker-compose.yml
234 lines (208 loc) · 8.87 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
version: "3.8"
# https://github.com/rancher/k3d/issues/238#issuecomment-627290563
#
# ports:
# - 3000 - grafana
# - 5000 - registry-local docker registry
# - 6379 - redis
# - 8000 - traefik "web"
# - 8080 - traefik
# - 8082 - cadvisor
# - 8443 - traefik "websecure"
# - 9090 - prometheus
# - 9100 - node-exporter
services:
registry:
image: "traefik:v2.3"
container_name: traefik
restart: unless-stopped
ports:
- "8000:80"
- "8443:443"
- "8080:8080"
networks:
k3d-backend: # only this service need to be exposed
aliases:
- traefik
- registry-local.local
- registry-quayio.local
- registry-dockerio.local
- registry-gcrio.local
- prometheus.local
backend:
aliases:
- traefik
- registry-local.local
- registry-quayio.local
- registry-dockerio.local
- registry-gcrio.local
- prometheus.local
volumes:
- "/var/run/docker.sock:/var/run/docker.sock:ro"
- "./services/traefik/traefik:/etc/traefik:ro"
- "./services/traefik/certs:/etc/certs:ro"
labels:
- "traefik.enable=true"
# Reusable replacepath middleware
- "traefik.http.middlewares.replacerewithmetricspath.replacepath.path=/metrics"
grafana:
image: grafana/grafana:7.3.2
container_name: grafana
restart: unless-stopped
ports:
- 3000:3000
volumes:
- "grafana:/var/lib/grafana"
- "./services/grafana/provisioning:/etc/grafana/provisioning:ro"
- "./services/grafana/dashboards:/etc/grafana/dashboards:ro"
labels:
- "traefik.enable=true"
# Define my service
- "traefik.http.services.grafana.loadbalancer.server.port=3000"
# Route grafana.local to me
- "traefik.http.routers.grafana.rule=Host(`grafana.local`)"
- "traefik.http.routers.grafana.entrypoints=web,websecure"
- "traefik.http.routers.grafana.tls=true"
- "traefik.http.routers.grafana.service=grafana"
# Set up Middleware for stripping /grafana path prefix
- "traefik.http.middlewares.grafana-stripprefix.stripprefix.prefixes=/grafana"
# Route /grafana to me ...
- "traefik.http.routers.grafana-via-path.rule=Path(`/grafana`)"
- "traefik.http.routers.grafana-via-path.entrypoints=web"
- "traefik.http.routers.grafana-via-path.service=grafana"
# ... but strip the prefix first
- "traefik.http.routers.grafana-via-path.middlewares=grafana-stripprefix"
environment:
- GF_SECURITY_ADMIN_USER=${ADMIN_USER:-admin}
- GF_SECURITY_ADMIN_PASSWORD=${ADMIN_PASSWORD:-admin}
networks:
backend:
prometheus:
image: prom/prometheus:latest
container_name: prometheus
restart: unless-stopped
ports:
- 9090:9090
command:
- "--config.file=/etc/prometheus/prometheus.yml"
- '--web.enable-lifecycle'
volumes:
- "prometheus:/prometheus"
- "./services/prometheus/prometheus.yml:/etc/prometheus/prometheus.yml:ro"
labels:
- "traefik.enable=true"
# Define my service
- "traefik.http.services.prometheus.loadbalancer.server.port=9090"
# Route prometheus.local to me
- "traefik.http.routers.prometheus.rule=Host(`prometheus.local`)"
- "traefik.http.routers.prometheus.entrypoints=web,websecure"
- "traefik.http.routers.prometheus.tls=true"
- "traefik.http.routers.prometheus.service=prometheus"
networks:
backend:
registry-quayio:
image: "registry:2"
container_name: registry-quayio
restart: unless-stopped
volumes:
- "registry-quayio:/var/lib/registry"
- "./services/registry/config.yml:/etc/docker/registry/config.yml:ro"
labels:
- "traefik.enable=true"
# Route registry-quayio.local to port 5000
- "traefik.http.routers.registry-quayio.rule=Host(`registry-quayio.local`)"
- "traefik.http.routers.registry-quayio.entrypoints=web,websecure"
- "traefik.http.routers.registry-quayio.tls=true"
- "traefik.http.routers.registry-quayio.service=registry-quayio"
- "traefik.http.services.registry-quayio.loadbalancer.server.port=5000"
# Route registry-quayio.local/metrics to port 5001
- "traefik.http.routers.registry-quayio-metrics.rule=Host(`registry-quayio.local`) && Path(`/metrics`)"
- "traefik.http.routers.registry-quayio-metrics.entrypoints=web,websecure"
- "traefik.http.routers.registry-quayio-metrics.tls=true"
- "traefik.http.routers.registry-quayio-metrics.service=registry-quayio-metrics"
- "traefik.http.services.registry-quayio-metrics.loadbalancer.server.port=5001"
# Route /registry-quayio/metrics to port 5001, replacepath
- "traefik.http.routers.registry-quayio-metrics-path.rule=Path(`/registry-quayio/metrics`)"
- "traefik.http.routers.registry-quayio-metrics-path.entrypoints=web"
- "traefik.http.routers.registry-quayio-metrics-path.service=registry-quayio-metrics"
- "traefik.http.routers.registry-quayio-metrics-path.middlewares=replacerewithmetricspath"
networks:
backend:
environment:
REGISTRY_PROXY_REMOTEURL: "https://quay.io/repository"
REGISTRY_COMPATIBILITY_SCHEMA1_ENABLED: "true"
registry-dockerio:
image: "registry:2"
container_name: registry-dockerio
restart: unless-stopped
volumes:
- "registry-dockerio:/var/lib/registry"
- "./services/registry/config.yml:/etc/docker/registry/config.yml:ro"
labels:
- "traefik.enable=true"
# Route registry-dockerio.local to port 5000
- "traefik.http.routers.registry-dockerio.rule=Host(`registry-dockerio.local`)"
- "traefik.http.routers.registry-dockerio.entrypoints=web,websecure"
- "traefik.http.routers.registry-dockerio.tls=true"
- "traefik.http.routers.registry-dockerio.service=registry-dockerio"
- "traefik.http.services.registry-dockerio.loadbalancer.server.port=5000"
# Route registry-dockerio.local/metrics to port 5001
- "traefik.http.routers.registry-dockerio-metrics.rule=Host(`registry-dockerio.local`) && Path(`/metrics`)"
- "traefik.http.routers.registry-dockerio-metrics.entrypoints=web,websecure"
- "traefik.http.routers.registry-dockerio-metrics.tls=true"
- "traefik.http.routers.registry-dockerio-metrics.service=registry-dockerio-metrics"
- "traefik.http.services.registry-dockerio-metrics.loadbalancer.server.port=5001"
# Route /registry-dockerio/metrics to port 5001, replacepath
- "traefik.http.routers.registry-dockerio-metrics-path.rule=Path(`/registry-dockerio/metrics`)"
- "traefik.http.routers.registry-dockerio-metrics-path.entrypoints=web"
- "traefik.http.routers.registry-dockerio-metrics-path.service=registry-dockerio-metrics"
- "traefik.http.routers.registry-dockerio-metrics-path.middlewares=replacerewithmetricspath"
networks:
backend:
environment:
REGISTRY_PROXY_REMOTEURL: "http://registry-1.docker.io"
#REGISTRY_PROXY_USERNAME: "username"
#REGISTRY_PROXY_PASSWORD: "password"
registry-gcrio:
image: "registry:2"
container_name: registry-gcrio
restart: unless-stopped
volumes:
- "registry-gcrio:/var/lib/registry"
- "./services/registry/config.yml:/etc/docker/registry/config.yml:ro"
labels:
- "traefik.enable=true"
# Route registry-gcrio.local to port 5000
- "traefik.http.routers.registry-gcrio.rule=Host(`registry-gcrio.local`)"
- "traefik.http.routers.registry-gcrio.entrypoints=web,websecure"
- "traefik.http.routers.registry-gcrio.tls=true"
- "traefik.http.routers.registry-gcrio.service=registry-gcrio"
- "traefik.http.services.registry-gcrio.loadbalancer.server.port=5000"
# Route registry-gcrio.local/metrics to port 5001
- "traefik.http.routers.registry-gcrio-metrics.rule=Host(`registry-gcrio.local`) && Path(`/metrics`)"
- "traefik.http.routers.registry-gcrio-metrics.entrypoints=web,websecure"
- "traefik.http.routers.registry-gcrio-metrics.tls=true"
- "traefik.http.routers.registry-gcrio-metrics.service=registry-gcrio-metrics"
- "traefik.http.services.registry-gcrio-metrics.loadbalancer.server.port=5001"
# Route /registry-gcrio/metrics to port 5001, replacepath
- "traefik.http.routers.registry-gcrio-metrics-path.rule=Path(`/registry-gcrio/metrics`)"
- "traefik.http.routers.registry-gcrio-metrics-path.entrypoints=web"
- "traefik.http.routers.registry-gcrio-metrics-path.service=registry-gcrio-metrics"
- "traefik.http.routers.registry-gcrio-metrics-path.middlewares=replacerewithmetricspath"
networks:
backend:
environment:
REGISTRY_PROXY_REMOTEURL: "https://gcr.io"
volumes:
registry-quayio:
registry-dockerio:
registry-gcrio:
prometheus:
grafana:
# add external: true when we decide volumes should be kept for real
# external: true
networks:
backend:
name: backend
k3d-backend:
name: k3d-backend