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.
```
export GOWAKU_IMAGE=statusteam/go-waku:latest
export NWAKU_IMAGE=statusteam/nim-waku:v0.18.0-rc.0
export GOWAKU_IMAGE=wakuorg/go-waku:latest
export NWAKU_IMAGE=wakuorg/nwaku:v0.21.2-rc.0
export NUM_NWAKU_NODES=5
export NUM_GOWAKU_NODES=5
export MSG_PER_SECOND=10
export NUM_GOWAKU_NODES=0
export TRAFFIC_DELAY_SECONDS=15
export MSG_SIZE_KBYTES=10
docker-compose up -d
```
@ -28,7 +28,7 @@ This will:
* spin up grafana/prometheus for monitoring, see `http://localhost:3000`.
* spin up a bootstrap nwaku node.
* 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
@ -42,6 +42,12 @@ in case arp tables are overflowing:
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
An instance of this service is deployed at https://simulator.waku.org/.

View File

@ -1,6 +1,5 @@
version: "3.7"
networks:
simulation:
driver: bridge
@ -62,17 +61,21 @@ services:
depends_on:
- bootstrap
waku-publisher:
image: alrevuelta/waku-publisher:9fb206c
entrypoint: sh
- 'opt/run_wakupublisher.sh'
rest-traffic:
build:
context: .
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:
- ./run_wakupublisher.sh:/opt/run_wakupublisher.sh:Z
environment:
MSG_PER_SECOND: 10
MSG_SIZE_KBYTES: 10
- ./traffic.py:/opt/traffic.py:Z
networks:
- simulation
depends_on:
- nwaku
prometheus:
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"
# 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}
while [ -z "${BOOTSTRAP_ENR}" ] && [ ${RETRIES} -ge 0 ]; do
@ -23,6 +30,14 @@ exec /usr/bin/wakunode\
--relay=true\
--rpc-admin=true\
--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\
--discv5-discovery=true\
--discv5-enr-auto-update=True\

2
run_wakupublisher.sh Executable file → Normal file
View File

@ -25,4 +25,4 @@ exec /main\
--msg-per-second=${MSG_PER_SECOND}\
--msg-size-kb=${MSG_SIZE_KBYTES}\
--bootstrap-node=${BOOTSTRAP_ENR}\
--max-peers=50
--max-peers=50

File diff suppressed because one or more lines are too long