Shell probe signs a JWT from /jwtsecret and calls engine_exchangeCapabilities on :8551 so compose can gate Maru startup on EL engine readiness.
13 lines
681 B
Bash
Executable File
13 lines
681 B
Bash
Executable File
#!/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
|