From 3f2c847d2b3a5446d5671d7781760fbfb5dbc304 Mon Sep 17 00:00:00 2001 From: Howard Wu <9260812+howardwu@users.noreply.github.com> Date: Sat, 21 Oct 2023 15:38:12 -0700 Subject: [PATCH] Update commands --- .devnet/README.md | 36 ++++++++++++++++++++++++++++++++++++ .devnet/monitor.sh | 2 +- .devnet/start.sh | 16 ++++++++-------- README.md | 2 +- build_ubuntu.sh | 1 + 5 files changed, 47 insertions(+), 10 deletions(-) diff --git a/.devnet/README.md b/.devnet/README.md index ee1917c8b3..c6b407d77d 100644 --- a/.devnet/README.md +++ b/.devnet/README.md @@ -95,6 +95,42 @@ This script starts snarkOS on the EC2 instances. This script monitors the EC2 instances. +#### Switch Nodes (forward) + +To toggle to the next node in a local devnet, run: +``` +Ctrl+b n +``` + +#### Switch Nodes (backwards) + +To toggle to the previous node in a local devnet, run: +``` +Ctrl+b p +``` + +#### Select a Node (choose-tree) + +To select a node in a local devnet, run: +``` +Ctrl+b w +``` + +#### Select a Node (manually) + +To select a node manually in a local devnet, run: +``` +Ctrl+b :select-window -t {NODE_ID} +``` + +#### Exit (But Keeps the Devnet Running) + +To exit the monitor, run: +``` +Ctrl+b :kill-session +``` +Then, press `Enter`. + ## 6. `stop.sh` This script stops snarkOS on the EC2 instances. diff --git a/.devnet/monitor.sh b/.devnet/monitor.sh index 97da8171b5..bfa5dd5f98 100755 --- a/.devnet/monitor.sh +++ b/.devnet/monitor.sh @@ -30,7 +30,7 @@ tmux attach-session -t "devnet-aws" #read -p "Enter the node ID (default: 0): " NODE_ID #NODE_ID="${NODE_ID:-0}" # -## SSH into the node and attach to the SnarkOS tmux session +## SSH into the node and attach to the snarkOS tmux session ##ssh -o StrictHostKeyChecking=no aws-n$NODE_ID << EOF ## # Commands to run on the remote instance ## sudo -i # Switch to root user diff --git a/.devnet/start.sh b/.devnet/start.sh index 86b27bea8b..3743e618bd 100755 --- a/.devnet/start.sh +++ b/.devnet/start.sh @@ -7,36 +7,36 @@ NUM_INSTANCES="${NUM_INSTANCES:-16}" # Get the IP address of NODE 0 from the SSH config for aws-n0 NODE_0_IP=$(awk '/Host aws-n0/{f=1} f&&/HostName/{print $2; exit}' ~/.ssh/config) -# Define a function to start SnarkOS in a tmux session on a node +# Define a function to start snarkOS in a tmux session on a node start_snarkos_in_tmux() { local NODE_ID=$1 local NODE_IP=$2 - # SSH into the node and start SnarkOS in a new tmux session + # SSH into the node and start snarkOS in a new tmux session ssh -o StrictHostKeyChecking=no aws-n$NODE_ID << EOF # Commands to run on the remote instance sudo -i # Switch to root user WORKSPACE=~/snarkOS cd \$WORKSPACE - # Start SnarkOS within a new tmux session named "snarkos-session" + # Start snarkOS within a new tmux session named "snarkos-session" tmux new-session -d -s snarkos-session - # Send the SnarkOS start command to the tmux session with the NODE_ID - tmux send-keys -t "snarkos-session" "snarkos start --nodisplay --dev $NODE_ID --dev-num-validators $NUM_INSTANCES --validator --validators $NODE_IP" C-m + # Send the snarkOS start command to the tmux session with the NODE_ID + tmux send-keys -t "snarkos-session" "snarkos start --nodisplay --bft 0.0.0.0:5000 --dev $NODE_ID --dev-num-validators $NUM_INSTANCES --validator --validators $NODE_IP:5000" C-m exit # Exit root user EOF # Check the exit status of the SSH command if [ $? -eq 0 ]; then - echo "SnarkOS started successfully in a tmux session on aws-n$NODE_ID." + echo "snarkOS started successfully in a tmux session on aws-n$NODE_ID." else - echo "Failed to start SnarkOS in a tmux session on aws-n$NODE_ID." + echo "Failed to start snarkOS in a tmux session on aws-n$NODE_ID." fi } -# Loop through aws-n nodes and start SnarkOS in tmux sessions in parallel +# Loop through aws-n nodes and start snarkOS in tmux sessions in parallel for NODE_ID in $(seq 0 $NUM_INSTANCES); do start_snarkos_in_tmux $NODE_ID "$NODE_0_IP" & done diff --git a/README.md b/README.md index 33871176da..bc89b3f94e 100644 --- a/README.md +++ b/README.md @@ -336,7 +336,7 @@ cargo run --release -- clean --dev ``` ## 7. Contributors -Thank you for helping make SnarkOS better! +Thank you for helping make snarkOS better! [🧐 What do the emojis mean?](https://allcontributors.org/docs/en/emoji-key) diff --git a/build_ubuntu.sh b/build_ubuntu.sh index 9af31a2e5c..b388d4d31d 100755 --- a/build_ubuntu.sh +++ b/build_ubuntu.sh @@ -45,5 +45,6 @@ echo " for 4133 and 3033 on your router." echo "==================================================" # Open ports on system +ufw allow 5000/tcp ufw allow 4133/tcp ufw allow 3033/tcp