Feat adding rln to waku simulator (#12)

This commit is contained in:
gabrielmer 2023-10-31 17:17:35 +02:00 committed by GitHub
parent 67ebeef4d7
commit ed0c4a0bf1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 1140 additions and 53 deletions

3
Dockerfile.rest-traffic Normal file
View File

@ -0,0 +1,3 @@
FROM python:3.9.18-alpine3.18
RUN pip install requests argparse

View File

@ -14,11 +14,11 @@ cd waku-simulator
Configure the simulation parameters. You can place the env variable in an `.env` file. Configure the simulation parameters. You can place the env variable in an `.env` file.
``` ```
export GOWAKU_IMAGE=statusteam/go-waku:latest export GOWAKU_IMAGE=wakuorg/go-waku:latest
export NWAKU_IMAGE=statusteam/nim-waku:v0.18.0-rc.0 export NWAKU_IMAGE=wakuorg/nwaku:v0.21.2-rc.0
export NUM_NWAKU_NODES=5 export NUM_NWAKU_NODES=5
export NUM_GOWAKU_NODES=5 export NUM_GOWAKU_NODES=0
export MSG_PER_SECOND=10 export TRAFFIC_DELAY_SECONDS=15
export MSG_SIZE_KBYTES=10 export MSG_SIZE_KBYTES=10
docker-compose up -d docker-compose up -d
``` ```
@ -28,7 +28,7 @@ This will:
* spin up grafana/prometheus for monitoring, see `http://localhost:3000`. * spin up grafana/prometheus for monitoring, see `http://localhost:3000`.
* spin up a bootstrap nwaku node. * spin up a bootstrap nwaku node.
* spin up a given amount of nwaku/gowaku nodes with specific versions. * spin up a given amount of nwaku/gowaku nodes with specific versions.
* spin up a `waku-publisher` instance that will inject traffic into the network (see flags for rate and msg size) * spin up a `rest-traffic` instance that will inject traffic into the network (see flags for rate and msg size)
## notes ## notes
@ -42,6 +42,12 @@ in case arp tables are overflowing:
sysctl net.ipv4.neigh.default.gc_thresh3=32000 sysctl net.ipv4.neigh.default.gc_thresh3=32000
``` ```
Compose V2 users should spin up the containers with the following command:
```
docker-compose --compatibility up -d
```
# Infrastructure # Infrastructure
An instance of this service is deployed at https://simulator.waku.org/. An instance of this service is deployed at https://simulator.waku.org/.

View File

@ -1,6 +1,5 @@
version: "3.7" version: "3.7"
networks: networks:
simulation: simulation:
driver: bridge driver: bridge
@ -62,17 +61,21 @@ services:
depends_on: depends_on:
- bootstrap - bootstrap
waku-publisher: rest-traffic:
image: alrevuelta/waku-publisher:9fb206c build:
entrypoint: sh context: .
- 'opt/run_wakupublisher.sh' dockerfile: Dockerfile.rest-traffic
command: >
python /opt/traffic.py
--multiple-nodes=http://waku-simulator_nwaku_[1..$NUM_NWAKU_NODES]:8645
--msg-size-kbytes=${MSG_SIZE_KBYTES:-10}
--delay-seconds=${TRAFFIC_DELAY_SECONDS:-15}
volumes: volumes:
- ./run_wakupublisher.sh:/opt/run_wakupublisher.sh:Z - ./traffic.py:/opt/traffic.py:Z
environment:
MSG_PER_SECOND: 10
MSG_SIZE_KBYTES: 10
networks: networks:
- simulation - simulation
depends_on:
- nwaku
prometheus: prometheus:
image: prom/prometheus:latest image: prom/prometheus:latest

File diff suppressed because it is too large Load Diff

View File

@ -4,6 +4,13 @@ IP=$(ip a | grep "inet " | grep -Fv 127.0.0.1 | sed 's/.*inet \([^/]*\).*/\1/')
echo "I am a nwaku node" echo "I am a nwaku node"
# Get an unique node index based on the container's IP
FOURTH_OCTET=${IP##*.}
THIRD_OCTET="${IP%.*}"; THIRD_OCTET="${THIRD_OCTET##*.}"
NODE_INDEX=$((FOURTH_OCTET + 256 * THIRD_OCTET))
echo "NODE_INDEX $NODE_INDEX"
RETRIES=${RETRIES:=10} RETRIES=${RETRIES:=10}
while [ -z "${BOOTSTRAP_ENR}" ] && [ ${RETRIES} -ge 0 ]; do while [ -z "${BOOTSTRAP_ENR}" ] && [ ${RETRIES} -ge 0 ]; do
@ -23,6 +30,14 @@ exec /usr/bin/wakunode\
--relay=true\ --relay=true\
--rpc-admin=true\ --rpc-admin=true\
--max-connections=250\ --max-connections=250\
--rpc-address=0.0.0.0\
--rest=true\
--rest-admin=true\
--rest-private=true\
--rest-address=0.0.0.0\
--rln-relay=true\
--rln-relay-dynamic=false\
--rln-relay-membership-index=${NODE_INDEX}\
--dns-discovery=true\ --dns-discovery=true\
--discv5-discovery=true\ --discv5-discovery=true\
--discv5-enr-auto-update=True\ --discv5-enr-auto-update=True\

0
run_wakupublisher.sh Executable file → Normal file
View File

File diff suppressed because one or more lines are too long