Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(container): make healthcheck tls compatible #643

Merged
merged 1 commit into from
Jan 5, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 $?