confd global configuration (otherwise specified as commandline options)
backend = "redis"
nodes = ["localhost:6379"]
client_key = "<<THE-XXXX-PASSWORD>>"
interval = 10
| docker run --rm -ti --name rediscli \ | |
| --net container:nginx \ | |
| redis:alpine \ | |
| redis-cli -h localhost -p 6379 -a THE-XXXX-PASSWORD set /myapp/suggestions/drink covfefe |
| docker run -d --name socat-for-nginx \ | |
| --restart=always \ | |
| --net container:nginx \ | |
| xynova/socat \ | |
| -v TCP-LISTEN:6379,fork,reuseaddr openssl-connect:XXXX-XXXX-XXXX.redis.cache.windows.net:6380 |
| docker run -ti --rm --name nginx \ | |
| -v $(pwd)/confd-config:/etc/confd \ | |
| -p 8080:80 \ | |
| xynova/nginx-confd |
| #!/bin/sh | |
| set -ebm | |
| syncronize_bakends() { | |
| echo "[nginx-confd] Synchronizing with confd backends" | |
| # Loop until confd has updated the nginx config | |
| until confd --onetime --config-file /etc/confd/confd.toml --log-level error -sync-only; do | |
| echo "[nginx-confd] waiting for confd to refresh nginx configuration" | |
| sleep 5 | |
| done |
| # BUILD CONFD STAGE | |
| # | |
| FROM golang:1.8.3-alpine3.6 AS confd-build-stage | |
| WORKDIR /go/src/github.com/kelseyhightower | |
| RUN apk --update add git bash | |
| RUN git clone --depth 1 https://github.com/kelseyhightower/confd.git \ | |
| && cd confd \ | |
| && ./build \ | |
| && chmod +x bin/confd |
| FROM golang:1.8.3-alpine3.6 AS confd-build | |
| WORKDIR /go/src/github.com/kelseyhightower | |
| RUN apk --update add git bash | |
| RUN git clone --depth 1 https://github.com/kelseyhightower/confd.git \ | |
| && cd confd \ | |
| && ./build | |
| FROM alpine:3.6 | |
| COPY --from=confd-build /go/src/github.com/kelseyhightower/confd/bin/confd /bin/ | |
| RUN chmod +x /bin/confd |
| docker run --rm -ti --name rediscli \ | |
| --net host \ | |
| redis:alpine \ | |
| redis-cli -h localhost -p 6379 -a THE-XXXX-PASSWORD ping |
| docker run -d --name socat \ | |
| --restart=always \ | |
| -p 6379:6379 \ | |
| socat-local \ | |
| -v TCP-LISTEN:6379,fork,reuseaddr openssl-connect:XXXX-XXXX-XXXX.redis.cache.windows.net:6380 |
| FROM alpine:3.6 | |
| RUN apk --update add socat ca-certificates && \ | |
| rm -rf /var/cache/apk/* && \ | |
| rm -rf /root/.cache | |
| ENTRYPOINT ["socat"] |