-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathconf.sh
More file actions
executable file
·29 lines (22 loc) · 1.21 KB
/
conf.sh
File metadata and controls
executable file
·29 lines (22 loc) · 1.21 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
#!/bin/bash
set -Eeuo pipefail
# The inner sed finds the line number of the last match for the the regex ^\s*shared_preload_libraries\s*=
# The outer sed, operating on that line alone, extracts the text between single quotes after the equals sign
PREVIOUS_PRELOAD_LIBRARIES=$(sed -nE "$(sed -n '/^\s*shared_preload_libraries\s*=/ =' ${PGDATA}/postgresql.conf | tail -n 1) s/^\s*shared_preload_libraries\s*=\s*'(.*?)'/\1/p" ${PGDATA}/postgresql.conf)
NEW_PRELOAD_LIBRARIES="pg_cron,pg_net"
cat >> ${PGDATA}/postgresql.conf << EOT
listen_addresses = '*'
shared_preload_libraries = '$(echo "$PREVIOUS_PRELOAD_LIBRARIES,$NEW_PRELOAD_LIBRARIES" | sed 's/^,//')'
# pg_cron
cron.database_name = '${PG_CRON_DB:-${POSTGRES_DB:-${POSTGRES_USER:-postgres}}}'
# MobilityDB recomendation
max_locks_per_transaction = 128
timescaledb.telemetry_level = off
# pglogical
wal_level = 'logical'
max_worker_processes = 10 # one per database needed on provider node
# one per node needed on subscriber node
max_replication_slots = 10 # one per node needed on provider node
max_wal_senders = 10 # one per node needed on provider node
track_commit_timestamp = on # needed for last/first update wins conflict resolution
EOT