-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
153 lines (143 loc) · 3.72 KB
/
Copy pathdocker-compose.yml
File metadata and controls
153 lines (143 loc) · 3.72 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
x-logging:
&logging
driver: "json-file"
options:
max-size: "32m"
max-file: "10"
tag: "{{.Name}}"
services:
app:
build:
context: .
dockerfile: docker/app/Dockerfile
args:
- PORT=${APP_PORT}
labels:
logging: promtail
logging_jobname: app
traefik.enable: true
traefik.http.routers.app.rule: Host(`localhost`)
traefik.http.middlewares.ratelimiter.rateLimit.average: 100
traefik.http.middlewares.ratelimiter.rateLimit.burst: 200
traefik.http.middlewares.payloadLimiter.buffering.maxRequestBodyBytes: 10485760
traefik.http.middlewares.retry.retry.attempts: 5
traefik.http.routers.app.middlewares: ratelimiter, payloadLimiter, retry
logging: *logging
env_file:
- .env
networks:
- core
depends_on:
postgres:
condition: service_healthy
redis:
condition: service_healthy
postgres:
image: postgres:latest
logging: *logging
env_file:
- .env
command: ["postgres", "-c", "config_file=/etc/postgresql/postgresql.conf"]
networks:
- core
volumes:
- ./config/postgres/postgresql.conf:/etc/postgresql/postgresql.conf
- ./sql/schema:/docker-entrypoint-initdb.d/
- postgres_data:/var/lib/postgresql
healthcheck:
test: [ "CMD", "pg_isready", "-U", "${POSTGRES_USER}", "-d", "${POSTGRES_DB}" ]
interval: 10s
retries: 5
start_period: 30s
timeout: 5s
redis:
image: redis:latest
logging: *logging
networks:
- core
volumes:
- ./config/redis/redis.conf:/usr/local/etc/redis/redis.conf
- redis_data:/data
healthcheck:
test: [ "CMD", "redis-cli", "ping" ]
interval: 10s
retries: 5
start_period: 30s
timeout: 5s
prometheus:
image: prom/prometheus:latest
logging: *logging
networks:
- core
volumes:
- ./config/prometheus/prometheus.yaml:/etc/prometheus/prometheus.yaml
- prometheus_data:/prometheus
depends_on:
- app
promtail:
image: grafana/promtail:latest
logging: *logging
command:
- -config.file=/etc/promtail/promtail.yaml
networks:
- core
volumes:
- ./config/promtail/promtail.yaml:/etc/promtail/promtail.yaml
- /var/lib/docker/containers:/var/lib/docker/containers:ro
- /var/run/docker.sock:/var/run/docker.sock
loki:
image: grafana/loki:latest
logging: *logging
command:
- -config.file=/etc/loki/loki.yaml
networks:
- core
volumes:
- ./config/loki/loki.yaml:/etc/loki/loki.yaml:ro
grafana:
image: grafana/grafana:latest
labels:
traefik.enable: true
traefik.http.routers.grafana.rule: Host(`grafana.localhost`)
traefik.http.services.grafana.loadbalancer.server.port: 3000
traefik.http.middlewares.grafana-retry.retry.attempts: 5
traefik.http.routers.grafana.middlewares: grafana-retry
logging: *logging
env_file:
- .env
networks:
- core
volumes:
- ./config/grafana/datasources.yaml:/etc/grafana/provisioning/datasources/datasources.yaml
- grafana_data:/var/lib/grafana
depends_on:
- loki
traefik:
image: traefik:latest
logging: *logging
env_file:
- .env
command:
- --configFile=/etc/traefik/traefik.yml
ports:
- 80:80
networks:
- core
volumes:
- /var/run/docker.sock:/var/run/docker.sock
- ./config/traefik/traefik.yml:/etc/traefik/traefik.yml:ro
networks:
core:
name: core
driver: bridge
volumes:
postgres_data:
name: postgres_data
redis_data:
name: redis_data
prometheus_data:
name: prometheus_data
driver: local
grafana_data:
name: grafana_data
driver: local