-
Notifications
You must be signed in to change notification settings - Fork 0
/
docker-compose.yml
80 lines (78 loc) · 2.73 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
version: '3.9'
services:
reverse-proxy:
# The official v2 Traefik docker image
image: traefik:v2.4
# Enables the web UI and tells Traefik to listen to docker
# command: --api.insecure=true --log.Level=DEBUG --metrics.prometheus=true --providers.docker
command:
- "--log.Level=DEBUG"
- "--api.insecure=true"
- "--metrics.prometheus=true"
- "--providers.docker"
ports:
# The HTTP port
- "80:80"
- "8081:8081"
# The Web UI (enabled by --api.insecure=true)
- "8080:8080"
volumes:
# So that Traefik can listen to the Docker events
- /var/run/docker.sock:/var/run/docker.sock
networks:
- traefik
prometheus:
image: prom/prometheus:v2.24.1
container_name: prometheus
volumes:
- ./prometheus/:/etc/prometheus
command:
- '--config.file=/etc/prometheus/prometheus.yml'
- '--storage.tsdb.path=/prometheus'
ports:
- "9090:9090"
labels:
- "traefik.enable=false"
- "traefik.backend=prometheus"
- "traefik.prometheus.rule=Host:prometheus.docker.localhost"
- "traefik.port=9090"
networks:
- traefik
post_app:
build: ./post_app
environment:
- app_instances=10
labels:
- "traefik.enable=true"
- "traefik.http.routers.post_app.service=post-app-traefik"
- "traefik.port=8081"
networks:
- traefik
whoami:
# A container that exposes an API to show its IP address
image: traefik/whoami
deploy:
replicas: 10
labels:
- "traefik.enable=true"
- "traefik.backend=whoami"
- "traefik.http.routers.whoami-get.rule=Method(`GET`) && Path(`/login`)"
- "traefik.http.routers.whoami-get.service=whoami-traefik"
- "traefik.http.routers.whoami-post.rule=Method(`POST`) && Path(`/register`) || Method(`POST`) && Path(`/changePassword`)"
- "traefik.http.routers.whoami-post.service=post-app-traefik"
- "traefik.http.routers.whoami.middlewares=whoami-get-rl,whoami-post-rl,whoami-eh,whoami-post-rewrite"
- "traefik.http.middlewares.whoami-get-rl.ratelimit.average=1000"
- "traefik.http.middlewares.whoami-post-rl.ratelimit.average=100"
- "traefik.http.middlewares.whoami-eh.retry.initialinterval=10ms"
- "traefik.http.middlewares.whoami-eh.retry.attempts=100"
- "traefik.http.middlewares.whoami-post-rewrite.redirectregex.regex=^http://localhost/changePassword"
- "traefik.http.middlewares.whoami-post-rewrite.redirectregex.replacement=http://localhost:8081/changePassword"
- "traefik.http.middlewares.whoami-post-rewrite.redirectregex.permanent=true"
networks:
- traefik
networks:
traefik:
driver: bridge
ipam:
config:
- subnet: 192.168.16.0/24