From b60a99f858cc7c8d0029eaac587b9ef68e042caa Mon Sep 17 00:00:00 2001 From: Prem Chaitanya Prathi Date: Thu, 23 Nov 2023 21:19:31 +0530 Subject: [PATCH] feat: changes to make compose work with go-waku --- ADVANCED.md | 8 +++---- README.md | 22 +++++++++---------- docker-compose.yml | 8 +++---- .../dashboards/nwaku-monitoring.json | 8 +++---- monitoring/configuration/grafana.ini | 2 +- register_rln.sh | 15 ++++++------- run_node.sh | 9 ++++---- 7 files changed, 35 insertions(+), 37 deletions(-) diff --git a/ADVANCED.md b/ADVANCED.md index fc94598..24da223 100644 --- a/ADVANCED.md +++ b/ADVANCED.md @@ -6,9 +6,9 @@ Information for advances users There are multiple environment variables you can configure to modify behaviour of the Waku node: -* `NWAKU_IMAGE` - the image you want to use for the nwaku container (e.g. `NWAKU_IMAGE=statusteam/nim-waku:v0.19.0-rc.0`). You can see the available tags in [docker hub](https://hub.docker.com/r/waku-org/nwaku). +* `GO_WAKU_IMAGE` - the image you want to use for the go-waku container (e.g. `GO_WAKU_IMAGE=wakuorg/go-waku:v0.9.0`). You can see the available tags in [docker hub](https://hub.docker.com/r/waku-org/go-waku). * `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`) +* `NODEKEY` - this env variable allows you to provide a node key as described in [operators documentation](https://github.com/waku-org/go-waku/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 @@ -23,10 +23,10 @@ To ensure the proper functioning of the container, it is strongly recommended to To check the status of the node, visit [http://localhost:8003/health](http://localhost:8003/health) -For real-time logs of the 'nwaku' service, use the following command: +For real-time logs of the 'go-waku' service, use the following command: ```console -docker-compose logs -f nwaku +docker-compose logs -f go-waku ``` In general, to view logs of any service running on Docker Compose, execute: diff --git a/README.md b/README.md index b0d9f8d..3ad3224 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ -# nwaku-compose +# go-waku-compose -Ready to use docker-compose to run your own [nwaku](https://github.com/waku-org/nwaku) full node: -* nwaku node running relay and store protocols with RLN enabled. +Ready to use docker-compose to run your own [go-waku](https://github.com/waku-org/go-waku) full node: +* go-waku node running relay and store protocols with RLN enabled. * Simple frontend to interact with your node and the network, to publish and receive messages. * Grafana dashboard for advanced users or node operators. * Requires `docker-compose` and `git`. @@ -22,7 +22,7 @@ export KEYSTORE_PASSWORD=PICK_A_PASSWORD **🔑 1. Register RLN membership** -The RLN membership is your access key to The Waku Network. Its registration is done onchain, and allows your nwaku node to publish messages in a decentralized and private way, respecting some [rate limits](https://rfc.vac.dev/spec/64/#rate-limit-exceeded). +The RLN membership is your access key to The Waku Network. Its registration is done onchain, and allows your go-waku node to publish messages in a decentralized and private way, respecting some [rate limits](https://rfc.vac.dev/spec/64/#rate-limit-exceeded). Messages exceeding the rate limit won't be relayed by other peers. This command will register your membership and store it in `keystore/keystore.json`. @@ -34,23 +34,23 @@ Note that if you just want to relay traffic (not publish), you don't need one. **🖥️ 2. Start your node** -Start all processes: nwaku node, database and grafana for metrics. Your RLN membership is loaded into nwaku under the hood. +Start all processes: go-waku node, database and grafana for metrics. Your RLN membership is loaded into go-waku under the hood. ```console docker-compose up -d ``` -**🏄🏼‍♂️ 3. Interact with your nwaku node** -* See [http://localhost:3000/d/yns_4vFVk/nwaku-monitoring](http://localhost:3000/d/yns_4vFVk/nwaku-monitoring) for node metrics. +**🏄🏼‍♂️ 3. Interact with your go-waku node** +* See [http://localhost:3000/d/yns_4vFVk/go-waku-monitoring](http://localhost:3000/d/yns_4vFVk/go-waku-monitoring) for node metrics. * See [localhost:4000](http://localhost:4000). Under development 🚧 **📬 4. Use the REST API** -Your nwaku node exposes a [REST API](https://waku-org.github.io/waku-rest-api/) to interact with it. +Your go-waku node exposes a [REST API](https://waku-org.github.io/waku-rest-api/) to interact with it. ``` -# get nwaku version +# get go-waku version curl http://127.0.0.1:8645/debug/v1/version -# get nwaku info +# get go-waku info curl http://127.0.0.1:8645/debug/v1/info ``` @@ -68,4 +68,4 @@ curl -X GET "http://127.0.0.1:8645/store/v1/messages?contentTopics=%2Fmy-app%2F2 -H "accept: application/json" ``` -For advanced documentation, refer to [ADVANCED.md](https://github.com/waku-org/nwaku-compose/blob/master/ADVANCED.md). +For advanced documentation, refer to [ADVANCED.md](https://github.com/waku-org/go-waku-compose/blob/master/ADVANCED.md). diff --git a/docker-compose.yml b/docker-compose.yml index f2fd6e2..81d0299 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -30,8 +30,8 @@ x-pg-exporter-env: &pg_exp_env # Services definitions services: - nwaku: - image: ${NWAKU_IMAGE:-wakuorg/nwaku:v0.22.0-rc.0} + go-waku: + image: ${GO_WAKU_IMAGE:-wakuorg/go-waku:v0.9.0} restart: on-failure ports: - 30304:30304/tcp @@ -74,7 +74,7 @@ services: # - 127.0.0.1:4000:3000 # restart: on-failure:5 # depends_on: - # - nwaku + # - go-waku prometheus: image: docker.io/prom/prometheus:latest @@ -87,7 +87,7 @@ services: restart: on-failure:5 depends_on: - postgres-exporter - - nwaku + - go-waku grafana: image: docker.io/grafana/grafana:latest diff --git a/monitoring/configuration/dashboards/nwaku-monitoring.json b/monitoring/configuration/dashboards/nwaku-monitoring.json index facc50d..0d66160 100644 --- a/monitoring/configuration/dashboards/nwaku-monitoring.json +++ b/monitoring/configuration/dashboards/nwaku-monitoring.json @@ -551,7 +551,7 @@ }, "editorMode": "builder", "exemplar": false, - "expr": "waku_version{instance=\"nwaku:8003\"}", + "expr": "waku_version{instance=\"go-waku:8003\"}", "format": "table", "instant": true, "legendFormat": "__auto", @@ -786,7 +786,7 @@ "include": { "names": [ "Time", - "{__name__=\"routing_table_nodes\", instance=\"nwaku:8003\", job=\"nwaku\"}" + "{__name__=\"routing_table_nodes\", instance=\"go-waku:8003\", job=\"go-waku\"}" ] } } @@ -977,7 +977,7 @@ "uid": "PBFA97CFB590B2093" }, "editorMode": "code", - "expr": "process_start_time_seconds{job=\"nwaku\"}*1000", + "expr": "process_start_time_seconds{job=\"go-waku\"}*1000", "legendFormat": "__auto", "range": true, "refId": "A" @@ -4736,7 +4736,7 @@ ] }, "timezone": "browser", - "title": "nwaku-monitoring", + "title": "go-waku-monitoring", "uid": "yns_4vFVk", "version": 1, "weekStart": "" diff --git a/monitoring/configuration/grafana.ini b/monitoring/configuration/grafana.ini index f237726..605ed8a 100644 --- a/monitoring/configuration/grafana.ini +++ b/monitoring/configuration/grafana.ini @@ -1,4 +1,4 @@ -instance_name = nwaku dashboard +instance_name = go-waku dashboard ;[dashboards.json] ;enabled = true diff --git a/register_rln.sh b/register_rln.sh index a827bae..555ede3 100755 --- a/register_rln.sh +++ b/register_rln.sh @@ -6,12 +6,11 @@ if test -f ./keystore/keystore.json; then exit 1 fi -# TODO: Set nwaku release when ready instead of quay +# TODO: Set go-waku release when ready -docker run -v $(pwd)/keystore:/keystore/:Z wakuorg/nwaku:v0.21.3 generateRlnKeystore \ ---rln-relay-eth-client-address=${ETH_CLIENT_ADDRESS} \ ---rln-relay-eth-private-key=${ETH_TESTNET_KEY} \ ---rln-relay-eth-contract-address=0xF471d71E9b1455bBF4b85d475afb9BB0954A29c4 \ ---rln-relay-cred-path=/keystore/keystore.json \ ---rln-relay-cred-password=${KEYSTORE_PASSWORD} \ ---execute +docker run -v $(pwd)/keystore:/keystore/:Z wakuorg/go-waku:v0.9.0 generate-rln-credentials \ +--eth-client-address=${ETH_CLIENT_ADDRESS} \ +--eth-account-private-key=${ETH_TESTNET_KEY} \ +--eth-contract-address=0xF471d71E9b1455bBF4b85d475afb9BB0954A29c4 \ +--cred-path=/keystore/keystore.json \ +--cred-password=${KEYSTORE_PASSWORD} \ No newline at end of file diff --git a/run_node.sh b/run_node.sh index b7f0869..a4c9a75 100644 --- a/run_node.sh +++ b/run_node.sh @@ -1,6 +1,6 @@ #!/bin/sh -echo "I am a nwaku node" +echo "I am a go-waku node" if [ -z "${ETH_CLIENT_ADDRESS}" ]; then echo "Missing Eth client address, please refer to README.md for detailed instructions" @@ -54,7 +54,7 @@ if [ -n "${RLN_RELAY_CRED_PASSWORD}" ]; then RLN_RELAY_CRED_PASSWORD=--rln-relay-cred-password=${RLN_RELAY_CRED_PASSWORD} fi -exec /usr/bin/wakunode\ +exec /usr/bin/waku\ --relay=true\ --pubsub-topic=/waku/2/rs/1/0\ --pubsub-topic=/waku/2/rs/1/1\ @@ -67,7 +67,6 @@ exec /usr/bin/wakunode\ --filter=true\ --lightpush=true\ --rpc-admin=true\ - --keep-alive=true\ --max-connections=150\ --cluster-id=1\ --discv5-bootstrap-node="enr:-QESuEC1p_s3xJzAC_XlOuuNrhVUETmfhbm1wxRGis0f7DlqGSw2FM-p2Ugl_r25UHQJ3f1rIRrpzxJXSMaJe4yk1XFSAYJpZIJ2NIJpcISygI2rim11bHRpYWRkcnO4XAArNiZub2RlLTAxLmRvLWFtczMud2FrdS50ZXN0LnN0YXR1c2ltLm5ldAZ2XwAtNiZub2RlLTAxLmRvLWFtczMud2FrdS50ZXN0LnN0YXR1c2ltLm5ldAYfQN4DgnJzkwABCAAAAAEAAgADAAQABQAGAAeJc2VjcDI1NmsxoQJATXRSRSUyTw_QLB6H_U3oziVQgNRgrXpK7wp2AMyNxYN0Y3CCdl-DdWRwgiMohXdha3UyDw"\ @@ -76,7 +75,7 @@ exec /usr/bin/wakunode\ --discv5-discovery=true\ --discv5-udp-port=9005\ --discv5-enr-auto-update=True\ - --log-level=DEBUG\ + --log-level=INFO\ --rpc-port=8545\ --rpc-address=0.0.0.0\ --tcp-port=30304\ @@ -89,7 +88,7 @@ exec /usr/bin/wakunode\ --nat=extip:"${MY_EXT_IP}"\ --store=true\ --store-message-db-url="postgres://${POSTGRES_USER}:${POSTGRES_PASSWORD}@postgres:5432/postgres"\ - --store-message-retention-policy=time:86400\ + --store-message-retention-time=24h0m0s\ --rln-relay=true\ --rln-relay-dynamic=true\ --rln-relay-eth-contract-address="${RLN_RELAY_CONTRACT_ADDRESS}"\