2024-05-21 21:03:33 +00:00
|
|
|
#!/bin/sh
|
|
|
|
|
|
|
|
echo "I am a service node"
|
|
|
|
IP=$(ip a | grep "inet " | grep -Fv 127.0.0.1 | sed 's/.*inet \([^/]*\).*/\1/')
|
|
|
|
|
|
|
|
echo "Service node IP: ${IP}"
|
|
|
|
|
2024-08-21 12:54:18 +00:00
|
|
|
if [ -n "${PUBSUB}" ]; then
|
|
|
|
PUBSUB=--pubsub-topic="${PUBSUB}"
|
|
|
|
else
|
|
|
|
PUBSUB=--pubsub-topic="/waku/2/rs/66/0"
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ -n "${CLUSTER_ID}" ]; then
|
|
|
|
CLUSTER_ID=--cluster-id="${CLUSTER_ID}"
|
|
|
|
fi
|
|
|
|
|
|
|
|
echo "STANDALONE: ${STANDALONE}"
|
|
|
|
|
|
|
|
if [ -z "${STANDALONE}" ]; then
|
|
|
|
|
2024-09-04 06:35:51 +00:00
|
|
|
RETRIES=${RETRIES:=20}
|
2024-08-21 12:54:18 +00:00
|
|
|
|
|
|
|
while [ -z "${BOOTSTRAP_ENR}" ] && [ ${RETRIES} -ge 0 ]; do
|
|
|
|
BOOTSTRAP_ENR=$(wget -qO- http://bootstrap:8645/debug/v1/info --header='Content-Type:application/json' 2> /dev/null | sed 's/.*"enrUri":"\([^"]*\)".*/\1/');
|
|
|
|
echo "Bootstrap node not ready, retrying (retries left: ${RETRIES})"
|
2024-09-04 06:35:51 +00:00
|
|
|
sleep 3
|
2024-08-21 12:54:18 +00:00
|
|
|
RETRIES=$(( $RETRIES - 1 ))
|
|
|
|
done
|
|
|
|
|
|
|
|
if [ -z "${BOOTSTRAP_ENR}" ]; then
|
|
|
|
echo "Could not get BOOTSTRAP_ENR and none provided. Failing"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
echo "Using bootstrap node: ${BOOTSTRAP_ENR}"
|
|
|
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
2024-05-21 21:03:33 +00:00
|
|
|
exec /usr/bin/wakunode\
|
|
|
|
--relay=true\
|
|
|
|
--filter=true\
|
|
|
|
--lightpush=true\
|
|
|
|
--store=false\
|
|
|
|
--rest=true\
|
|
|
|
--rest-admin=true\
|
|
|
|
--rest-private=true\
|
|
|
|
--rest-address=0.0.0.0\
|
|
|
|
--rest-allow-origin="*"\
|
|
|
|
--keep-alive=true\
|
|
|
|
--max-connections=300\
|
|
|
|
--dns-discovery=true\
|
|
|
|
--discv5-discovery=true\
|
|
|
|
--discv5-enr-auto-update=True\
|
2024-08-21 12:54:18 +00:00
|
|
|
--discv5-bootstrap-node=${BOOTSTRAP_ENR}\
|
|
|
|
--log-level=INFO\
|
2024-05-21 21:03:33 +00:00
|
|
|
--metrics-server=True\
|
2024-09-04 06:35:51 +00:00
|
|
|
--metrics-server-port=8003\
|
2024-05-21 21:03:33 +00:00
|
|
|
--metrics-server-address=0.0.0.0\
|
|
|
|
--nat=extip:${IP}\
|
2024-08-21 12:54:18 +00:00
|
|
|
${PUBSUB}\
|
|
|
|
${CLUSTER_ID}
|