Skip to content

Commit

Permalink
refactor(interactive): Use netcat to check service readiness (#4342)
Browse files Browse the repository at this point in the history
Previously we used a Gremlin query to check whether the Gremlin service
is ready, which may reveal unexpected problems. It is better to use
netcat to find out whether the endpoint is ready for serving.
  • Loading branch information
zhanglei1949 authored Dec 4, 2024
1 parent 1199f20 commit 05254bd
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
7 changes: 6 additions & 1 deletion charts/graphscope-store/templates/configmap.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,12 @@ data:
export GRPC_PORT=${GROOT_GRPC_PORT}
export GREMLIN_PORT=${GROOT_GREMLIN_PORT}
echo "${HOST} ${GRPC_PORT} ${GREMLIN_PORT}"
python3 -c 'import base64;import os;from gremlin_python.driver.client import Client;ip=os.getenv("HOST");gremlin_port=os.getenv("GREMLIN_PORT");graph_url=f"ws://{ip}:{gremlin_port}/gremlin";username=os.getenv("GROOT_USERNAME");password=base64.b64decode(os.getenv("GROOT_PASSWORD")).decode("utf-8");client = Client(graph_url, "g", username=username, password=password); ret = client.submit("g.V().limit(1)").all().result(); client.close();' && break
cmd="nc -zv ${HOST} ${GREMLIN_PORT}"
res=$(eval $cmd 2>&1)
if [[ $res == *succeeded* ]]; then
# Expected Output is <Connection to localhost (::1) 8182 port [tcp/*] succeeded!>
break
fi
sleep 3
done
Expand Down
2 changes: 1 addition & 1 deletion k8s/dockerfiles/coordinator.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ FROM ubuntu:22.04 AS coordinator
ENV DEBIAN_FRONTEND=noninteractive

RUN apt-get update -y && \
apt-get install -y sudo python3-pip openmpi-bin curl tzdata && \
apt-get install -y sudo python3-pip openmpi-bin curl tzdata netcat && \
apt-get clean -y && \
rm -rf /var/lib/apt/lists/*

Expand Down
1 change: 1 addition & 0 deletions k8s/dockerfiles/graphscope-dev-wheel.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ RUN yum install -y sudo vim && \
yum remove java-1.8.0-openjdk-devel java-1.8.0-openjdk java-1.8.0-openjdk-headless -y && \
yum install java-11-openjdk-devel -y && \
yum clean all -y --enablerepo='*' && \
yum install -y netcat && \
rm -rf /var/cache/yum

RUN mkdir -p /opt/graphscope /opt/vineyard && chown -R graphscope:graphscope /opt/graphscope /opt/vineyard
Expand Down

0 comments on commit 05254bd

Please sign in to comment.