From 2d920745a45eec166e2c381aa7b15b1168b03887 Mon Sep 17 00:00:00 2001 From: "Michal Jastrzebski (inc0)" Date: Fri, 17 Jul 2015 12:20:31 +0200 Subject: Ansible install of HAProxy This commit consists HAProxy ansible bits including config generation, container deployment and hot reloads. Closes-Bug: #1477915 Co-Authored-By: Sam Yaple Change-Id: Ie93fa68fdb6b2885889c992ff1267d38b68e0cbc Partially-implements: blueprint ansible-service --- docker/common/haproxy/start.sh | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) (limited to 'docker/common/haproxy/start.sh') diff --git a/docker/common/haproxy/start.sh b/docker/common/haproxy/start.sh index 68600f44e..c39184767 100755 --- a/docker/common/haproxy/start.sh +++ b/docker/common/haproxy/start.sh @@ -2,11 +2,7 @@ set -o errexit CMD='/usr/sbin/haproxy' -# Parameters: -# -db for non-daemon execution and logging to stdout -# -p pidfile to specify pidfile and allow hot reconfiguration -# loop which generates -f file.conf for each file in /etc/haproxy and /etc/haproxy/conf.d -ARGS="-db -f /etc/haproxy/haproxy.cfg" +ARGS="-f /etc/haproxy/haproxy.cfg -p /run/haproxy.pid" # Loading common functions. source /opt/kolla/kolla-common.sh @@ -14,4 +10,11 @@ source /opt/kolla/kolla-common.sh # Config-internal script exec out of this function, it does not return here. set_configs -exec $CMD $ARGS +# We are intentionally not using exec so we can reload the haproxy config later +$CMD $ARGS + +# TODO(SamYaple): This has the potential for a race condition triggered by a +# config reload that could cause the container to exit +while [[ -e "/proc/$(cat /run/haproxy.pid)" ]]; do + sleep 5 +done -- cgit v1.2.3