2023-08-09 10:36:03 +00:00
|
|
|
#!/bin/sh
|
|
|
|
|
|
|
|
echo "I am a nwaku node"
|
|
|
|
|
2023-09-21 12:28:39 +00:00
|
|
|
if [ -z "${ETH_CLIENT_ADDRESS}" ]; then
|
2023-09-22 08:45:45 +00:00
|
|
|
echo "Missing Eth client address, please refer to README.md for detailed instructions"
|
2023-09-21 12:28:39 +00:00
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2023-08-09 10:36:03 +00:00
|
|
|
MY_EXT_IP=$(wget -qO- https://api4.ipify.org)
|
2023-09-05 11:13:59 +00:00
|
|
|
DNS_WSS_CMD=
|
|
|
|
|
|
|
|
if [ -n "${DOMAIN}" ]; then
|
|
|
|
|
|
|
|
LETSENCRYPT_PATH=/etc/letsencrypt/live/${DOMAIN}
|
|
|
|
|
|
|
|
if ! [ -d "${LETSENCRYPT_PATH}" ]; then
|
|
|
|
apk add --no-cache certbot
|
|
|
|
|
|
|
|
certbot certonly\
|
|
|
|
--non-interactive\
|
|
|
|
--agree-tos\
|
|
|
|
--no-eff-email\
|
|
|
|
--no-redirect\
|
|
|
|
--email admin@${DOMAIN}\
|
|
|
|
-d ${DOMAIN}\
|
|
|
|
--standalone
|
|
|
|
fi
|
|
|
|
|
|
|
|
if ! [ -e "${LETSENCRYPT_PATH}/privkey.pem" ]; then
|
|
|
|
echo "The certificate does not exist"
|
|
|
|
sleep 60
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
WS_SUPPORT="--websocket-support=true"
|
|
|
|
WSS_SUPPORT="--websocket-secure-support=true"
|
|
|
|
WSS_KEY="--websocket-secure-key-path=${LETSENCRYPT_PATH}/privkey.pem"
|
|
|
|
WSS_CERT="--websocket-secure-cert-path=${LETSENCRYPT_PATH}/cert.pem"
|
|
|
|
DNS4_DOMAIN="--dns4-domain-name=${DOMAIN}"
|
|
|
|
|
|
|
|
DNS_WSS_CMD="${WS_SUPPORT} ${WSS_SUPPORT} ${WSS_CERT} ${WSS_KEY} ${DNS4_DOMAIN}"
|
|
|
|
fi
|
|
|
|
|
2023-09-22 08:45:45 +00:00
|
|
|
if [ -n "${NODEKEY}" ]; then
|
2023-09-05 11:13:59 +00:00
|
|
|
NODEKEY=--nodekey=${NODEKEY}
|
|
|
|
fi
|
2023-08-09 10:36:03 +00:00
|
|
|
|
2023-11-13 11:55:46 +00:00
|
|
|
RLN_RELAY_CRED_PATH=--rln-relay-cred-path=${RLN_RELAY_CRED_PATH:-/keystore/keystore.json}
|
|
|
|
|
2023-09-22 08:45:45 +00:00
|
|
|
|
|
|
|
if [ -n "${RLN_RELAY_CRED_PASSWORD}" ]; then
|
2024-01-09 10:42:20 +00:00
|
|
|
RLN_RELAY_CRED_PASSWORD=--rln-relay-cred-password="${RLN_RELAY_CRED_PASSWORD}"
|
2023-09-22 08:45:45 +00:00
|
|
|
fi
|
|
|
|
|
2024-03-15 13:22:58 +00:00
|
|
|
STORE_RETENTION_POLICY=--store-message-retention-policy=size:1GB
|
2024-03-14 09:05:57 +00:00
|
|
|
|
|
|
|
if [ -n "${STORAGE_SIZE}" ]; then
|
|
|
|
STORE_RETENTION_POLICY=--store-message-retention-policy=size:"${STORAGE_SIZE}"
|
|
|
|
fi
|
|
|
|
|
2024-05-16 17:31:37 +00:00
|
|
|
exec /heaptrack/build/bin/heaptrack /usr/bin/wakunode\
|
2023-08-09 10:36:03 +00:00
|
|
|
--relay=true\
|
|
|
|
--filter=true\
|
|
|
|
--lightpush=true\
|
|
|
|
--keep-alive=true\
|
|
|
|
--max-connections=150\
|
2023-11-01 15:14:01 +00:00
|
|
|
--cluster-id=1\
|
2023-08-09 10:36:03 +00:00
|
|
|
--discv5-discovery=true\
|
|
|
|
--discv5-udp-port=9005\
|
|
|
|
--discv5-enr-auto-update=True\
|
|
|
|
--log-level=DEBUG\
|
|
|
|
--tcp-port=30304\
|
|
|
|
--metrics-server=True\
|
|
|
|
--metrics-server-port=8003\
|
|
|
|
--metrics-server-address=0.0.0.0\
|
2023-10-02 13:07:23 +00:00
|
|
|
--rest=true\
|
2024-01-09 10:42:20 +00:00
|
|
|
--rest-admin=true\
|
2023-10-02 13:07:23 +00:00
|
|
|
--rest-address=0.0.0.0\
|
|
|
|
--rest-port=8645\
|
2024-03-12 08:44:21 +00:00
|
|
|
--rest-allow-origin="waku-org.github.io"\
|
2023-08-09 10:36:03 +00:00
|
|
|
--nat=extip:"${MY_EXT_IP}"\
|
|
|
|
--store=true\
|
|
|
|
--store-message-db-url="postgres://${POSTGRES_USER}:${POSTGRES_PASSWORD}@postgres:5432/postgres"\
|
2023-09-21 09:25:39 +00:00
|
|
|
--rln-relay-eth-client-address="${ETH_CLIENT_ADDRESS}"\
|
2023-09-21 12:28:39 +00:00
|
|
|
--rln-relay-tree-path="/etc/rln_tree"\
|
2023-09-22 08:45:45 +00:00
|
|
|
${RLN_RELAY_CRED_PATH}\
|
|
|
|
${RLN_RELAY_CRED_PASSWORD}\
|
2023-09-22 11:10:57 +00:00
|
|
|
${DNS_WSS_CMD}\
|
|
|
|
${NODEKEY}\
|
2024-03-14 09:05:57 +00:00
|
|
|
${STORE_RETENTION_POLICY}\
|
2023-09-05 11:13:59 +00:00
|
|
|
${EXTRA_ARGS}
|
|
|
|
|