diff options
| author | Steven Dake <stdake@cisco.com> | 2015-08-27 18:04:30 -0700 |
|---|---|---|
| committer | Steven Dake <stdake@cisco.com> | 2015-08-28 00:50:29 -0700 |
| commit | 739c2c6e3aa0518308cb39be989879f3eaa4b227 (patch) | |
| tree | e4079691cff22354ec90a236f22c3e77904d1e31 /docker_templates/haproxy | |
| parent | 59138665acc96c6155d3046f10db32c38557e8b7 (diff) | |
| download | kolla-739c2c6e3aa0518308cb39be989879f3eaa4b227.tar.gz kolla-739c2c6e3aa0518308cb39be989879f3eaa4b227.zip | |
Move scripts for haproxy to docker_templates
Change-Id: I942ba0e0ced0532fb0b575843fa170a031a8eb59
Partially-Implements: blueprint remove-docker-dir
Diffstat (limited to 'docker_templates/haproxy')
| -rw-r--r--[l---------] | docker_templates/haproxy/config-external.sh | 11 | ||||
| -rwxr-xr-x[l---------] | docker_templates/haproxy/ensure_latest_config.sh | 13 | ||||
| -rwxr-xr-x[l---------] | docker_templates/haproxy/start.sh | 21 |
3 files changed, 42 insertions, 3 deletions
diff --git a/docker_templates/haproxy/config-external.sh b/docker_templates/haproxy/config-external.sh index d0351492c..0c41a5bdb 120000..100644 --- a/docker_templates/haproxy/config-external.sh +++ b/docker_templates/haproxy/config-external.sh @@ -1 +1,10 @@ -../../docker/common/haproxy/config-external.sh
\ No newline at end of file +#!/bin/bash +SOURCE="/opt/kolla/haproxy/haproxy.cfg" +TARGET="/etc/haproxy/haproxy.cfg" +OWNER="root" + +if [[ -f "$SOURCE" ]]; then + cp -f $SOURCE $TARGET + chown ${OWNER}: $TARGET + chmod 0644 $TARGET +fi diff --git a/docker_templates/haproxy/ensure_latest_config.sh b/docker_templates/haproxy/ensure_latest_config.sh index a78adec66..b91189ca5 120000..100755 --- a/docker_templates/haproxy/ensure_latest_config.sh +++ b/docker_templates/haproxy/ensure_latest_config.sh @@ -1 +1,12 @@ -../../docker/common/haproxy/ensure_latest_config.sh
\ No newline at end of file +#!/bin/bash + +CURRENT_CONFIG_HASH=$(sha1sum /etc/haproxy/haproxy.cfg | cut -f1 -d' ') +NEW_CONFIG_HASH=$(sha1sum /opt/kolla/haproxy/haproxy.cfg | cut -f1 -d' ') + +if [[ $CURRENT_CONFIG_HASH != $NEW_CONFIG_HASH ]]; then + changed=changed + source /opt/kolla/config-external.sh + /usr/sbin/haproxy -f /etc/haproxy/haproxy.cfg -p /run/haproxy.pid -sf $(cat /run/haproxy.pid) +fi + +echo $changed diff --git a/docker_templates/haproxy/start.sh b/docker_templates/haproxy/start.sh index 269fd2786..d1da4a607 120000..100755 --- a/docker_templates/haproxy/start.sh +++ b/docker_templates/haproxy/start.sh @@ -1 +1,20 @@ -../../docker/common/haproxy/start.sh
\ No newline at end of file +#!/bin/bash +set -o errexit + +CMD='/usr/sbin/haproxy' +ARGS="-f /etc/haproxy/haproxy.cfg -p /run/haproxy.pid" + +# Loading common functions. +source /opt/kolla/kolla-common.sh + +# Execute config strategy +set_configs + +# 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 |
