mirror of
https://github.com/logos-messaging/logos-messaging-simulator.git
synced 2026-01-02 14:03:07 +00:00
modifications to remove rln for adhoc debugging of other features
This commit is contained in:
parent
77d37c96ba
commit
84da715708
@ -12,46 +12,46 @@ services:
|
||||
|
||||
# Accounts are hardcoded to 520 with the idea that nwaku nodes use up to 500 for membership registration and the last 20 are used for ad-hoc testing.
|
||||
# The account number and private key pairs of the last 20 accounts can be found in the Register memberships section of the Waku-simulator book.
|
||||
foundry:
|
||||
image: ghcr.io/foundry-rs/foundry:nightly-9b73e06e1fe376738b92ae081107620291d50188
|
||||
labels:
|
||||
com.centurylinklabs.watchtower.enable: '${WATCHTOWER_ENABLED:-false}'
|
||||
ports:
|
||||
- 0.0.0.0:8545:8545
|
||||
command:
|
||||
- anvil
|
||||
--port=8545
|
||||
--host=0.0.0.0
|
||||
--accounts=520
|
||||
--allow-origin=*
|
||||
--block-time=12
|
||||
--chain-id=1234
|
||||
--silent
|
||||
--config-out=/shared/anvil-config.txt
|
||||
volumes:
|
||||
- privatekeys-volume:/shared
|
||||
networks:
|
||||
- simulation
|
||||
# foundry:
|
||||
# image: ghcr.io/foundry-rs/foundry:v0.3.0
|
||||
# labels:
|
||||
# com.centurylinklabs.watchtower.enable: '${WATCHTOWER_ENABLED:-false}'
|
||||
# ports:
|
||||
# - 0.0.0.0:8545:8545
|
||||
# command:
|
||||
# - anvil
|
||||
# --port=8545
|
||||
# --host=0.0.0.0
|
||||
# --accounts=520
|
||||
# --allow-origin=*
|
||||
# --block-time=12
|
||||
# --chain-id=1234
|
||||
# --silent
|
||||
# --config-out=/shared/anvil-config.txt
|
||||
# volumes:
|
||||
# - privatekeys-volume:/shared
|
||||
# networks:
|
||||
# - simulation
|
||||
|
||||
contract-repo-deployer:
|
||||
image: node:hydrogen-bullseye
|
||||
labels:
|
||||
com.centurylinklabs.watchtower.enable: '${WATCHTOWER_ENABLED:-false}'
|
||||
environment:
|
||||
- RLN_CONTRACT_REPO_COMMIT=${RLN_CONTRACT_REPO_COMMIT:-64df4593c6a14e43b8b0e9b396d2f4772bb08b34}
|
||||
- PRIVATE_KEY=${PRIVATE_KEY}
|
||||
- RPC_URL=${RPC_URL:-http://foundry:8545}
|
||||
- ETH_FROM=${ETH_FROM}
|
||||
- MAX_MESSAGE_LIMIT=${MAX_MESSAGE_LIMIT:-20}
|
||||
entrypoint: sh
|
||||
command:
|
||||
- '/opt/deploy_rln_contract.sh'
|
||||
volumes:
|
||||
- ./deploy_rln_contract.sh:/opt/deploy_rln_contract.sh
|
||||
depends_on:
|
||||
- foundry
|
||||
networks:
|
||||
- simulation
|
||||
# contract-repo-deployer:
|
||||
# image: node:hydrogen-bullseye
|
||||
# labels:
|
||||
# com.centurylinklabs.watchtower.enable: '${WATCHTOWER_ENABLED:-false}'
|
||||
# environment:
|
||||
# - RLN_CONTRACT_REPO_COMMIT=${RLN_CONTRACT_REPO_COMMIT:-64df4593c6a14e43b8b0e9b396d2f4772bb08b34}
|
||||
# - PRIVATE_KEY=${PRIVATE_KEY}
|
||||
# - RPC_URL=${RPC_URL:-http://foundry:8545}
|
||||
# - ETH_FROM=${ETH_FROM}
|
||||
# - MAX_MESSAGE_LIMIT=${MAX_MESSAGE_LIMIT:-20}
|
||||
# entrypoint: sh
|
||||
# command:
|
||||
# - '/opt/deploy_rln_contract.sh'
|
||||
# volumes:
|
||||
# - ./deploy_rln_contract.sh:/opt/deploy_rln_contract.sh
|
||||
# depends_on:
|
||||
# - foundry
|
||||
# networks:
|
||||
# - simulation
|
||||
|
||||
bootstrap:
|
||||
image: ${NWAKU_IMAGE:-wakuorg/nwaku:latest}
|
||||
@ -93,8 +93,7 @@ services:
|
||||
- ./run_nwaku.sh:/opt/run_nwaku.sh:Z
|
||||
- privatekeys-volume:/shared
|
||||
depends_on:
|
||||
contract-repo-deployer:
|
||||
condition: service_completed_successfully
|
||||
- bootstrap
|
||||
networks:
|
||||
- simulation
|
||||
|
||||
@ -168,71 +167,71 @@ services:
|
||||
networks:
|
||||
- simulation
|
||||
|
||||
api:
|
||||
image: web3labs/epirus-free-api:latest
|
||||
ports:
|
||||
- 127.0.0.1:8090:8090
|
||||
environment:
|
||||
- NODE_ENDPOINT=${RPC_URL:-http://foundry:8545}
|
||||
- MONGO_CLIENT_URI=mongodb://mongodb:27017
|
||||
- REINDEX_ENDPOINT=http://ingestion/reindex/
|
||||
- MONGO_DB_NAME=epirus
|
||||
- MONGO_CREATE_INDICES=true
|
||||
- REDIS_HOST=redis
|
||||
- REDIS_PORT=6379
|
||||
depends_on:
|
||||
- redis
|
||||
- mongodb
|
||||
- foundry
|
||||
networks:
|
||||
- simulation
|
||||
# api:
|
||||
# image: web3labs/epirus-free-api:latest
|
||||
# ports:
|
||||
# - 127.0.0.1:8090:8090
|
||||
# environment:
|
||||
# - NODE_ENDPOINT=${RPC_URL:-http://foundry:8545}
|
||||
# - MONGO_CLIENT_URI=mongodb://mongodb:27017
|
||||
# - REINDEX_ENDPOINT=http://ingestion/reindex/
|
||||
# - MONGO_DB_NAME=epirus
|
||||
# - MONGO_CREATE_INDICES=true
|
||||
# - REDIS_HOST=redis
|
||||
# - REDIS_PORT=6379
|
||||
# depends_on:
|
||||
# - redis
|
||||
# - mongodb
|
||||
# - foundry
|
||||
# networks:
|
||||
# - simulation
|
||||
|
||||
mongodb:
|
||||
image: mongo:5.0.8
|
||||
environment:
|
||||
- COMPOSE_HTTP_TIMEOUT=900
|
||||
- DOCKER_CLIENT_TIMEOUT=900
|
||||
entrypoint: mongod --bind_ip "0.0.0.0"
|
||||
networks:
|
||||
- simulation
|
||||
# mongodb:
|
||||
# image: mongo:5.0.8
|
||||
# environment:
|
||||
# - COMPOSE_HTTP_TIMEOUT=900
|
||||
# - DOCKER_CLIENT_TIMEOUT=900
|
||||
# entrypoint: mongod --bind_ip "0.0.0.0"
|
||||
# networks:
|
||||
# - simulation
|
||||
|
||||
web:
|
||||
image: web3labs/epirus-free-web:latest
|
||||
environment:
|
||||
- API_URL=${EPIRUS_WEB_API_URL:-/api}
|
||||
- WS_API_URL=${EPIRUS_WEB_WS_API_URL:-ws://localhost:8090}
|
||||
- DISPLAY_NETWORK_TAB=disabled
|
||||
depends_on:
|
||||
- api
|
||||
networks:
|
||||
- simulation
|
||||
# web:
|
||||
# image: web3labs/epirus-free-web:latest
|
||||
# environment:
|
||||
# - API_URL=${EPIRUS_WEB_API_URL:-/api}
|
||||
# - WS_API_URL=${EPIRUS_WEB_WS_API_URL:-ws://localhost:8090}
|
||||
# - DISPLAY_NETWORK_TAB=disabled
|
||||
# depends_on:
|
||||
# - api
|
||||
# networks:
|
||||
# - simulation
|
||||
|
||||
ingestion:
|
||||
image: web3labs/epirus-free-ingestion:latest
|
||||
environment:
|
||||
- NODE_ENDPOINT=${RPC_URL:-http://foundry:8545}
|
||||
- MONGO_CLIENT_URI=mongodb://mongodb:27017
|
||||
- MONGO_DB_NAME=epirus
|
||||
- LIST_OF_METRICS_TO_CALCULATE_PER_MINUTE=hourly,daily,monthly,yearly
|
||||
depends_on:
|
||||
- mongodb
|
||||
- redis
|
||||
- foundry
|
||||
networks:
|
||||
- simulation
|
||||
# ingestion:
|
||||
# image: web3labs/epirus-free-ingestion:latest
|
||||
# environment:
|
||||
# - NODE_ENDPOINT=${RPC_URL:-http://foundry:8545}
|
||||
# - MONGO_CLIENT_URI=mongodb://mongodb:27017
|
||||
# - MONGO_DB_NAME=epirus
|
||||
# - LIST_OF_METRICS_TO_CALCULATE_PER_MINUTE=hourly,daily,monthly,yearly
|
||||
# depends_on:
|
||||
# - mongodb
|
||||
# - redis
|
||||
# - foundry
|
||||
# networks:
|
||||
# - simulation
|
||||
|
||||
nginx:
|
||||
image: nginx:latest
|
||||
volumes:
|
||||
- ./nginx.conf:/etc/nginx/nginx.conf
|
||||
- ./5xx.html:/www/error_pages/5xx.html
|
||||
ports:
|
||||
- 0.0.0.0:3000:80
|
||||
depends_on:
|
||||
- api
|
||||
- web
|
||||
networks:
|
||||
- simulation
|
||||
# nginx:
|
||||
# image: nginx:latest
|
||||
# volumes:
|
||||
# - ./nginx.conf:/etc/nginx/nginx.conf
|
||||
# - ./5xx.html:/www/error_pages/5xx.html
|
||||
# ports:
|
||||
# - 0.0.0.0:3000:80
|
||||
# depends_on:
|
||||
# - api
|
||||
# - web
|
||||
# networks:
|
||||
# - simulation
|
||||
|
||||
volumes:
|
||||
privatekeys-volume:
|
||||
185
run_nwaku.sh
185
run_nwaku.sh
@ -2,110 +2,110 @@
|
||||
|
||||
# Check Linux Distro Version - it can differ depending on the nwaku image used
|
||||
OS=$(cat /etc/os-release)
|
||||
if echo $OS | grep -q "Debian"; then
|
||||
echo "The operating system is Debian."
|
||||
apt update
|
||||
apt install -y dnsutils
|
||||
apt install -y jq
|
||||
elif echo $OS | grep -q "Alpine"; then
|
||||
echo "The operating system is Alpine."
|
||||
apk add bind-tools
|
||||
apk add jq
|
||||
fi
|
||||
# if echo $OS | grep -q "Debian"; then
|
||||
# echo "The operating system is Debian."
|
||||
# apt update
|
||||
# apt install -y dnsutils
|
||||
# apt install -y jq
|
||||
# elif echo $OS | grep -q "Alpine"; then
|
||||
# echo "The operating system is Alpine."
|
||||
# apk add bind-tools
|
||||
# apk add jq
|
||||
# fi
|
||||
|
||||
if test -f .env; then
|
||||
echo "Using .env file"
|
||||
. $(pwd)/.env
|
||||
fi
|
||||
# if test -f .env; then
|
||||
# echo "Using .env file"
|
||||
# . $(pwd)/.env
|
||||
# fi
|
||||
|
||||
IP=$(ip a | grep "inet " | grep -Fv 127.0.0.1 | sed 's/.*inet \([^/]*\).*/\1/')
|
||||
|
||||
# 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
|
||||
local domain_name=$(echo $RPC_URL | awk -F[/:] '{print $4}')
|
||||
local ip_address=$(dig +short $domain_name)
|
||||
valid_rpc_url="$(echo "$url" | sed "s/$domain_name/$ip_address/g")"
|
||||
echo $valid_rpc_url
|
||||
}
|
||||
# # 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
|
||||
# local domain_name=$(echo $RPC_URL | awk -F[/:] '{print $4}')
|
||||
# local ip_address=$(dig +short $domain_name)
|
||||
# valid_rpc_url="$(echo "$url" | sed "s/$domain_name/$ip_address/g")"
|
||||
# echo $valid_rpc_url
|
||||
# }
|
||||
|
||||
# the format of the RPC URL is checked in the generateRlnKeystore command and hostnames are not valid
|
||||
pattern="^(https?):\/\/((localhost)|([\w_-]+(?:(?:\.[\w_-]+)+)))(:[0-9]{1,5})?([\w.,@?^=%&:\/~+#-]*[\w@?^=%&\/~+#-])*"
|
||||
# Perform regex matching
|
||||
if echo "$RPC_URL" | grep -q "$pattern"; then
|
||||
echo "RPC URL is valid"
|
||||
else
|
||||
echo "RPC URL is invalid: $RPC_URL. Attempting to resolve hostname."
|
||||
resolved_rpc_url="$(get_ip_address_and_replace $RPC_URL)"
|
||||
if [ -z "$resolved_rpc_url" ]; then
|
||||
echo -e "Failed to retrieve IP address for $RPC_URL\n"
|
||||
else
|
||||
echo -e "Resolved RPC URL for $RPC_URL: $resolved_rpc_url"
|
||||
RPC_URL="$resolved_rpc_url"
|
||||
fi
|
||||
fi
|
||||
# # the format of the RPC URL is checked in the generateRlnKeystore command and hostnames are not valid
|
||||
# pattern="^(https?):\/\/((localhost)|([\w_-]+(?:(?:\.[\w_-]+)+)))(:[0-9]{1,5})?([\w.,@?^=%&:\/~+#-]*[\w@?^=%&\/~+#-])*"
|
||||
# # Perform regex matching
|
||||
# if echo "$RPC_URL" | grep -q "$pattern"; then
|
||||
# echo "RPC URL is valid"
|
||||
# else
|
||||
# echo "RPC URL is invalid: $RPC_URL. Attempting to resolve hostname."
|
||||
# resolved_rpc_url="$(get_ip_address_and_replace $RPC_URL)"
|
||||
# if [ -z "$resolved_rpc_url" ]; then
|
||||
# echo -e "Failed to retrieve IP address for $RPC_URL\n"
|
||||
# else
|
||||
# echo -e "Resolved RPC URL for $RPC_URL: $resolved_rpc_url"
|
||||
# RPC_URL="$resolved_rpc_url"
|
||||
# fi
|
||||
# fi
|
||||
|
||||
#Function to get the index of the container and use it to retrieve a private key to be used to generate the keystore, allowing for either dash or underscore container name format (for docker-compose backward compatibility)
|
||||
get_private_key(){
|
||||
# #Function to get the index of the container and use it to retrieve a private key to be used to generate the keystore, allowing for either dash or underscore container name format (for docker-compose backward compatibility)
|
||||
# get_private_key(){
|
||||
|
||||
# Read the JSON file
|
||||
json_content=$(cat /shared/anvil-config.txt)
|
||||
# # Read the JSON file
|
||||
# json_content=$(cat /shared/anvil-config.txt)
|
||||
|
||||
# Check if json_content has a value
|
||||
if [ -z "$json_content" ]; then
|
||||
echo "Error: Failed to read the JSON file or the file is empty." >&2
|
||||
return 1
|
||||
fi
|
||||
# # Check if json_content has a value
|
||||
# if [ -z "$json_content" ]; then
|
||||
# echo "Error: Failed to read the JSON file or the file is empty." >&2
|
||||
# return 1
|
||||
# fi
|
||||
|
||||
# Extract private_keys json array using jq
|
||||
private_keys=$(echo "$json_content" | jq -r '.private_keys[]')
|
||||
# # Extract private_keys json array using jq
|
||||
# private_keys=$(echo "$json_content" | jq -r '.private_keys[]')
|
||||
|
||||
CNTR=`dig -x $IP +short | cut -d'.' -f1`
|
||||
INDEX=`echo $CNTR | sed 's/.*[-_]\([0-9]*\)/\1/'`
|
||||
# CNTR=`dig -x $IP +short | cut -d'.' -f1`
|
||||
# INDEX=`echo $CNTR | sed 's/.*[-_]\([0-9]*\)/\1/'`
|
||||
|
||||
if [ $? -ne 0 ] || [ -z "$INDEX" ]; then
|
||||
echo "Error: Failed to determine the replica index from IP." >&2
|
||||
return 1
|
||||
fi
|
||||
# if [ $? -ne 0 ] || [ -z "$INDEX" ]; then
|
||||
# echo "Error: Failed to determine the replica index from IP." >&2
|
||||
# return 1
|
||||
# fi
|
||||
|
||||
|
||||
# iterate through list of private keys and get the one corresponding to the container index
|
||||
# we need to iterate because array objects cannot be used in /bin/ash (Alpine) and a separate script would need to be called to use bash
|
||||
current_index=1
|
||||
for key in $private_keys
|
||||
do
|
||||
if [ $current_index -eq $INDEX ]; then
|
||||
pk=$key
|
||||
echo $key
|
||||
break
|
||||
fi
|
||||
current_index=$((current_index+1))
|
||||
done
|
||||
# # iterate through list of private keys and get the one corresponding to the container index
|
||||
# # we need to iterate because array objects cannot be used in /bin/ash (Alpine) and a separate script would need to be called to use bash
|
||||
# current_index=1
|
||||
# for key in $private_keys
|
||||
# do
|
||||
# if [ $current_index -eq $INDEX ]; then
|
||||
# pk=$key
|
||||
# echo $key
|
||||
# break
|
||||
# fi
|
||||
# current_index=$((current_index+1))
|
||||
# done
|
||||
|
||||
if [ -z "$pk" ]; then
|
||||
echo "Error: Failed to get private key for the container with index=$INDEX." >&2
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
# if [ -z "$pk" ]; then
|
||||
# echo "Error: Failed to get private key for the container with index=$INDEX." >&2
|
||||
# return 1
|
||||
# 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 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 \
|
||||
--rln-relay-epoch-sec=$RLN_RELAY_EPOCH_SEC \
|
||||
--log-level=DEBUG \
|
||||
--execute
|
||||
fi
|
||||
# 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 \
|
||||
# --rln-relay-epoch-sec=$RLN_RELAY_EPOCH_SEC \
|
||||
# --log-level=DEBUG \
|
||||
# --execute
|
||||
# fi
|
||||
|
||||
echo "I am a nwaku node"
|
||||
|
||||
@ -131,15 +131,6 @@ exec /usr/bin/wakunode\
|
||||
--rest=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\
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user