Merge pull request #7 from waku-org/adding-rln-support

feat: adding RLN support for nwaku-compose
This commit is contained in:
Alvaro Revuelta 2023-11-01 16:16:02 +01:00 committed by GitHub
commit 7a7dc80560
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 1034 additions and 96 deletions

View File

@ -15,6 +15,12 @@ cd nwaku-compose
Edit the environment variables present at the beginning of the `docker-compose.yml` file.
It is required to set the `ETH_CLIENT_ADDRESS` environment variable within the `docker-compose.yml` file before starting the instance.
`ETH_CLIENT_ADDRESS` must be a WebSockets URL for your Ethereum Node.
For the current default contract, it must be a node for the Sepolia network.
In case you're not running your own node, you can get it from [Infura](https://www.infura.io/)
Start everything: `nwaku`, `postgres`, `prometheus`, and `grafana`.
```console
docker-compose up -d
@ -36,6 +42,10 @@ There are multiple environment variables you can configure to modify behaviour o
* `NWAKU_IMAGE` - the image you want to use for the nwaku container (e.g. `NWAKU_IMAGE=statusteam/nim-waku:v0.19.0-rc.0`)
* `DOMAIN` - domain name pointing to the IP address of your node, when configured the run script will request SSL certs from Let's Encrypt and run Waku node with WebSockets Secure (WSS) options enabled (e.g. `DOMAIN=waku.example.com`)
* `NODEKEY` - this env variable allows you to provide a node key as described in [operators documentation](https://github.com/waku-org/nwaku/blob/master/docs/operators/how-to/configure-key.md) (e.g. `NODEKEY=9f439983aa4851346cfe6e17585e426f482871a43626812e23490895cd602c11`)
* `RLN_RELAY_CONTRACT_ADDRESS` - address of the RLN Relay Contract. It defaults to a Sepolia testnet address
* `ETH_CLIENT_ADDRESS` (**mandatory**) - URL to a WebSockets Ethereum node URL on the same network as the contract address. If you're not running your own node, you can get the URL at Infura with the following [instructions](https://docs.infura.io/networks/ethereum/how-to/choose-a-network)
* `RLN_RELAY_CRED_PATH` - path for peristing rln-relay credential
* `RLN_RELAY_CRED_PASSWORD` - password for encrypting RLN credentials
* `EXTRA_ARGS` - this variable allows you to specify additional or overriding CLI option for the Waku node which will be appended to the `wakunode2` command. (e.g. `EXTRA_ARGS="--store=false --max-connections=3000`)
## Log monitoring and troubleshooting

View File

@ -6,12 +6,19 @@ x-logging: &logging
max-size: 1000m
# Environment variable definitions
x-eth-client-address: &eth_client_address ${ETH_CLIENT_ADDRESS:-} # Add your ETH_CLIENT_ADDRESS after the "-"
x-rln-environment: &rln_env
RLN_RELAY_CONTRACT_ADDRESS: ${RLN_RELAY_CONTRACT_ADDRESS:-0xF471d71E9b1455bBF4b85d475afb9BB0954A29c4}
RLN_RELAY_CRED_PATH: ${RLN_RELAY_CRED_PATH:-} # Optional: Add your RLN_RELAY_CRED_PATH after the "-"
RLN_RELAY_CRED_PASSWORD: ${RLN_RELAY_CRED_PASSWORD:-} # Optional: Add your RLN_RELAY_CRED_PASSWORD after the "-"
x-pg-pass: &pg_pass ${POSTGRES_PASSWORD:-test123}
x-pg-user: &pg_user ${POSTGRES_USER:-postgres}
x-pg-environment: &pg_env
POSTGRES_USER: *pg_user
POSTGRES_PASSWORD: *pg_pass
POSTGRES_USER: *pg_user
POSTGRES_PASSWORD: *pg_pass
x-pg-exporter-env: &pg_exp_env
environment:
@ -41,8 +48,8 @@ services:
# For a pre-built release. See available releases:
# github.com/waku-org/nwaku/releases
image: ${NWAKU_IMAGE:-statusteam/nim-waku:v0.20.0}
restart: on-failure:5 # Retry up to 5 times
image: ${NWAKU_IMAGE:-wakuorg/nwaku:v0.21.2-rc.0}
restart: on-failure
ports:
- 30304:30304/tcp
- 30304:30304/udp
@ -57,11 +64,15 @@ services:
environment:
DOMAIN: ${DOMAIN}
NODEKEY: ${NODEKEY}
ETH_CLIENT_ADDRESS: *eth_client_address
EXTRA_ARGS: ${EXTRA_ARGS}
<<: *pg_env
<<:
- *pg_env
- *rln_env
volumes:
- ./run_node.sh:/opt/run_node.sh:Z
- ./certs:/etc/letsencrypt/:Z
- ./rln_tree:/etc/rln_tree/:Z
entrypoint: sh
command:
- /opt/run_node.sh

File diff suppressed because it is too large Load Diff

View File

@ -2,6 +2,11 @@
echo "I am a nwaku node"
if [ -z "${ETH_CLIENT_ADDRESS}" ]; then
echo "Missing Eth client address, please refer to README.md for detailed instructions"
exit 1
fi
MY_EXT_IP=$(wget -qO- https://api4.ipify.org)
DNS_WSS_CMD=
@ -37,10 +42,18 @@ if [ -n "${DOMAIN}" ]; then
DNS_WSS_CMD="${WS_SUPPORT} ${WSS_SUPPORT} ${WSS_CERT} ${WSS_KEY} ${DNS4_DOMAIN}"
fi
if [ "${NODEKEY}" != "" ]; then
if [ -n "${NODEKEY}" ]; then
NODEKEY=--nodekey=${NODEKEY}
fi
if [ -n "${RLN_RELAY_CRED_PATH}" ]; then
RLN_RELAY_CRED_PATH=--rln-relay-cred-path=${RLN_RELAY_CRED_PATH}
fi
if [ -n "${RLN_RELAY_CRED_PASSWORD}" ]; then
RLN_RELAY_CRED_PASSWORD=--rln-relay-cred-password=${RLN_RELAY_CRED_PASSWORD}
fi
exec /usr/bin/wakunode\
--relay=true\
--topic=/waku/2/default-waku/proto\
@ -50,6 +63,7 @@ exec /usr/bin/wakunode\
--rpc-admin=true\
--keep-alive=true\
--max-connections=150\
--cluster-id=1\
--dns-discovery=true\
--dns-discovery-url=enrtree://ANEDLO25QVUGJOUTQFRYKWX6P4Z4GKVESBMHML7DZ6YK4LGS5FC5O@prod.wakuv2.nodes.status.im\
--discv5-discovery=true\
@ -69,6 +83,13 @@ exec /usr/bin/wakunode\
--store=true\
--store-message-db-url="postgres://${POSTGRES_USER}:${POSTGRES_PASSWORD}@postgres:5432/postgres"\
--store-message-retention-policy=time:86400\
--rln-relay=true\
--rln-relay-dynamic=true\
--rln-relay-eth-contract-address="${RLN_RELAY_CONTRACT_ADDRESS}"\
--rln-relay-eth-client-address="${ETH_CLIENT_ADDRESS}"\
--rln-relay-tree-path="/etc/rln_tree"\
${RLN_RELAY_CRED_PATH}\
${RLN_RELAY_CRED_PASSWORD}\
${DNS_WSS_CMD}\
${NODEKEY}\
${EXTRA_ARGS}