diff --git a/docker-compose.yml b/docker-compose.yml index 8fbb234..90b55a0 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -66,7 +66,7 @@ services: dockerfile: Dockerfile.rest-traffic command: > python /opt/traffic.py - -mn=${TRAFFIC_MULTIPLE_NODES:-http://waku-simulator_nwaku_[1..5]:8645} + -mn=${TRAFFIC_MULTIPLE_NODES:-http://waku-simulator_nwaku_[1..$NUM_NWAKU_NODES]:8645} -s=${TRAFFIC_MESSAGE_SIZE_KB:-10} -d=${TRAFFIC_DELAY_SECONDS:-15} volumes: diff --git a/run_nwaku.sh b/run_nwaku.sh index 2a69a73..ef259d0 100755 --- a/run_nwaku.sh +++ b/run_nwaku.sh @@ -4,12 +4,11 @@ IP=$(ip a | grep "inet " | grep -Fv 127.0.0.1 | sed 's/.*inet \([^/]*\).*/\1/') echo "My container name is: $HOSTNAME" +# 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 "FOURTH_OCTET $FOURTH_OCTET" -echo "THIRD_OCTET $THIRD_OCTET" echo "NODE_INDEX $NODE_INDEX" echo "$IP" @@ -38,9 +37,9 @@ exec /usr/bin/wakunode\ --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}\ + --rln-relay=true\ + --rln-relay-dynamic=false\ + --rln-relay-membership-index=${NODE_INDEX}\ --dns-discovery=true\ --discv5-discovery=true\ --discv5-enr-auto-update=True\ diff --git a/traffic.py b/traffic.py index 834ccea..e674d12 100644 --- a/traffic.py +++ b/traffic.py @@ -38,7 +38,6 @@ def send_waku_msg(node_address, kbytes, pubsub_topic, content_topic): if(response != None): elapsed_ms = (time.time() - s_time) * 1000 - print(response.status_code, response.text) print('Response from %s: status:%s content:%s [%.4f ms.]' % (node_address, \ response.status_code, response.text, elapsed_ms))