* debian/pg_createconfig_patroni: Add support for --network switch and set

$NETWORK variable to local network if not set.
  * debian/config.yml.in: Allow replication and client connections from
    @NETWORK@ network.
This commit is contained in:
Michael Banck 2019-01-21 17:08:28 +01:00
parent 928d713614
commit 27d8f4f163
3 changed files with 18 additions and 1 deletions

4
debian/changelog vendored
View file

@ -9,6 +9,10 @@ patroni (1.5.4-2) UNRELEASED; urgency=medium
* debian/config.yml.in: Commented out pgpass directive.
* debian/pg_createcluster_patroni: Put clusters in manual mode, rather than
disabled mode during creation.
* debian/pg_createconfig_patroni: Add support for --network switch and set
$NETWORK variable to local network if not set.
* debian/config.yml.in: Allow replication and client connections from
@NETWORK@ network.
-- Debian PostgreSQL Maintainers <team+postgresql@tracker.debian.org> Tue, 15 Jan 2019 19:12:36 +0100

View file

@ -56,9 +56,13 @@ bootstrap:
# Add following lines to pg_hba.conf after running 'initdb'. The replication
# user (replicator by default) should match the
# "postgresql/authenticaion/replication/username" item below.
# By default replication and md5 connection are allowed from the local
# network.
pg_hba:
- host replication replicator 127.0.0.1/32 md5
- host all all 0.0.0.0/0 md5
- host replication replicator @NETWORK@ md5
- host all all @NETWORK@ md5
# - host all all 0.0.0.0/0 md5
# - hostssl all all 0.0.0.0/0 md5
postgresql:

View file

@ -11,6 +11,10 @@ case $i in
HOSTIP="${i#*=}"
shift # past argument=value
;;
--network=*)
NETWORK="${i#*=}"
shift # past argument=value
;;
--port=*)
PORT="${i#*=}"
shift # past argument=value
@ -81,12 +85,17 @@ if [ -z "$HOSTIP" ]; then
HOSTIP=$(ip -4 route get 8.8.8.8 | grep ^8.8.8.8 | sed -e s/.*src.// -e s/\ //g)
fi
if [ -z "$NETWORK" ]; then
NETWORK=$(ip -4 route get 8.8.8.8 | grep ^8.8.8.8 | sed -e s/.*src.// -e s/\ //g -e s/\.[0-9]*$/.0/)/24
fi
# add remaining patroni configuration from template
cat /etc/patroni/config.yml.in | \
sed -e "s/@VERSION@/${VERSION}/g" \
-e "s/@CLUSTER@/${CLUSTER}/g" \
-e "s/@HOSTNAME@/${HOSTNAME}/g" \
-e "s/@HOSTIP@/${HOSTIP}/g" \
-e "s#@NETWORK@#${NETWORK}#g" \
-e "s/@PORT@/${PORT}/g" \
-e "s/@DCS_CONFIG@/${DCS_CONFIG}/g" \
>> $CONFIG_FILE