diff options
author | Kajur, Harish (vk250x) <vk250x@att.com> | 2019-04-11 12:13:59 -0400 |
---|---|---|
committer | Harish Venkata Kajur <vk250x@att.com> | 2019-04-11 12:23:20 -0400 |
commit | 161624c39c54d6cac539ed11a641e9d2b8c6248c (patch) | |
tree | de8c8837637a9151e01d7e90600299da91e07261 /Dockerfiles/haproxy/docker-entrypoint.sh | |
parent | b246959cee2989220eff5d3e92028c685a201b67 (diff) |
Add haproxy Dockerfile related files
Issue-ID: AAI-2235
Change-Id: If4d4439aa0e61e0f00ae4e2b6f1dcfdf50a79dff
Signed-off-by: Kajur, Harish (vk250x) <vk250x@att.com>
Diffstat (limited to 'Dockerfiles/haproxy/docker-entrypoint.sh')
-rw-r--r-- | Dockerfiles/haproxy/docker-entrypoint.sh | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/Dockerfiles/haproxy/docker-entrypoint.sh b/Dockerfiles/haproxy/docker-entrypoint.sh new file mode 100644 index 00000000..9095b3d1 --- /dev/null +++ b/Dockerfiles/haproxy/docker-entrypoint.sh @@ -0,0 +1,22 @@ +#!/bin/sh +set -e + +# first arg is `-f` or `--some-option` +if [ "${1#-}" != "$1" ]; then + set -- haproxy "$@" +fi + +NAMESERVER_IP=$(cat /etc/resolv.conf | grep 'nameserver' | head -1 | awk '{ print $2; }'); + +sed -i 's/${ONAP_NAMESERVER_CLUSTER_IP}/'${NAMESERVER_IP}'/g' /usr/local/etc/haproxy/resolvers.conf || { + echo "Unable to overwrite the nameserver in the haproxy configuration file"; + exit 1; +} + +if [ "$1" = 'haproxy' ]; then + # if the user wants "haproxy", let's use "haproxy-systemd-wrapper" instead so we can have proper reloadability implemented by upstream + shift # "haproxy" + set -- "$(which haproxy-systemd-wrapper)" -p /run/haproxy.pid "$@" +fi + +exec "$@" |