-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdocker-compose.yml
207 lines (197 loc) · 5.72 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
services:
redis_server:
container_name: infra.redis
profiles: [ "infrastructure", "redis" ]
image: redis:7-alpine
restart: always
hostname: redis-server
volumes:
- infra.redis.data:/data
command: redis-server --port $REDIS_PORT --save 20 1 --loglevel warning --requirepass $REDIS_PASS
ports:
- 127.0.0.1:6379:6379
healthcheck:
test: "[ $$(redis-cli -h redis-server -p ${REDIS_PORT} -a ${REDIS_PASS} ping) = 'PONG' ] || exit 1"
interval: 1s
retries: 15
timeout: 15s
env_file:
- ".env"
networks:
- infrastructure
postgres_server:
container_name: infra.postgres
profiles: [ "infrastructure", "postgres" ]
image: postgres:16-alpine
restart: always
hostname: postgres-server
volumes:
- infra.postgres.data:/var/lib/postgresql/data
command: "postgres -c max_connections=150
-c shared_buffers=512MB -c effective_cache_size=1536MB
-c maintenance_work_mem=128MB -c checkpoint_completion_target=0.9 -c wal_buffers=16MB
-c default_statistics_target=100 -c random_page_cost=1.1 -c effective_io_concurrency=200
-c work_mem=3495kB -c min_wal_size=1GB -c max_wal_size=4GB -c max_worker_processes=2
-c max_parallel_workers_per_gather=1 -c max_parallel_workers=2 -c max_parallel_maintenance_workers=1"
ports:
- 127.0.0.1:5432:5432
healthcheck:
test: "pg_isready -d ${DB_NAME} -U ${DB_USER}"
interval: 1s
retries: 15
timeout: 15s
env_file:
- ".env"
networks:
- infrastructure
environment:
POSTGRES_USER: $DB_USER
POSTGRES_PASSWORD: $DB_PASS
POSTGRES_DB: $DB_NAME
POSTGRES_HOST_AUTH_METHOD: md5
logging:
driver: "json-file"
options:
max-size: "200k"
max-file: "10"
nats_server:
container_name: infra.nats
profiles: [ "infrastructure", "nats" ]
image: nats:2.10-alpine
restart: always
hostname: nats-server
volumes:
- ./nats/nats-server.conf:/etc/nats/nats-server.conf:ro
- infra.nats.data:/data
command: nats-server --config /etc/nats/nats-server.conf
ports:
- 127.0.0.1:4222:4222
- 127.0.0.1:6222:6222
- 127.0.0.1:8222:8222
env_file:
- ".env"
healthcheck:
test: "[ $$(wget -S -O /dev/null -q localhost:8222/varz 2>&1 | awk '/HTTP/{print $2}') = '200' ] || exit 1"
interval: 1s
retries: 15
timeout: 15s
networks:
- infrastructure
cadvisor:
container_name: infra.cadvisor
profiles: [ "monitoring", "cadvisor" ]
image: gcr.io/cadvisor/cadvisor
restart: always
hostname: cadvisor-server
volumes:
- /:/rootfs:ro
- /var/run:/var/run:rw
- /sys:/sys:ro
- /var/lib/docker/:/var/lib/docker:ro
ports:
- 8080:8080
networks:
- monitoring
prometheus:
container_name: infra.prometheus
profiles: [ "monitoring", "prometheus" ]
image: prom/prometheus
restart: always
hostname: prometheus-server
volumes:
- ./prometheus:/etc/prometheus/
- infra.prometheus.data:/prometheus
command:
- '--config.file=/etc/prometheus/prometheus.yml'
- '--storage.tsdb.path=/prometheus'
- '--web.console.libraries=/usr/share/prometheus/console_libraries'
- '--web.console.templates=/usr/share/prometheus/consoles'
- '--storage.tsdb.retention.size=15GB'
ports:
- 9090:9090
depends_on:
- cadvisor
networks:
- monitoring
node-exporter:
container_name: infra.node-exporter
profiles: [ "monitoring", "node-exporter" ]
image: prom/node-exporter
restart: always
hostname: node_exporter-server
volumes:
- /proc:/host/proc:ro
- /sys:/host/sys:ro
- /:/rootfs:ro
command:
- '--path.procfs=/host/proc'
- '--path.sysfs=/host/sys'
- '--collector.filesystem.ignored-mount-points'
- '^/(sys|proc|dev|host|etc|rootfs/var/lib/docker/containers|rootfs/var/lib/docker/overlay2|rootfs/run/docker/netns|rootfs/var/lib/docker/aufs)($$|/)'
ports:
- 9100:9100
networks:
- monitoring
loki:
container_name: infra.loki
profiles: [ "monitoring", "loki", "logging" ]
image: grafana/loki:2.8.2
restart: unless-stopped
hostname: loki-server
volumes:
- ./loki/config.yaml:/etc/loki/config.yaml:ro
- infra.loki.data:/tmp/:rw
command: -config.file=/etc/loki/config.yaml
ports:
- 3100:3100
networks:
- monitoring
vector:
container_name: infra.vector
profiles: [ "monitoring", "vector", "logging" ]
image: timberio/vector:0.29.1-alpine
restart: unless-stopped
hostname: vector-server
volumes:
- /var/run/docker.sock:/var/run/docker.sock:ro
- ./vector/vector.toml:/etc/vector/vector.toml:ro
ports:
- 8383:8383
networks:
- monitoring
logging:
driver: "json-file"
options:
max-size: "10m"
grafana:
container_name: infra.grafana
profiles: [ "monitoring", "grafana" ]
image: grafana/grafana
restart: always
hostname: grafana-server
volumes:
- ./grafana/grafana.ini:/etc/grafana/grafana.ini
- ./grafana/provisioning/:/etc/grafana/provisioning/
- infra.grafana.data:/var/lib/grafana
env_file:
- ./grafana/config.monitoring
environment:
GF_INSTALL_PLUGINS: 'grafana-clock-panel,grafana-simple-json-datasource'
ports:
- 3000:3000
networks:
- monitoring
depends_on:
- prometheus
volumes:
infra.postgres.data: {}
infra.redis.data: {}
infra.nats.data: {}
infra.prometheus.data: {}
infra.grafana.data: {}
infra.loki.data: {}
networks:
infrastructure:
external: true
monitoring:
external: true