From 72b4ade01039c1da1cf3ce10eeb6b47412749e8c Mon Sep 17 00:00:00 2001 From: NagyZoltanPeter <113987313+NagyZoltanPeter@users.noreply.github.com> Date: Fri, 14 Jun 2024 15:23:29 +0200 Subject: [PATCH] Enable RUN without RLN - for simulating light protocol usage of Status --- docker-compose-norln.yml | 116 +++++++++++++++++++++++++++++++ monitoring/prometheus-config.yml | 82 +++++++++++++++++++++- run_nwaku.sh | 71 ++++++++++++------- 3 files changed, 243 insertions(+), 26 deletions(-) create mode 100644 docker-compose-norln.yml diff --git a/docker-compose-norln.yml b/docker-compose-norln.yml new file mode 100644 index 0000000..7d5cb67 --- /dev/null +++ b/docker-compose-norln.yml @@ -0,0 +1,116 @@ +version: "3.7" + +networks: + simulation: + driver: bridge + ipam: + driver: default + config: + - subnet: "10.2.0.0/24" + +services: + + bootstrap: + image: ${NWAKU_IMAGE:-harbor.status.im/wakuorg/nwaku:latest} + restart: on-failure + ports: + - 127.0.0.1:60000:60000 + - 127.0.0.1:8008:8008 + - 127.0.0.1:9000:9000 + - 127.0.0.1:8645:8645 + entrypoint: sh + command: + - '/opt/run_bootstrap.sh' + volumes: + - ./run_bootstrap.sh:/opt/run_bootstrap.sh:Z + networks: + - simulation + + nwaku: + image: ${NWAKU_IMAGE:-harbor.status.im/wakuorg/nwaku:latest} + restart: on-failure + deploy: + replicas: ${NUM_NWAKU_NODES:-5} + entrypoint: sh + environment: + - DONOTUSERLN=1 + command: + - '/opt/run_nwaku.sh' + volumes: + - ./run_nwaku.sh:/opt/run_nwaku.sh:Z + depends_on: + - bootstrap + networks: + - simulation + + rest-traffic: + image: alrevuelta/rest-traffic:d936446 + command: + --multiple-nodes=http://waku-simulator_nwaku_[1..${NUM_NWAKU_NODES:-5}]:8645 + --msg-size-kbytes=${MSG_SIZE_KBYTES:-10} + --delay-seconds=${TRAFFIC_DELAY_SECONDS:-15} + networks: + - simulation + depends_on: + - nwaku + profiles: + - msgpump + + prometheus: + image: prom/prometheus:latest + volumes: + - ./monitoring/prometheus-config.yml:/etc/prometheus/prometheus.yml:z + command: + - --config.file=/etc/prometheus/prometheus.yml + - --storage.tsdb.retention.time=7d + ports: + - 127.0.0.1:9090:9090 + restart: on-failure + networks: + - simulation + + grafana: + image: grafana/grafana:latest + env_file: + - ./monitoring/configuration/grafana-plugins.env + environment: + - GF_SECURITY_ADMIN_USER=${GF_SECURITY_ADMIN_USER} + - GF_SECURITY_ADMIN_PASSWORD=${GF_SECURITY_ADMIN_PASSWORD} + volumes: + - ./monitoring/configuration/grafana.ini:/etc/grafana/grafana.ini:z + - ./monitoring/configuration/dashboards.yaml:/etc/grafana/provisioning/dashboards/dashboards.yaml:z + - ./monitoring/configuration/datasources.yaml:/etc/grafana/provisioning/datasources/datasources.yaml:z + - ./monitoring/configuration/dashboards:/var/lib/grafana/dashboards/:z + - ./monitoring/configuration/customizations/custom-logo.svg:/usr/share/grafana/public/img/grafana_icon.svg:z + - ./monitoring/configuration/customizations/custom-logo.svg:/usr/share/grafana/public/img/grafana_typelogo.svg:z + - ./monitoring/configuration/customizations/custom-logo.png:/usr/share/grafana/public/img/fav32.png:z + ports: + - 0.0.0.0:3001:3001 + restart: on-failure + depends_on: + - prometheus + networks: + - simulation + + cadvisor: + image: gcr.io/cadvisor/cadvisor:latest + container_name: cadvisor + #ports: + # - 8080:8080 + volumes: + - /:/rootfs:ro + - /var/run:/var/run:rw + - /sys:/sys:ro + - /var/lib/docker/:/var/lib/docker:ro + depends_on: + - redis + networks: + - simulation + + redis: + image: redis:latest + container_name: redis + #ports: + # - 6379:6379 + networks: + - simulation diff --git a/monitoring/prometheus-config.yml b/monitoring/prometheus-config.yml index 69102ab..46ab229 100644 --- a/monitoring/prometheus-config.yml +++ b/monitoring/prometheus-config.yml @@ -213,4 +213,84 @@ scrape_configs: - waku-simulator_nwaku_197:8008 - waku-simulator_nwaku_198:8008 - waku-simulator_nwaku_199:8008 - - waku-simulator_nwaku_200:8008 \ No newline at end of file + - waku-simulator_nwaku_200:8008 + - liteprotocoltester-filter-service-1:8008 + - liteprotocoltester-filter-service-2:8008 + - liteprotocoltester-filter-service-3:8008 + - liteprotocoltester-filter-service-4:8008 + - liteprotocoltester-filter-service-5:8008 + - liteprotocoltester-filter-service-6:8008 + - liteprotocoltester-filter-service-7:8008 + - liteprotocoltester-filter-service-8:8008 + - liteprotocoltester-filter-service-9:8008 + - liteprotocoltester-filter-service-10:8008 + - liteprotocoltester-filter-service-11:8008 + - liteprotocoltester-filter-service-12:8008 + - liteprotocoltester-filter-service-13:8008 + - liteprotocoltester-filter-service-14:8008 + - liteprotocoltester-filter-service-15:8008 + - liteprotocoltester-filter-service-16:8008 + - liteprotocoltester-filter-service-17:8008 + - liteprotocoltester-filter-service-18:8008 + - liteprotocoltester-filter-service-19:8008 + - liteprotocoltester-filter-service-20:8008 + - liteprotocoltester-lightpush-service-1:8008 + - liteprotocoltester-lightpush-service-2:8008 + - liteprotocoltester-lightpush-service-3:8008 + - liteprotocoltester-lightpush-service-4:8008 + - liteprotocoltester-lightpush-service-5:8008 + - liteprotocoltester-lightpush-service-6:8008 + - liteprotocoltester-lightpush-service-7:8008 + - liteprotocoltester-lightpush-service-8:8008 + - liteprotocoltester-lightpush-service-9:8008 + - liteprotocoltester-lightpush-service-10:8008 + - liteprotocoltester-lightpush-service-11:8008 + - liteprotocoltester-lightpush-service-12:8008 + - liteprotocoltester-lightpush-service-13:8008 + - liteprotocoltester-lightpush-service-14:8008 + - liteprotocoltester-lightpush-service-15:8008 + - liteprotocoltester-lightpush-service-16:8008 + - liteprotocoltester-lightpush-service-17:8008 + - liteprotocoltester-lightpush-service-18:8008 + - liteprotocoltester-lightpush-service-19:8008 + - liteprotocoltester-lightpush-service-20:8008 + - liteprotocoltester-receivernode-1:8008 + - liteprotocoltester-receivernode-2:8008 + - liteprotocoltester-receivernode-3:8008 + - liteprotocoltester-receivernode-4:8008 + - liteprotocoltester-receivernode-5:8008 + - liteprotocoltester-receivernode-6:8008 + - liteprotocoltester-receivernode-7:8008 + - liteprotocoltester-receivernode-8:8008 + - liteprotocoltester-receivernode-9:8008 + - liteprotocoltester-receivernode-10:8008 + - liteprotocoltester-receivernode-11:8008 + - liteprotocoltester-receivernode-12:8008 + - liteprotocoltester-receivernode-13:8008 + - liteprotocoltester-receivernode-14:8008 + - liteprotocoltester-receivernode-15:8008 + - liteprotocoltester-receivernode-16:8008 + - liteprotocoltester-receivernode-17:8008 + - liteprotocoltester-receivernode-18:8008 + - liteprotocoltester-receivernode-19:8008 + - liteprotocoltester-receivernode-20:8008 + - liteprotocoltester-publishernode-1:8008 + - liteprotocoltester-publishernode-2:8008 + - liteprotocoltester-publishernode-3:8008 + - liteprotocoltester-publishernode-4:8008 + - liteprotocoltester-publishernode-5:8008 + - liteprotocoltester-publishernode-6:8008 + - liteprotocoltester-publishernode-7:8008 + - liteprotocoltester-publishernode-8:8008 + - liteprotocoltester-publishernode-9:8008 + - liteprotocoltester-publishernode-10:8008 + - liteprotocoltester-publishernode-11:8008 + - liteprotocoltester-publishernode-12:8008 + - liteprotocoltester-publishernode-13:8008 + - liteprotocoltester-publishernode-14:8008 + - liteprotocoltester-publishernode-15:8008 + - liteprotocoltester-publishernode-16:8008 + - liteprotocoltester-publishernode-17:8008 + - liteprotocoltester-publishernode-18:8008 + - liteprotocoltester-publishernode-19:8008 + - liteprotocoltester-publishernode-20:8008 diff --git a/run_nwaku.sh b/run_nwaku.sh index c938881..91ff9cc 100755 --- a/run_nwaku.sh +++ b/run_nwaku.sh @@ -20,6 +20,17 @@ fi IP=$(ip a | grep "inet " | grep -Fv 127.0.0.1 | sed 's/.*inet \([^/]*\).*/\1/') + + +if [ -z "$DONOTUSERLN" ] || [ "$DONOTUSERLN" != "1" ]; then + USERLN=true + echo "RLN is enabled" +else + USERLN=false + echo "RLN is disabled" +fi + + # Function to extract IP address from URL, resolve the IP and replace it in the original URL get_ip_address_and_replace() { local url=$1 @@ -95,22 +106,39 @@ get_private_key(){ fi } -if test -f .$RLN_CREDENTIAL_PATH; then - echo "$RLN_CREDENTIAL_PATH already exists. Use it instead of creating a new one." -else - private_key="$(get_private_key)" - echo "Private key: $private_key" +if $USERLN; then - echo "Generating RLN keystore" - /usr/bin/wakunode generateRlnKeystore \ - --rln-relay-eth-client-address="$RPC_URL" \ - --rln-relay-eth-private-key=$private_key \ - --rln-relay-eth-contract-address=$RLN_CONTRACT_ADDRESS \ - --rln-relay-cred-path=$RLN_CREDENTIAL_PATH \ - --rln-relay-cred-password=$RLN_CREDENTIAL_PASSWORD \ - --rln-relay-user-message-limit=$RLN_RELAY_MSG_LIMIT \ - --log-level=DEBUG \ - --execute + if test -f .$RLN_CREDENTIAL_PATH; then + echo "$RLN_CREDENTIAL_PATH already exists. Use it instead of creating a new one." + else + private_key="$(get_private_key)" + echo "Private key: $private_key" + + echo "Generating RLN keystore" + /usr/bin/wakunode generateRlnKeystore \ + --rln-relay-eth-client-address="$RPC_URL" \ + --rln-relay-eth-private-key=$private_key \ + --rln-relay-eth-contract-address=$RLN_CONTRACT_ADDRESS \ + --rln-relay-cred-path=$RLN_CREDENTIAL_PATH \ + --rln-relay-cred-password=$RLN_CREDENTIAL_PASSWORD \ + --rln-relay-user-message-limit=$RLN_RELAY_MSG_LIMIT \ + --log-level=DEBUG \ + --execute + fi + + + RLN_CLI_ARGS="--rln-relay=true\ + --rln-relay-dynamic=true\ + --rln-relay-eth-client-address=\"${RPC_URL}\"\ + --rln-relay-eth-contract-address=${RLN_CONTRACT_ADDRESS}\ + --rln-relay-cred-path=${RLN_CREDENTIAL_PATH}\ + --rln-relay-cred-password=${RLN_CREDENTIAL_PASSWORD}\ + --rln-relay-tree-path=\"rlnv2_tree1\"\ + --rln-relay-epoch-sec=${RLN_RELAY_EPOCH_SEC}\ + --rln-relay-user-message-limit=${RLN_RELAY_MSG_LIMIT}" + +else + RLN_CLI_ARGS="--rln-relay=false" fi echo "I am a nwaku node" @@ -139,15 +167,6 @@ exec /usr/bin/wakunode\ --rest-private=true\ --rest-address=0.0.0.0\ --rest-port=8645\ - --rln-relay=true\ - --rln-relay-dynamic=true\ - --rln-relay-eth-client-address="$RPC_URL"\ - --rln-relay-eth-contract-address=$RLN_CONTRACT_ADDRESS\ - --rln-relay-cred-path=$RLN_CREDENTIAL_PATH\ - --rln-relay-cred-password=$RLN_CREDENTIAL_PASSWORD\ - --rln-relay-tree-path="rlnv2_tree1"\ - --rln-relay-epoch-sec=$RLN_RELAY_EPOCH_SEC\ - --rln-relay-user-message-limit=$RLN_RELAY_MSG_LIMIT\ --dns-discovery=true\ --discv5-discovery=true\ --discv5-enr-auto-update=True\ @@ -157,4 +176,6 @@ exec /usr/bin/wakunode\ --discv5-bootstrap-node=${BOOTSTRAP_ENR}\ --nat=extip:${IP}\ --pubsub-topic=/waku/2/rs/66/0\ - --cluster-id=66 \ No newline at end of file + --cluster-id=66\ + ${RLN_CLI_ARGS} +