Skip to content

Commit

Permalink
feat(container): make healthcheck tls compatible (#643)
Browse files Browse the repository at this point in the history
Signed-off-by: Philipp Born <[email protected]>
  • Loading branch information
tamcore authored Jan 5, 2023
1 parent 66cff98 commit b3228fe
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 3 deletions.
3 changes: 2 additions & 1 deletion tools/docker/Dockerfile.alpine-dev
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion tools/docker/Dockerfile.alpine-prod.wip
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
10 changes: 9 additions & 1 deletion tools/docker/healthcheck.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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 $?

0 comments on commit b3228fe

Please sign in to comment.