mirror of
https://github.com/dragonflydb/dragonfly.git
synced 2025-05-11 18:35:46 +02:00
Dragonfly responds to ascii based requests to tls port with: `-ERR Bad TLS header, double check if you enabled TLS for your client.` Therefore, it is possible to test now both tls and non-tls ports with a plain-text PING. Fixes #4171 Also, blacklist the bloom-filter test that Dragonfly does not support yet. Signed-off-by: Roman Gershman <roman@dragonflydb.io>
27 lines
899 B
Bash
Executable file
27 lines
899 B
Bash
Executable file
#!/bin/sh
|
|
|
|
HOST="localhost"
|
|
PORT=$HEALTHCHECK_PORT
|
|
|
|
|
|
if [ -z "$HEALTHCHECK_PORT" ]; then
|
|
# try unpriveleged version first. This should cover cases when the container is running
|
|
# without root, for example:
|
|
# docker run --group-add 999 --cap-drop=ALL --user 999 docker.dragonflydb.io/dragonflydb/dragonfly
|
|
DF_NET=$(netstat -tlnp | grep "1/dragonfly")
|
|
if [ -z "$DF_NET" ]; then
|
|
# if we failed, then lets try the priveleged version. is triggerred by the regular command:
|
|
# docker run docker.dragonflydb.io/dragonflydb/dragonfly
|
|
DF_NET=$(su dfly -c "netstat -tlnp" | grep "1/dragonfly")
|
|
fi
|
|
|
|
# check all the TCP ports, and fetch the port.
|
|
# For cases when dragonfly opens multiple ports, we filter with tail to choose one of them.
|
|
PORT=$(echo $DF_NET | grep -oE ':[0-9]+' | cut -c2- | tail -n 1)
|
|
fi
|
|
|
|
_healthcheck="nc -q1 $HOST $PORT"
|
|
|
|
echo PING | ${_healthcheck}
|
|
|
|
exit $?
|