Skip to content

Commit

Permalink
fix: healthcheck for docker containers (dragonflydb#2853)
Browse files Browse the repository at this point in the history
* fix: healthcheck for docker containers

Fixes dragonflydb#2841

---------

Signed-off-by: Roman Gershman <[email protected]>
  • Loading branch information
romange authored Apr 7, 2024
1 parent 76729d6 commit 934a8c6
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion tools/docker/healthcheck.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@ HOST="localhost"
PORT=$HEALTHCHECK_PORT

if [ -z "$HEALTHCHECK_PORT" ]; then
PORT=$(netstat -tuln | grep -oE ':[0-9]+' | grep -oE '[0-9]+' | tail -n 1)
# check all the TCP listening sockets, filter the dragonfly process, and fetch the port.
# For cases when dragonfly opens multiple ports, we filter with tail to choose one of them.
PORT=$(netstat -tlnp | grep "1/dragonfly" | grep -oE ':[0-9]+' | cut -c2- | tail -n 1)
fi

# If we're running with TLS enabled, utilise OpenSSL for the check
Expand Down

0 comments on commit 934a8c6

Please sign in to comment.