diff --git a/dockerfiles/load-balancer/confd/Dockerfile b/dockerfiles/load-balancer/confd/Dockerfile index eaeb579a9242c45bf66953e70ea5bca7603742fc..ee149faaa3bfd277b84e10a998af86fd87afdcd2 100644 --- a/dockerfiles/load-balancer/confd/Dockerfile +++ b/dockerfiles/load-balancer/confd/Dockerfile @@ -16,7 +16,7 @@ RUN \ chmod +x confd RUN \ - wget https://get.docker.com/builds/Linux/x86_64/docker-1.2.0 -O docker && \ + wget https://get.docker.com/builds/Linux/x86_64/docker-1.5.0 -O docker && \ chmod +x docker ENTRYPOINT ["/confd"] diff --git a/dockerfiles/load-balancer/confd/confd/conf.d/crt-list.toml b/dockerfiles/load-balancer/confd/confd/conf.d/crt-list.toml index ef435f2eebbd475736686c03fd1dfc4087cb78e2..26a7ad8efdb3fa7bbc39329b15414940947c339d 100644 --- a/dockerfiles/load-balancer/confd/confd/conf.d/crt-list.toml +++ b/dockerfiles/load-balancer/confd/confd/conf.d/crt-list.toml @@ -4,4 +4,5 @@ dest = "/etc/haproxy/crt-list" keys = [ "/services" ] -reload_cmd = "/docker kill --signal=\"SIGUSR1\" haproxy" +reload_cmd = "/docker exec haproxy service haproxy reload" + diff --git a/dockerfiles/load-balancer/confd/confd/conf.d/haproxy.toml b/dockerfiles/load-balancer/confd/confd/conf.d/haproxy.toml index d3554213d797707dc76f507ce18dc280808e75a1..d5c784e6261234bd4954ad03b4edc24e7e4019ef 100644 --- a/dockerfiles/load-balancer/confd/confd/conf.d/haproxy.toml +++ b/dockerfiles/load-balancer/confd/confd/conf.d/haproxy.toml @@ -4,4 +4,5 @@ dest = "/etc/haproxy/haproxy.cfg" keys = [ "/services" ] -reload_cmd = "/docker kill --signal=\"SIGUSR1\" haproxy" +reload_cmd = "/docker exec haproxy service haproxy reload" + diff --git a/dockerfiles/load-balancer/haproxy/Dockerfile b/dockerfiles/load-balancer/haproxy/Dockerfile index 392ee888a6e6e1695d2260fcf4aef9bc0be09c9d..824ad007fa6913b46cc892a88462534de5df22ef 100644 --- a/dockerfiles/load-balancer/haproxy/Dockerfile +++ b/dockerfiles/load-balancer/haproxy/Dockerfile @@ -5,11 +5,14 @@ ENV DEBIAN_FRONTEND noninteractive # Install Haproxy. RUN \ apt-get update && \ - apt-get install -y haproxy && \ + apt-get install -y \ + haproxy \ + rsyslog && \ rm -rf /var/lib/apt/lists/* -ENTRYPOINT ["haproxy"] -CMD ["-f", "/etc/haproxy/haproxy.cfg"] +ADD run.sh /run.sh + +CMD ["/run.sh"] EXPOSE 80 EXPOSE 443 diff --git a/dockerfiles/load-balancer/haproxy/run.sh b/dockerfiles/load-balancer/haproxy/run.sh new file mode 100644 index 0000000000000000000000000000000000000000..e824876e2c7cbee36a496da04677df1fbfb39b43 --- /dev/null +++ b/dockerfiles/load-balancer/haproxy/run.sh @@ -0,0 +1,20 @@ +#!/bin/bash -e + +function cleanup { + /etc/init.d/haproxy stop + /etc/init.d/rsyslog stop + exit 0 +} + +# start haproxy in bg and tail logs out to stdout +/usr/sbin/service rsyslog start +/etc/init.d/haproxy start +tail -f /var/log/syslog & +tail -f /var/log/haproxy.log & + +trap cleanup SIGTERM SIGINT + +while true; do # Iterate to keep job running. + sleep 1 # Don't sleep too long as signals will not be handled during sleep. +done + diff --git a/unit-files/haproxy.service b/unit-files/haproxy.service index bb156a445ad5d4b4f6b2ed4d7d48d9ce61471ed2..3f6c27f2e248fbec81defc53f2f9d55fa6f8c744 100644 --- a/unit-files/haproxy.service +++ b/unit-files/haproxy.service @@ -17,7 +17,6 @@ ExecStartPre=-/usr/bin/docker rm %p ExecStart=/usr/bin/docker run \ --rm \ --name %p \ - -v /data/runtime/dev/log:/dev/log \ -v /data/runtime/haproxy:/etc/haproxy \ -p 80:80 \ -p 443:443 \