linea: add engine API healthcheck script for geth mainnet
Shell probe signs a JWT from /jwtsecret and calls engine_exchangeCapabilities on :8551 so compose can gate Maru startup on EL engine readiness.
This commit is contained in:
12
linea/scripts/engine-healthcheck.sh
Executable file
12
linea/scripts/engine-healthcheck.sh
Executable file
@@ -0,0 +1,12 @@
|
||||
#!/bin/sh
|
||||
set -e
|
||||
apk add --no-cache openssl wget >/dev/null 2>&1 || true
|
||||
SECRET=$(tr -d '\n' </jwtsecret | sed 's/^0x//')
|
||||
H=$(printf '{"alg":"HS256","typ":"JWT"}' | openssl base64 -e -A | tr '+/' '-_' | tr -d '=')
|
||||
P=$(printf '{"iat":%s}' "$(date +%s)" | openssl base64 -e -A | tr '+/' '-_' | tr -d '=')
|
||||
SIG=$(printf '%s' "$H.$P" | openssl dgst -sha256 -mac HMAC -macopt hexkey:"$SECRET" -binary | openssl base64 -e -A | tr '+/' '-_' | tr -d '=')
|
||||
wget -q -O /dev/null \
|
||||
--header="Content-Type: application/json" \
|
||||
--header="Authorization: Bearer $H.$P.$SIG" \
|
||||
--post-data='{"jsonrpc":"2.0","method":"engine_exchangeCapabilities","params":[],"id":1}' \
|
||||
http://127.0.0.1:8551
|
||||
Reference in New Issue
Block a user