Skip to content

Commit 342a03b

Browse files
committed
Add alerts, fix acces to replica
1 parent 1260da0 commit 342a03b

File tree

2 files changed

+9
-5
lines changed

2 files changed

+9
-5
lines changed

docker-compose.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,6 @@ services:
1717
command: -c 'shared_preload_libraries=pg_stat_statements'
1818
environment:
1919
POSTGRES_PASSWORD: pgpass-replica
20-
PGUSER: postgres
21-
PGPASSWORD: pgpass
22-
PGHOST: postgres
2320
ports:
2421
- "5433:5432"
2522
volumes:
@@ -43,16 +40,18 @@ services:
4340
environment:
4441
DATA_SOURCE_NAME: postgresql://postgres:pgpass@postgres:5432/postgres?sslmode=disable
4542
PG_EXPORTER_EXTEND_QUERY_PATH: /mnt/queries.yaml
43+
PG_EXPORTER_AUTO_DISCOVER_DATABASES: "true"
4644
ports:
4745
- "9187:9187"
48-
#volumes:
49-
#- ./queries.yaml:/mnt/queries.yaml
46+
volumes:
47+
- ./queries.yaml:/mnt/queries.yaml
5048

5149
exporter-replica:
5250
image: prometheuscommunity/postgres-exporter:v0.10.1
5351
environment:
5452
DATA_SOURCE_NAME: postgresql://postgres:pgpass@replica:5432/postgres?sslmode=disable
5553
PG_EXPORTER_EXTEND_QUERY_PATH: /mnt/queries.yaml
54+
PG_EXPORTER_AUTO_DISCOVER_DATABASES: "true"
5655
ports:
5756
- "9188:9187"
5857
volumes:
@@ -75,6 +74,7 @@ services:
7574
cpu_count: 1
7675
volumes:
7776
- ./prometheus.yml:/etc/prometheus/prometheus.yml:ro
77+
- ./rules.yml:/etc/prometheus/rules.yml:ro
7878
- prometheus:/prometheus
7979
ports:
8080
- "9090:9090"

initdb-replica.d/init.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
#!/bin/bash
22

3+
export PGUSER=postgres
4+
export PGPASSWORD=pgpass
5+
export PGHOST=postgres
6+
37
while [ $(pg_isready -q; echo $?) != 0 ]; do
48
echo "Waiting for primary..."
59
sleep 1

0 commit comments

Comments
 (0)