proxy: use new confd release with fixed file watcher

This commit is contained in:
iwilltry42 2021-06-21 20:14:31 +02:00
parent 339187b4da
commit 2a4c8910e8
No known key found for this signature in database
GPG Key ID: 7BA57AD1CFF16110
4 changed files with 19 additions and 7 deletions

View File

@ -1,6 +1,6 @@
FROM nginx:1.19-alpine FROM nginx:1.19-alpine
ARG CONFD_REPO=iwilltry42/confd ARG CONFD_REPO=iwilltry42/confd
ARG CONFD_VERSION=0.16.1 ARG CONFD_VERSION=0.17.0-rc.0
ARG OS=linux ARG OS=linux
ARG ARCH=amd64 ARG ARCH=amd64
RUN echo "Building for '${OS}/${ARCH}'..." \ RUN echo "Building for '${OS}/${ARCH}'..." \

View File

@ -1,5 +1,5 @@
.PHONY: test .PHONY: test
test: test:
docker build . -t rancher/k3d-proxy:dev docker build . -t rancher/k3d-proxy:dev --no-cache
docker run --rm -v $(shell pwd)/test/portmap.yaml:/etc/confd/values.yaml rancher/k3d-proxy:dev docker run --rm -v $(shell pwd)/test/portmap.yaml:/etc/confd/values.yaml rancher/k3d-proxy:dev

View File

@ -4,4 +4,6 @@ dest = "/etc/nginx/nginx.conf"
keys = [ keys = [
"ports", "ports",
"settings" "settings"
] ]
check_cmd = "/usr/sbin/nginx -T -c {{.src}}"
reload_cmd = "/usr/sbin/nginx -s reload"

View File

@ -1,14 +1,24 @@
#!/bin/sh #!/bin/sh
# Run confd
set -e set -e
confd -onetime -backend file -file /etc/confd/values.yaml -log-level debug
set +e # Config Options
INIT_CONFIG_MAX_RETRIES=3
# Run confd
for i in $(seq 1 $INIT_CONFIG_MAX_RETRIES); do
echo "[$(date -Iseconds)] creating initial nginx config (try $i/$INIT_CONFIG_MAX_RETRIES)"
confd -onetime -backend file -file /etc/confd/values.yaml -log-level debug -sync-only
sleep 2
done
# Output Configuration # Output Configuration
echo "===== Initial nginx configuration =====" echo "===== Initial nginx configuration ====="
cat /etc/nginx/nginx.conf nginx -T -c /etc/nginx/nginx.conf
echo "=======================================" echo "======================================="
# Start confd in watch mode (every second)
confd -watch -backend file -file /etc/confd/values.yaml -log-level debug &
# Start nginx # Start nginx
nginx -g 'daemon off;' nginx -g 'daemon off;'