From a0019cc2bc26d8272f7be8a0d0b947fba2e34dab Mon Sep 17 00:00:00 2001 From: Jim Van Fleet Date: Tue, 18 Oct 2016 16:26:06 -0400 Subject: [PATCH] Adding socat to the haproxy container --- haproxy/Dockerfile | 1 + haproxy/conf/haproxy.cfg | 1 + haproxy/container_files/bin/haproxycfg.sh | 2 ++ tests/haproxy.bats | 7 ++++++- 4 files changed, 10 insertions(+), 1 deletion(-) create mode 100755 haproxy/container_files/bin/haproxycfg.sh diff --git a/haproxy/Dockerfile b/haproxy/Dockerfile index e33097a..b983a39 100644 --- a/haproxy/Dockerfile +++ b/haproxy/Dockerfile @@ -12,4 +12,5 @@ LABEL ImageOS=centos7 LABEL Version=$version RUN apt-get update && apt-get install -y socat +COPY container_files/ /opt copy conf/haproxy.cfg /usr/local/etc/haproxy/haproxy.cfg diff --git a/haproxy/conf/haproxy.cfg b/haproxy/conf/haproxy.cfg index bcb15b5..8e9bb29 100644 --- a/haproxy/conf/haproxy.cfg +++ b/haproxy/conf/haproxy.cfg @@ -2,6 +2,7 @@ global log 127.0.0.1 local0 log 127.0.0.1 local1 notice + stats socket /usr/local/etc/haproxysock level admin defaults log global diff --git a/haproxy/container_files/bin/haproxycfg.sh b/haproxy/container_files/bin/haproxycfg.sh new file mode 100755 index 0000000..efb7ce6 --- /dev/null +++ b/haproxy/container_files/bin/haproxycfg.sh @@ -0,0 +1,2 @@ +#!/bin/bash +echo "$@" | socat unix-connect:/usr/local/etc/haproxysock stdio \ No newline at end of file diff --git a/tests/haproxy.bats b/tests/haproxy.bats index 5374922..44b8a6b 100644 --- a/tests/haproxy.bats +++ b/tests/haproxy.bats @@ -6,4 +6,9 @@ load ../common @test "socat process exists" { docker exec -i haproxy which socat -} \ No newline at end of file +} + +@test "socat helper process exists" { + docker exec -i haproxy /opt/bin/haproxycfg.sh show stat +} +