diff --git a/debian/changelog b/debian/changelog index c78f088..7ebc0d4 100644 --- a/debian/changelog +++ b/debian/changelog @@ -3,6 +3,9 @@ patroni (1.5.4-6) UNRELEASED; urgency=medium [ Michael Banck ] * debian/tests/acceptance: Fix DCS check for zookeeper in case etcd-server is installed as well. + * debian/pg_createconfig_patroni: Determine Patroni API port dynamically and + add @API_PORT@ substitution. + * debian/config.yml.in: Replace API port by @API_PORT@. -- Debian PostgreSQL Maintainers Mon, 04 Feb 2019 12:15:43 +0100 diff --git a/debian/config.yml.in b/debian/config.yml.in index 98e2f25..1153a83 100644 --- a/debian/config.yml.in +++ b/debian/config.yml.in @@ -5,8 +5,8 @@ name: @HOSTNAME@ @DCS_CONFIG@ restapi: - listen: @HOSTIP@:8008 - connect_address: @HOSTIP@:8008 + listen: @HOSTIP@:@API_PORT@ + connect_address: @HOSTIP@:@API_PORT@ # certfile: /etc/ssl/certs/ssl-cert-snakeoil.pem # keyfile: /etc/ssl/private/ssl-cert-snakeoil.key # authentication: diff --git a/debian/pg_createconfig_patroni b/debian/pg_createconfig_patroni index f67f7d3..39b10dd 100755 --- a/debian/pg_createconfig_patroni +++ b/debian/pg_createconfig_patroni @@ -46,6 +46,10 @@ else pg_lsclusters | awk '{print $3}' | grep -q $PORT && echo "Port $PORT already in use" && exit 1 fi +# determine API port (default is 8008) by incrementing for each additional +# Postgres port. 2576 is 8008 - 5432. +API_PORT=$((2576+$PORT)) + # support both '-' and '/' as separator if [ $(echo $SCOPE | grep -- -) ] then @@ -96,6 +100,7 @@ cat /etc/patroni/config.yml.in | \ -e "s/@HOSTNAME@/${HOSTNAME}/g" \ -e "s/@HOSTIP@/${HOSTIP}/g" \ -e "s#@NETWORK@#${NETWORK}#g" \ + -e "s/@API_PORT@/${API_PORT}/g" \ -e "s/@PORT@/${PORT}/g" \ -e "s/@DCS_CONFIG@/${DCS_CONFIG}/g" \ >> $CONFIG_FILE