From bae5fe57c9407f055f93dde3981fe7e49f9ce8f4 Mon Sep 17 00:00:00 2001 From: acaranta Date: Thu, 22 Apr 2021 11:41:08 +0200 Subject: [PATCH] Switched certs sync to use rsync to match file removals --- Dockerfile | 4 ++-- inotifreload.sh | 6 ++++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/Dockerfile b/Dockerfile index 62dedaa..95366e7 100644 --- a/Dockerfile +++ b/Dockerfile @@ -5,8 +5,8 @@ ENV DEBIAN_FRONTEND noninteractive ENV INITRD No RUN apt-get update -y -RUN apt-get install --force-yes -y haproxy inotify-tools python-pip curl lua-socket lua-json lua-http && \ - pip install envtpl supervisor supervisor-logging +RUN apt-get install --force-yes -y haproxy inotify-tools python-pip curl lua-socket lua-json lua-http rsync +RUN pip install envtpl supervisor supervisor-logging #Fetch and build haproxy from github, compile it with prometheus exporter RUN cd /tmp && \ diff --git a/inotifreload.sh b/inotifreload.sh index 59cdd38..155d947 100755 --- a/inotifreload.sh +++ b/inotifreload.sh @@ -31,13 +31,15 @@ while true; do if [ -d /hacfg/certs ]; then if [ ! -d /etc/haproxy/certs ]; then mkdir /etc/haproxy/certs - cp -rf /hacfg/certs/* /etc/haproxy/certs/ + rsync -ad /hacfg/certs /tmp --delete + #cp -rf /hacfg/certs/* /etc/haproxy/certs/ fi diff /hacfg/certs /etc/haproxy/certs 2>&1 >/dev/null if [ $? -gt 0 ]; then echo "$(date) - Found changes in /hacfg/certs file..." #if it changed, then copy it and reload properly haproxy - cp -rf /hacfg/certs/* /etc/haproxy/certs/ + rsync -ad /hacfg/certs /tmp --delete + #cp -rf /hacfg/certs/* /etc/haproxy/certs/ RELOAD=1 fi