Skip to content

Commit 64a9aab

Browse files
committed
fix: ARM64 compatibility in wait-storage.sh - use curl instead of gremlin-console
1 parent afa63f0 commit 64a9aab

3 files changed

Lines changed: 32 additions & 11 deletions

File tree

docker/docker-compose.yml

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,6 @@ services:
4343
HG_PD_RAFT_PEERS_LIST: pd:8610
4444
HG_PD_INITIAL_STORE_LIST: store:8500
4545
HG_PD_DATA_PATH: /hugegraph-pd/pd_data
46-
# HG_PD_INITIAL_STORE_COUNT: "1"
4746
ports:
4847
- "8620:8620"
4948
- "8686:8686"
@@ -54,6 +53,7 @@ services:
5453
interval: 10s
5554
timeout: 5s
5655
retries: 12
56+
start_period: 20s
5757

5858
store:
5959
build:
@@ -68,7 +68,6 @@ services:
6868
pd:
6969
condition: service_healthy
7070
environment:
71-
environment:
7271
HG_STORE_PD_ADDRESS: pd:8686
7372
HG_STORE_GRPC_HOST: store
7473
HG_STORE_GRPC_PORT: "8500"
@@ -82,10 +81,11 @@ services:
8281
volumes:
8382
- hg-store-data:/hugegraph-store/storage
8483
healthcheck:
85-
test: ["CMD-SHELL", "curl -fsS http://localhost:8520/v1/health >/dev/null || exit 1"]
84+
test: ["CMD-SHELL", "curl -fsS http://localhost:8520/v1/health >/dev/null && curl -fsS http://pd:8620/v1/health >/dev/null || exit 1"]
8685
interval: 10s
87-
timeout: 5s
88-
retries: 12
86+
timeout: 10s
87+
retries: 30
88+
start_period: 30s
8989

9090
server:
9191
build:
@@ -109,4 +109,5 @@ services:
109109
test: ["CMD-SHELL", "curl -fsS http://localhost:8080/versions >/dev/null || exit 1"]
110110
interval: 10s
111111
timeout: 5s
112-
retries: 20
112+
retries: 30
113+
start_period: 60s

hugegraph-pd/hg-pd-dist/docker/docker-entrypoint.sh

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,8 +67,7 @@ SPRING_APPLICATION_JSON="$(cat <<JSON
6767
"raft": { "address": "$(json_escape "${HG_PD_RAFT_ADDRESS}")",
6868
"peers-list": "$(json_escape "${HG_PD_RAFT_PEERS_LIST}")" },
6969
"pd": { "data-path": "$(json_escape "${HG_PD_DATA_PATH}")",
70-
"initial-store-list": "$(json_escape "${HG_PD_INITIAL_STORE_LIST}")"
71-
"initial-store-count": "$(json_escape "${HG_PD_INITIAL_STORE_COUNT}")" }
70+
"initial-store-list": "$(json_escape "${HG_PD_INITIAL_STORE_LIST}")" }
7271
}
7372
JSON
7473
)"

hugegraph-server/hugegraph-dist/src/assembly/static/bin/wait-storage.sh

Lines changed: 24 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ function abs_path() {
2929
BIN=$(abs_path)
3030
TOP="$(cd "$BIN"/../ && pwd)"
3131
GRAPH_CONF="$TOP/conf/graphs/hugegraph.properties"
32-
WAIT_STORAGE_TIMEOUT_S=120
32+
WAIT_STORAGE_TIMEOUT_S=300
3333
DETECT_STORAGE="$TOP/scripts/detect-storage.groovy"
3434

3535
. "$BIN"/util.sh
@@ -70,7 +70,28 @@ done < <(env | sort -r | awk -F= '{ st = index($0, "="); print $1 " " substr($0,
7070
# wait for storage
7171
if env | grep '^hugegraph\.' > /dev/null; then
7272
if [ -n "${WAIT_STORAGE_TIMEOUT_S:-}" ]; then
73-
timeout "${WAIT_STORAGE_TIMEOUT_S}s" bash -c \
74-
"until bin/gremlin-console.sh -- -e $DETECT_STORAGE > /dev/null 2>&1; do echo \"Hugegraph server are waiting for storage backend...\"; sleep 5; done"
73+
# Extract pd.peers from config or environment
74+
PD_PEERS="${hugegraph_pd_peers:-}"
75+
if [ -z "$PD_PEERS" ]; then
76+
PD_PEERS=$(grep -E "^\s*pd\.peers\s*=" "$GRAPH_CONF" | sed 's/.*=\s*//' | tr -d ' ')
77+
fi
78+
79+
if [ -n "$PD_PEERS" ]; then
80+
# Convert gRPC address to REST address (8686 -> 8620)
81+
PD_REST=$(echo "$PD_PEERS" | sed 's/:8686/:8620/g' | cut -d',' -f1)
82+
echo "Waiting for PD REST endpoint at $PD_REST..."
83+
84+
timeout "${WAIT_STORAGE_TIMEOUT_S}s" bash -c "
85+
until curl -fsS http://${PD_REST}/v1/health >/dev/null 2>&1; do
86+
echo 'Hugegraph server are waiting for storage backend...'
87+
sleep 5
88+
done
89+
echo 'PD is reachable, waiting extra 10s for store registration...'
90+
sleep 10
91+
echo 'Storage backend is ready!'
92+
" || echo "Warning: Timeout waiting for storage, proceeding anyway..."
93+
else
94+
echo "No pd.peers configured, skipping storage wait..."
95+
fi
7596
fi
7697
fi

0 commit comments

Comments
 (0)