1
0
Fork 0
mirror of https://github.com/dragonflydb/dragonfly.git synced 2024-12-14 11:58:02 +00:00

feat(container): make healthcheck tls compatible (#643)

Signed-off-by: Philipp Born <git@pborn.eu>
This commit is contained in:
Philipp B 2023-01-05 12:28:29 +01:00 committed by GitHub
parent 66cff983cb
commit b3228fe3a0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 12 additions and 3 deletions

View file

@ -25,7 +25,8 @@ RUN build-opt/dragonfly --version
FROM alpine:3.17.0
RUN apk --no-cache add libgcc libstdc++ libunwind boost1.80-fiber zstd-dev su-exec netcat-openbsd
RUN apk --no-cache add libgcc libstdc++ libunwind boost1.80-fiber \
zstd-dev su-exec netcat-openbsd openssl
RUN addgroup -S -g 1000 dfly && adduser -S -G dfly -u 999 dfly
RUN mkdir /data && chown dfly:dfly /data

View file

@ -15,7 +15,7 @@ FROM alpine:latest
RUN addgroup -S -g 1000 dfly && adduser -S -G dfly -u 999 dfly
RUN apk --no-cache add libgcc libstdc++ libunwind boost1.77-fiber \
'su-exec>=0.2' netcat-openbsd
'su-exec>=0.2' netcat-openbsd openssl
RUN mkdir /data && chown dfly:dfly /data
VOLUME /data

View file

@ -3,6 +3,14 @@
HOST="localhost"
PORT=6379
echo "ping" | nc -q1 $HOST $PORT
# If we're running with TLS enabled, utilise OpenSSL for the check
if [ -f "/etc/dragonfly/tls/ca.crt" ]
then
_healthcheck="openssl s_client -connect ${HOST}:${PORT} -CAfile /etc/dragonfly/tls/ca.crt -quiet -no_ign_eof"
else
_healthcheck="nc -q1 $HOST $PORT"
fi
echo PING | ${_healthcheck}
exit $?