Merge "Start the haproxy by using haproxy-system-wrapper"

This commit is contained in:
Jenkins 2016-04-06 19:23:38 +00:00 committed by Gerrit Code Review
commit d3f7eee9c1
4 changed files with 5 additions and 23 deletions

View File

@ -1,5 +1,5 @@
{
"command": "/usr/sbin/haproxy -f /etc/haproxy/haproxy.cfg -p /run/haproxy.pid",
"command": "/usr/sbin/haproxy-systemd-wrapper -f /etc/haproxy/haproxy.cfg -p /run/haproxy.pid",
"config_files": [
{
"source": "{{ container_config_directory }}/haproxy.cfg",

View File

@ -14,7 +14,6 @@ RUN apt-get install -y --no-install-recommends haproxy \
{% endif %}
COPY ensure_latest_config.sh /usr/local/bin/kolla_ensure_haproxy_latest_config
COPY extend_start.sh /usr/local/bin/kolla_extend_start
RUN chmod 755 /usr/local/bin/kolla_extend_start /usr/local/bin/kolla_ensure_haproxy_latest_config
RUN chmod 755 /usr/local/bin/kolla_ensure_haproxy_latest_config
{{ include_footer }}

View File

@ -1,12 +1,14 @@
#!/bin/bash
set -o errexit
CURRENT_CONFIG_HASH=$(sha1sum /etc/haproxy/haproxy.cfg | cut -f1 -d' ')
NEW_CONFIG_HASH=$(sha1sum /var/lib/kolla/config_files/haproxy.cfg | cut -f1 -d' ')
if [[ $CURRENT_CONFIG_HASH != $NEW_CONFIG_HASH ]]; then
changed=changed
python /usr/local/bin/kolla_set_configs
/usr/sbin/haproxy -f /etc/haproxy/haproxy.cfg -p /run/haproxy.pid -sf $(cat /run/haproxy.pid)
kill -USR2 $(pgrep -f /usr/sbin/haproxy-systemd-wrapper)
fi
echo $changed

View File

@ -1,19 +0,0 @@
#!/bin/bash
# We are intentionally not using exec so we can reload the haproxy config later
echo "Running command: '${CMD}'"
$CMD
retry=0
# The loop breaks only when haproxy.pid get missing even after 3 re-try.
while [[ $retry -lt 3 ]]; do
if [[ ! -e /run/haproxy.pid || ! -d /proc/$(cat /run/haproxy.pid) ]]; then
retry=$((retry+1))
sleep 2
continue
fi
retry=0
sleep 5
done
exit 1