-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathentrypoint.sh
More file actions
executable file
·68 lines (64 loc) · 1.81 KB
/
entrypoint.sh
File metadata and controls
executable file
·68 lines (64 loc) · 1.81 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
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
#!/bin/bash
if [[ $UID -ge 10000 ]]; then
GID=$(id -g)
sed -e "s/^postgres:x:[^:]*:[^:]*:/postgres:x:$UID:$GID:/" /etc/passwd > /tmp/passwd
cat /tmp/passwd > /etc/passwd
rm /tmp/passwd
fi
cat > /data/patroni.yaml <<__EOF__
bootstrap:
dcs:
ttl: 30
loop_wait: 10
retry_timeout: 10
maximum_lag_on_failover: 1048576
failsafe_mode: true
postgresql:
use_pg_rewind: true
use_slots: true
initdb:
- auth-host: md5
- auth-local: trust
- encoding: UTF8
- locale: ${LANG}
- data-checksums
pg_hba:
- host all all 0.0.0.0/0 md5
- host replication ${DRYCC_DATABASE_REPLICATOR} ${PATRONI_KUBERNETES_POD_IP}/16 md5
post_bootstrap: /usr/share/scripts/patroni/post_init.sh
restapi:
connect_address: '${PATRONI_KUBERNETES_POD_IP}:8008'
postgresql:
data_dir: '${PGDATA}'
parameters:
timescaledb.license: 'timescale'
shared_preload_libraries: 'auto_explain,timescaledb,pg_stat_statements'
hot_standby: "on"
max_connections: 1005
max_worker_processes: 8
max_wal_senders: 10
max_replication_slots: 10
hot_standby_feedback: on
max_prepared_transactions: 0
max_locks_per_transaction: 64
wal_log_hints: "on"
track_commit_timestamp: "off"
archive_mode: "on"
archive_timeout: 300s
archive_command: "/bin/true"
log_min_duration_statement: 1000
log_lock_waits: on
log_statement: 'ddl'
connect_address: '${PATRONI_KUBERNETES_POD_IP}:5432'
authentication:
superuser:
username: '${DRYCC_DATABASE_SUPERUSER}'
password: '${DRYCC_DATABASE_SUPERUSER_PASSWORD}'
replication:
username: '${DRYCC_DATABASE_REPLICATOR}'
password: '${DRYCC_DATABASE_REPLICATOR_PASSWORD}'
watchdog:
mode: off
__EOF__
unset DRYCC_DATABASE_SUPERUSER_PASSWORD DRYCC_DATABASE_REPLICATION_PASSWORD
exec patroni /data/patroni.yaml