* debian/pg_createconfig_patroni: Determine Patroni API port dynamically and

add @API_PORT@ substitution.
  * debian/config.yml.in: Replace API port by @API_PORT@.
This commit is contained in:
Michael Banck 2019-02-04 14:52:12 +01:00
parent 88f6008c75
commit 73515105b2
3 changed files with 10 additions and 2 deletions

3
debian/changelog vendored
View file

@ -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 <team+postgresql@tracker.debian.org> Mon, 04 Feb 2019 12:15:43 +0100

View file

@ -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:

View file

@ -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