-
Notifications
You must be signed in to change notification settings - Fork 1
/
compose.yml
165 lines (155 loc) · 4.25 KB
/
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
---
x-common: &labels
hostname: ${HOSTNAME}
io.prometheus/scrape: true
io.github.agebhar1.project: observability
services:
postgres:
image: postgres:16.4
volumes:
- ${POSTGRES_DATA:-postgres_data}:/var/lib/postgresql/data
environment:
POSTGRES_PASSWORD: secret
POSTGRES_DB: grafana
ports:
- 5432:5432
user: ${POSTGRES_USER:-root}
healthcheck:
test: pg_isready -U postgres
interval: 1m30s
timeout: 5s
# -- requires Docker Engine >= v25 --
start_period: 30s
start_interval: 2s
labels:
io.github.agebhar1.project: observability
postgres-exporter:
image: quay.io/prometheuscommunity/postgres-exporter:v0.15.0
environment:
DATA_SOURCE_URI: postgres:5432/grafana?sslmode=disable
DATA_SOURCE_USER: postgres
DATA_SOURCE_PASS: secret
labels:
<<: *labels
prometheus:
image: prom/prometheus:v2.54.1
volumes:
- /var/run/docker.sock:/var/run/docker.sock
- ./etc/prometheus:/etc/prometheus:ro
- ${PROMETHEUS_DATA:-prometheus_data}:/var/lib/prometheus
command:
- --config.file=/etc/prometheus/config.yml
- --storage.tsdb.path=/var/lib/prometheus
- --web.console.libraries=/usr/share/prometheus/console_libraries
- --web.console.templates=/usr/share/prometheus/consoles
ports:
- 9090:9090
user: ${PROMETHEUS_USER:-65534}:${DOCKER_GID:-65534}
restart: unless-stopped
labels:
<<: *labels
grafana:
image: grafana/grafana:11.2.0
volumes:
- ./etc/grafana/provisioning:/etc/grafana/provisioning:ro
environment:
# [security]
GF_SECURITY_ADMIN_USER: admin
GF_SECURITY_ADMIN_PASSWORD: s3cr3t
# [database]
GF_DATABASE_TYPE: postgres
GF_DATABASE_HOST: postgres:5432
GF_DATABASE_USER: postgres
GF_DATABASE_PASSWORD: secret
GF_DATABASE_LOG_QUERIES: ${GF_DATABASE_LOG_QUERIES:-false}
ports:
- 3000:3000
depends_on:
postgres:
condition: service_healthy
restart: true
restart: unless-stopped
labels:
<<: *labels
loki:
image: grafana/loki:2.9.10
volumes:
- ./etc/loki/config.yml:/etc/loki/config.yml:ro
- ${LOKI_DATA:-loki_data}:/var/lib/loki
command:
- -config.file=/etc/loki/config.yml
- -log.level=${LOKI_LOG_LEVEL:-info}
ports:
- 3100:3100
user: ${LOKI_USER:-10001:10001}
restart: unless-stopped
labels:
<<: *labels
minio:
image: minio/minio:RELEASE.2024-08-29T01-40-52Z
volumes:
- ${MINIO_DATA:-minio_data}:/data
environment:
MINIO_PROMETHEUS_AUTH_TYPE: public
MINIO_PROMETHEUS_URL: http://prometheus:9090
MINIO_PROMETHEUS_JOB_ID: containers
MINIO_ROOT_USER: admin
MINIO_ROOT_PASSWORD: minios3cr3t
command:
- server
- /data
- --console-address=:9001
ports:
- 9000:9000
- 9001:9001
user: ${MINIO_USER}:${DOCKER_GID}
restart: unless-stopped
healthcheck:
test: mc ready local/
interval: 1m30s
timeout: 5s
# -- requires Docker Engine >= v25 --
start_period: 30s
start_interval: 2s
labels:
<<: *labels
io.prometheus/port: 9000
io.prometheus/path: /minio/v2/metrics/cluster
# https://grafana.com/docs/grafana-cloud/quickstart/docker-compose-linux/
promtail:
image: grafana/promtail:2.9.10
volumes:
- ./etc/promtail/config.yml:/etc/promtail/config.yml:ro
- /var/run/docker.sock:/var/run/docker.sock
- /var/lib/docker/containers:/var/lib/docker/containers:ro
- /var/log/journal/:/var/log/journal/:ro
- /run/log/journal/:/run/log/journal/:ro
- ${LOGFILES:-./var/log}:/mnt/log:ro
- promtail_data:/var/lib/promtail
ports:
- 9080:9080
restart: unless-stopped
labels:
<<: *labels
io.prometheus/port: 9080
cadvisor:
image: gcr.io/cadvisor/cadvisor:v0.49.1
volumes:
- /:/rootfs:ro
- /var/run:/var/run:ro
- /sys:/sys:ro
- /var/lib/docker/:/var/lib/docker:ro
- /dev/disk/:/dev/disk:ro
devices:
- /dev/kmsg
ports:
- 8080:8080
restart: unless-stopped
labels:
<<: *labels
volumes:
postgres_data:
prometheus_data:
promtail_data:
loki_data:
minio_data: