Skip to content

Commit 4a9aa4d

Browse files
authored
[*] improve pg container (#1311)
* Grant execute privilege on `pg_read_file() * Mount `postgres` container data directory
1 parent 8500d1f commit 4a9aa4d

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

docker/bootstrap/create_role_db.sql

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,10 @@ CREATE DATABASE pgwatch OWNER pgwatch;
66

77
CREATE DATABASE pgwatch_metrics OWNER pgwatch;
88

9+
\c pgwatch_metrics
10+
-- for remote log parsing to work in case of server_log_event_counts metric is used
11+
GRANT EXECUTE ON FUNCTION pg_read_file(text, bigint, bigint) TO pgwatch;
12+
13+
\c pgwatch
914
-- for remote log parsing to work in case of server_log_event_counts metric is used
1015
GRANT EXECUTE ON FUNCTION pg_read_file(text, bigint, bigint) TO pgwatch;

docker/compose.postgres.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ services:
2323
environment:
2424
POSTGRES_HOST_AUTH_METHOD: trust
2525
volumes:
26+
- "pgdata:/var/lib/postgresql"
2627
- "./bootstrap/init_replication.sh:/docker-entrypoint-initdb.d/init_replication.sh"
2728
- "./bootstrap/create_role_db.sql:/docker-entrypoint-initdb.d/create_role_db.sql"
2829
healthcheck:
@@ -75,4 +76,7 @@ services:
7576
exec postgres -D /var/lib/postgresql/standby -c shared_preload_libraries=pg_stat_statements -c pg_stat_statements.track=all -c track_io_timing=on -c track_functions=pl -c log_destination=csvlog -c logging_collector=on
7677
"
7778
links:
78-
- postgres
79+
- postgres
80+
81+
volumes:
82+
pgdata:

0 commit comments

Comments
 (0)