Skip to content

Commit 7c658d0

Browse files
committed
Add healthcheck for zebra and update service dependencies in compose
1 parent bf01996 commit 7c658d0

File tree

2 files changed

+10
-16
lines changed

2 files changed

+10
-16
lines changed

docker/mining/docker-compose.yml

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,12 @@ services:
2020
- mining
2121
restart: unless-stopped
2222
tty: true
23+
healthcheck:
24+
test: ["CMD-SHELL", "curl -sf http://127.0.0.1:8080/healthy || exit 1"]
25+
interval: 30s
26+
timeout: 10s
27+
retries: 3
28+
start_period: 90s
2329

2430
redis:
2531
image: redis:7-alpine
@@ -44,8 +50,10 @@ services:
4450
- "${STRATUM_PORT:-3333}:${STRATUM_PORT:-3333}"
4551
- "8080:8080"
4652
depends_on:
47-
- zebra
48-
- redis
53+
zebra:
54+
condition: service_healthy
55+
redis:
56+
condition: service_started
4957
networks:
5058
- mining
5159
restart: unless-stopped

docker/mining/s-nomp-entrypoint.sh

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -11,18 +11,4 @@ if [ "$NETWORK" = "Mainnet" ]; then
1111
sed -i 's|blockRefreshInterval": 500|blockRefreshInterval": 2000|g' /app/config.json
1212
fi
1313

14-
echo "Waiting for Zebra RPC to be ready..."
15-
while true; do
16-
RESP=$(curl -s "http://${ZEBRA_HOST}:${ZEBRA_RPC_PORT}" \
17-
-X POST \
18-
-H "content-type: application/json" \
19-
-d '{"jsonrpc":"2.0","id":1,"method":"getinfo","params":[]}' 2>/dev/null)
20-
if echo "$RESP" | grep -q result; then
21-
echo "Zebra is ready, starting s-nomp..."
22-
break
23-
fi
24-
echo "Zebra not ready, waiting 5s..."
25-
sleep 5
26-
done
27-
2814
exec node init.js

0 commit comments

Comments
 (0)