Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: integrate liteprotocoltester #69

Draft
wants to merge 3 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions .env
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Env variables for metal-01.he-eu-hel1.wakusim.misc host.
NWAKU_IMAGE=quay.io/wakuorg/nwaku-pr:2759-rln-v2
# Network scaling.
NUM_NWAKU_NODES=40



# Simulation traffic.
MSG_PER_SECOND=10
MSG_SIZE_KBYTES=10
TRAFFIC_DELAY_SECONDS=15
# Enable automatic Docker image updates.
WATCHTOWER_ENABLED=true
# Anvil RPC Node external IP and port
RPC_URL=http://foundry:8545
# Contract-deployment
PRIVATE_KEY=0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80
ETH_FROM=0xf39fd6e51aad88f6f4ce6ab8827279cfffb92266
# RLNv2 limits
RLN_RELAY_MSG_LIMIT=10
RLN_RELAY_EPOCH_SEC=60
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
**/.DS_Store
*.env
!.env
!wakusim.env
116 changes: 116 additions & 0 deletions docker-compose-norln.yml
Original file line number Diff line number Diff line change
@@ -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
82 changes: 81 additions & 1 deletion monitoring/prometheus-config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
- 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
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mind giving some context on what each type of node does?
how is publishernode different from lightpush-service? and filter vs receivednode?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, this one I could not separate hence including foreign services here.
Mind that my setup is running in a separate compose which is interconnected with simulator via the docker network it defines.
But to see my services on the board I needed to add them here.
In my setup I have n-number of lightpush client connects to a lightpush-service node and a filter client that is connected with a separate filter-service node... where service nodes are connected to waku-simulator relay network.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

- 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
73 changes: 47 additions & 26 deletions run_nwaku.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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"

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 $USERLN; then

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"
Expand Down Expand Up @@ -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\
Expand All @@ -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
--cluster-id=66\
${RLN_CLI_ARGS}