Merge pull request #4322 from nymtech/update-localnet-script

Check that localnet is running fromt the scripts dir
This commit is contained in:
Tommy Verrall
2024-01-15 13:43:27 +01:00
committed by GitHub
+14 -5
View File
@@ -2,6 +2,15 @@
set -o errexit
# check that current folder ends with scripts
current_folder=$(basename "$(pwd)")
# Check if the current folder ends with "scripts"
if [[ $current_folder != *scripts ]]; then
echo "Please run this from the 'scripts' folder"
exit
fi
# can't just use `mktemp` since syntax differs between linux and macos (thx apple)
suffix=$(openssl rand -base64 10 | tr -dc 'a-zA-Z0-9')
localnetdir="$HOME/.nym/localnets/localnet.$suffix"
@@ -11,16 +20,16 @@ echo "Using $localnetdir for the localnet"
# initialise mixnet
echo "initialising mixnode1..."
cargo run --release --bin nym-mixnode -- init --id "mix1-$suffix" --host 127.0.0.1 --mix-port 10001 --verloc-port 20001 --http-api-port 30001 --output=json >> "$localnetdir/mix1.json"
cargo run --release --bin nym-mixnode -- init --id "mix1-$suffix" --host 127.0.0.1 --mix-port 10001 --verloc-port 20001 --http-api-port 30001 --output=json >>"$localnetdir/mix1.json"
echo "initialising mixnode2..."
cargo run --release --bin nym-mixnode -- init --id "mix2-$suffix" --host 127.0.0.1 --mix-port 10002 --verloc-port 20002 --http-api-port 30002 --output=json >> "$localnetdir/mix2.json"
cargo run --release --bin nym-mixnode -- init --id "mix2-$suffix" --host 127.0.0.1 --mix-port 10002 --verloc-port 20002 --http-api-port 30002 --output=json >>"$localnetdir/mix2.json"
echo "initialising mixnode3..."
cargo run --release --bin nym-mixnode -- init --id "mix3-$suffix" --host 127.0.0.1 --mix-port 10003 --verloc-port 20003 --http-api-port 30003 --output=json >> "$localnetdir/mix3.json"
cargo run --release --bin nym-mixnode -- init --id "mix3-$suffix" --host 127.0.0.1 --mix-port 10003 --verloc-port 20003 --http-api-port 30003 --output=json >>"$localnetdir/mix3.json"
echo "initialising gateway..."
cargo run --release --bin nym-gateway -- init --id "gateway-$suffix" --host 127.0.0.1 --mix-port 10004 --clients-port 9000 --output=json >> "$localnetdir/gateway.json"
cargo run --release --bin nym-gateway -- init --id "gateway-$suffix" --host 127.0.0.1 --mix-port 10004 --clients-port 9000 --output=json >>"$localnetdir/gateway.json"
# build the topology
echo "combining json files..."
@@ -47,7 +56,7 @@ echo "nym-gateway launched"
# initialise the clients
echo "initialising network requester..."
cargo run --release --bin nym-network-requester -- init --id "network-requester-$suffix" --open-proxy=true --custom-mixnet "$networkfile" --output=json >> "$localnetdir/network_requester.json"
cargo run --release --bin nym-network-requester -- init --id "network-requester-$suffix" --open-proxy=true --custom-mixnet "$networkfile" --output=json >>"$localnetdir/network_requester.json"
address=$(jq -r .client_address "$localnetdir/network_requester.json")
echo "initialising socks5 client..."