From bdc7dabda83a88d681ebf55650a89f22e820c8ad Mon Sep 17 00:00:00 2001 From: 0xOzgur <29779769+0xOzgur@users.noreply.github.com> Date: Sun, 2 Jun 2024 03:40:26 +0300 Subject: [PATCH 01/22] git fix --- install/install_quilibrium_service.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/install/install_quilibrium_service.sh b/install/install_quilibrium_service.sh index 2d327e4..094c2e7 100644 --- a/install/install_quilibrium_service.sh +++ b/install/install_quilibrium_service.sh @@ -82,6 +82,7 @@ else done fi cd ~/ceremonyclient/ +git remote set-url origin https://source.quilibrium.com/quilibrium/ceremonyclient.git || git remote set-url origin https://git.quilibrium-mirror.ch/agostbiro/ceremonyclient.git git checkout release # Set the version number From ffb5e52aa7349acc11aeeb99c452e34f20d928f6 Mon Sep 17 00:00:00 2001 From: 0xOzgur <29779769+0xOzgur@users.noreply.github.com> Date: Sun, 2 Jun 2024 04:20:15 +0300 Subject: [PATCH 02/22] visibility check script added --- visibility_check.sh | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 visibility_check.sh diff --git a/visibility_check.sh b/visibility_check.sh new file mode 100644 index 0000000..a919db8 --- /dev/null +++ b/visibility_check.sh @@ -0,0 +1,34 @@ +#!/bin/bash + +# Bootstrap peer list +specific_peers=( +"EiDpYbDwT2rZq70JNJposqAC+vVZ1t97pcHbK8kr5G4ZNA==" +"EiCcVN/KauCidn0nNDbOAGMHRZ5psz/lthpbBeiTAUEfZQ==" +"EiDhVHjQKgHfPDXJKWykeUflcXtOv6O2lvjbmUnRrbT2mw==" +"EiDHhTNA0yf07ljH+gTn0YEk/edCF70gQqr7QsUr8RKbAA==" +"EiAnwhEcyjsHiU6cDCjYJyk/1OVsh6ap7E3vDfJvefGigw==" +"EiB75ZnHtAOxajH2hlk9wD1i9zVigrDKKqYcSMXBkKo4SA==" +"EiDEYNo7GEfMhPBbUo+zFSGeDECB0RhG0GfAasdWp2TTTQ==" +"EiCzMVQnCirB85ITj1x9JOEe4zjNnnFIlxuXj9m6kGq1SQ==" +"EiD1ClZn/lr+n/gnS96Q4gKwBDk3yl33kNIhx9wUxJiyEA==" +"EiD7C6nsh1456MTlTihUrDqO4tLn/wcbF1HXM5V7P5GXEQ==" +"EiDUezzC3QCy6pNVg6+L9l0rH6CVIQSqxEKAGMSQJqnO1g==" +"EiDLg4I2+SAV7f0dUfT/qwDJWAstv1CAYmbhvJG3LxrgZw==" +"EiALqqXPhdT+LWlx2cbx3vYiFGxeUhv+KgyhE+MT8g7fLg==" +"EiAhM5Eo0QoOQVPCJqrDCC+qe+Kx3kGohU5q+1rb5voD7A==" +"EiC3Li+DpEtPnomK9KWzAWtW7XUzVKUewNVrURiKSeWsfg==" +"EiBaq9Jsbu2vW+rFVrqI288t298TJUy+/xv8IF3V8uN1Xg==" +"EiAkOMWQQAGlDDINXrhSJmnwi0LVdkFv1wLGtrp3FrYxPg==" +) + +# Run the grpcurl command and capture its output +output=$(grpcurl -plaintext localhost:8337 quilibrium.node.node.pb.NodeService.GetNetworkInfo) + +# Check if any of the specific peers are in the output +for peer in "${specific_peers[@]}"; do + if [[ $output == *"$peer"* ]]; then + echo "You see $peer as a bootstrap peer" + else + echo "Peer $peer not found" + fi +done \ No newline at end of file From 39261ea361d61048b327197023daeacfe177b003 Mon Sep 17 00:00:00 2001 From: 0xOzgur <29779769+0xOzgur@users.noreply.github.com> Date: Sun, 2 Jun 2024 04:27:50 +0300 Subject: [PATCH 03/22] decode --- visibility_check.sh | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/visibility_check.sh b/visibility_check.sh index a919db8..c13ddc4 100644 --- a/visibility_check.sh +++ b/visibility_check.sh @@ -1,7 +1,7 @@ #!/bin/bash # Bootstrap peer list -specific_peers=( +bootstrap_peers=( "EiDpYbDwT2rZq70JNJposqAC+vVZ1t97pcHbK8kr5G4ZNA==" "EiCcVN/KauCidn0nNDbOAGMHRZ5psz/lthpbBeiTAUEfZQ==" "EiDhVHjQKgHfPDXJKWykeUflcXtOv6O2lvjbmUnRrbT2mw==" @@ -11,7 +11,7 @@ specific_peers=( "EiDEYNo7GEfMhPBbUo+zFSGeDECB0RhG0GfAasdWp2TTTQ==" "EiCzMVQnCirB85ITj1x9JOEe4zjNnnFIlxuXj9m6kGq1SQ==" "EiD1ClZn/lr+n/gnS96Q4gKwBDk3yl33kNIhx9wUxJiyEA==" -"EiD7C6nsh1456MTlTihUrDqO4tLn/wcbF1HXM5V7P5GXEQ==" +"EiD7C6nsh1456MTlTihUrDqO4tLn/wcb1HXM5V7P5GXEQ==" "EiDUezzC3QCy6pNVg6+L9l0rH6CVIQSqxEKAGMSQJqnO1g==" "EiDLg4I2+SAV7f0dUfT/qwDJWAstv1CAYmbhvJG3LxrgZw==" "EiALqqXPhdT+LWlx2cbx3vYiFGxeUhv+KgyhE+MT8g7fLg==" @@ -24,11 +24,12 @@ specific_peers=( # Run the grpcurl command and capture its output output=$(grpcurl -plaintext localhost:8337 quilibrium.node.node.pb.NodeService.GetNetworkInfo) -# Check if any of the specific peers are in the output -for peer in "${specific_peers[@]}"; do - if [[ $output == *"$peer"* ]]; then - echo "You see $peer as a bootstrap peer" +# Check if any of the bootstrap peers are in the output +for peer in "${bootstrap_peers[@]}"; do + decoded_peer=$(echo "$peer" | base64 --decode) + if [[ $output == *"$decoded_peer"* ]]; then + echo "You see $decoded_peer as a bootstrap peer" else - echo "Peer $peer not found" + echo "Peer $decoded_peer not found" fi done \ No newline at end of file From 6cf9a1617c8315851a231d5d03e7e68df9881c08 Mon Sep 17 00:00:00 2001 From: 0xOzgur <29779769+0xOzgur@users.noreply.github.com> Date: Sun, 2 Jun 2024 04:29:18 +0300 Subject: [PATCH 04/22] Q Inc Bootstrap Peers --- visibility_check.sh | 9 --------- 1 file changed, 9 deletions(-) diff --git a/visibility_check.sh b/visibility_check.sh index c13ddc4..682cf7a 100644 --- a/visibility_check.sh +++ b/visibility_check.sh @@ -10,15 +10,6 @@ bootstrap_peers=( "EiB75ZnHtAOxajH2hlk9wD1i9zVigrDKKqYcSMXBkKo4SA==" "EiDEYNo7GEfMhPBbUo+zFSGeDECB0RhG0GfAasdWp2TTTQ==" "EiCzMVQnCirB85ITj1x9JOEe4zjNnnFIlxuXj9m6kGq1SQ==" -"EiD1ClZn/lr+n/gnS96Q4gKwBDk3yl33kNIhx9wUxJiyEA==" -"EiD7C6nsh1456MTlTihUrDqO4tLn/wcb1HXM5V7P5GXEQ==" -"EiDUezzC3QCy6pNVg6+L9l0rH6CVIQSqxEKAGMSQJqnO1g==" -"EiDLg4I2+SAV7f0dUfT/qwDJWAstv1CAYmbhvJG3LxrgZw==" -"EiALqqXPhdT+LWlx2cbx3vYiFGxeUhv+KgyhE+MT8g7fLg==" -"EiAhM5Eo0QoOQVPCJqrDCC+qe+Kx3kGohU5q+1rb5voD7A==" -"EiC3Li+DpEtPnomK9KWzAWtW7XUzVKUewNVrURiKSeWsfg==" -"EiBaq9Jsbu2vW+rFVrqI288t298TJUy+/xv8IF3V8uN1Xg==" -"EiAkOMWQQAGlDDINXrhSJmnwi0LVdkFv1wLGtrp3FrYxPg==" ) # Run the grpcurl command and capture its output From eef854aec6d3b4175f0a572df6b9aeff1e1c44fb Mon Sep 17 00:00:00 2001 From: 0xOzgur <29779769+0xOzgur@users.noreply.github.com> Date: Sun, 2 Jun 2024 04:30:32 +0300 Subject: [PATCH 05/22] fix --- visibility_check.sh | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/visibility_check.sh b/visibility_check.sh index 682cf7a..7d3eb7b 100644 --- a/visibility_check.sh +++ b/visibility_check.sh @@ -15,12 +15,11 @@ bootstrap_peers=( # Run the grpcurl command and capture its output output=$(grpcurl -plaintext localhost:8337 quilibrium.node.node.pb.NodeService.GetNetworkInfo) -# Check if any of the bootstrap peers are in the output +# Check if any of the specific peers are in the output for peer in "${bootstrap_peers[@]}"; do - decoded_peer=$(echo "$peer" | base64 --decode) - if [[ $output == *"$decoded_peer"* ]]; then - echo "You see $decoded_peer as a bootstrap peer" + if [[ $output == *"$peer"* ]]; then + echo "You see $peer as a bootstrap peer" else - echo "Peer $decoded_peer not found" + echo "Peer $peer not found" fi done \ No newline at end of file From 8765312b883020c393da8927835046a5f7cf6818 Mon Sep 17 00:00:00 2001 From: 0xOzgur <29779769+0xOzgur@users.noreply.github.com> Date: Sun, 2 Jun 2024 04:42:08 +0300 Subject: [PATCH 06/22] for dumies --- visibility_check.sh | 24 ++++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) diff --git a/visibility_check.sh b/visibility_check.sh index 7d3eb7b..70d8fc5 100644 --- a/visibility_check.sh +++ b/visibility_check.sh @@ -16,10 +16,26 @@ bootstrap_peers=( output=$(grpcurl -plaintext localhost:8337 quilibrium.node.node.pb.NodeService.GetNetworkInfo) # Check if any of the specific peers are in the output +# for peer in "${bootstrap_peers[@]}"; do +# if [[ $output == *"$peer"* ]]; then +# echo "You see $peer as a bootstrap peer" +# else +# echo "Peer $peer not found" +# fi +# done + + +# Check if any of the bootstrap peers are in the output +visible=false for peer in "${bootstrap_peers[@]}"; do if [[ $output == *"$peer"* ]]; then - echo "You see $peer as a bootstrap peer" - else - echo "Peer $peer not found" + visible=true + break fi -done \ No newline at end of file +done + +if $visible ; then + echo "Great, your node is visible!" +else + echo "Sorry, your node is not visible. Please restart your node and try again." +fi \ No newline at end of file From 28ec70a7b203d863af2d08e2a552229445772a6c Mon Sep 17 00:00:00 2001 From: 0xOzgur <29779769+0xOzgur@users.noreply.github.com> Date: Sun, 2 Jun 2024 04:50:21 +0300 Subject: [PATCH 07/22] final --- visibility_check.sh | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/visibility_check.sh b/visibility_check.sh index 70d8fc5..8cee73e 100644 --- a/visibility_check.sh +++ b/visibility_check.sh @@ -16,21 +16,13 @@ bootstrap_peers=( output=$(grpcurl -plaintext localhost:8337 quilibrium.node.node.pb.NodeService.GetNetworkInfo) # Check if any of the specific peers are in the output -# for peer in "${bootstrap_peers[@]}"; do -# if [[ $output == *"$peer"* ]]; then -# echo "You see $peer as a bootstrap peer" -# else -# echo "Peer $peer not found" -# fi -# done - - -# Check if any of the bootstrap peers are in the output visible=false for peer in "${bootstrap_peers[@]}"; do if [[ $output == *"$peer"* ]]; then visible=true - break + echo "You see $peer as a bootstrap peer" + else + echo "Peer $peer not found" fi done From a14cb0492515951198056d3e315f925c2756e787 Mon Sep 17 00:00:00 2001 From: 0xOzgur <29779769+0xOzgur@users.noreply.github.com> Date: Sun, 2 Jun 2024 11:15:34 +0300 Subject: [PATCH 08/22] Info added --- visibility_check.sh | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/visibility_check.sh b/visibility_check.sh index 8cee73e..12a2eb7 100644 --- a/visibility_check.sh +++ b/visibility_check.sh @@ -1,5 +1,12 @@ #!/bin/bash +# Step 0: Welcome +echo "This script is made with ❤️ by https://quilibrium.space @ 0xOzgur.eth" +echo "⏳You need GO and grpcurl installed on your machine to run this script. If you don't have them, please install them first." +echo "You can find the installation instructions at https://docs.quilibrium.space/installing-prerequisites" +echo "⏳Processing..." +sleep 5 # Add a 5-second delay + # Bootstrap peer list bootstrap_peers=( "EiDpYbDwT2rZq70JNJposqAC+vVZ1t97pcHbK8kr5G4ZNA==" From 233466c3079a355f66997363f1864e7151a38253 Mon Sep 17 00:00:00 2001 From: 0xOzgur <29779769+0xOzgur@users.noreply.github.com> Date: Sun, 2 Jun 2024 11:16:41 +0300 Subject: [PATCH 09/22] Info added-updated --- install/install_docker.sh | 2 +- update.sh | 2 +- visibility_check.sh | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/install/install_docker.sh b/install/install_docker.sh index 2780857..6ac03f7 100644 --- a/install/install_docker.sh +++ b/install/install_docker.sh @@ -3,7 +3,7 @@ cd ~ # Step 0: Welcome -echo "This script is made with ❤️ by 0xOzgur.eth" +echo "This script is made with ❤️ by 0xOzgur.eth @ https://quilibrium.space" echo "⏳Enjoy and sit back while you are building your Quilibrium Ceremony Client!" echo "⏳Processing..." sleep 10 # Add a 10-second delay diff --git a/update.sh b/update.sh index bd7bba3..dd1014a 100644 --- a/update.sh +++ b/update.sh @@ -1,7 +1,7 @@ #!/bin/bash # Step 0: Welcome -echo "This script is made with ❤️ by https://quilibrium.space @ 0xOzgur.eth" +echo "This script is made with ❤️ by 0xOzgur.eth @ https://quilibrium.space" echo "⏳Enjoy and sit back while you are upgrading your Quilibrium Node to v1.4.18!" echo "The script is prepared for Ubuntu machines. If you are using another operating system, please check the compatibility of the script." echo "⏳Processing..." diff --git a/visibility_check.sh b/visibility_check.sh index 12a2eb7..df620b3 100644 --- a/visibility_check.sh +++ b/visibility_check.sh @@ -1,7 +1,7 @@ #!/bin/bash # Step 0: Welcome -echo "This script is made with ❤️ by https://quilibrium.space @ 0xOzgur.eth" +echo "This script is made with ❤️ by 0xOzgur.eth @ https://quilibrium.space" echo "⏳You need GO and grpcurl installed on your machine to run this script. If you don't have them, please install them first." echo "You can find the installation instructions at https://docs.quilibrium.space/installing-prerequisites" echo "⏳Processing..." From 13c8b7915b70558248b351daf0aaae562ce495c4 Mon Sep 17 00:00:00 2001 From: 0xOzgur <29779769+0xOzgur@users.noreply.github.com> Date: Sun, 2 Jun 2024 17:49:26 +0300 Subject: [PATCH 10/22] info edit --- visibility_check.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/visibility_check.sh b/visibility_check.sh index df620b3..cb8ed7a 100644 --- a/visibility_check.sh +++ b/visibility_check.sh @@ -2,7 +2,7 @@ # Step 0: Welcome echo "This script is made with ❤️ by 0xOzgur.eth @ https://quilibrium.space" -echo "⏳You need GO and grpcurl installed on your machine to run this script. If you don't have them, please install them first." +echo "⏳You need GO and grpcurl installed and configured on your machine to run this script. If you don't have them, please install and configure grpcurl first." echo "You can find the installation instructions at https://docs.quilibrium.space/installing-prerequisites" echo "⏳Processing..." sleep 5 # Add a 5-second delay From efc5e688750770da762257c26c1ddc923617b450 Mon Sep 17 00:00:00 2001 From: 0xOzgur <29779769+0xOzgur@users.noreply.github.com> Date: Sun, 2 Jun 2024 20:04:17 +0300 Subject: [PATCH 11/22] Quilibrium.sh test --- Quilibrium.sh | 322 +++++++++++++++++++++++++++++++++++++++++++++ install/install.sh | 36 +---- 2 files changed, 323 insertions(+), 35 deletions(-) create mode 100644 Quilibrium.sh diff --git a/Quilibrium.sh b/Quilibrium.sh new file mode 100644 index 0000000..6733739 --- /dev/null +++ b/Quilibrium.sh @@ -0,0 +1,322 @@ +#!/bin/bash -i + +# Function for each menu option +install_prerequisites() { + echo "Installing prerequisites..." + # Installing Go 1.20.14 + wget https://go.dev/dl/go1.20.14.linux-amd64.tar.gz + sudo tar -xvf go1.20.14.linux-amd64.tar.gz || { echo "Failed to extract Go! Exiting..."; exit_message; exit 1; } + sudo mv go /usr/local || { echo "Failed to move go! Exiting..."; exit_message; exit 1; } + sudo rm go1.20.14.linux-amd64.tar.gz || { echo "Failed to remove downloaded archive! Exiting..."; exit_message; exit 1; } + + + # Step 4: Set Go environment variables + echo "⏳Setting Go environment variables..." + sleep 5 # Add a 5-second delay + + # Check if GOROOT is already set + if grep -q 'GOROOT=/usr/local/go' ~/.bashrc; then + echo "GOROOT already set in ~/.bashrc." + else + echo 'GOROOT=/usr/local/go' >> ~/.bashrc + echo "GOROOT set in ~/.bashrc." + fi + + # Check if GOPATH is already set + if grep -q "GOPATH=$HOME/go" ~/.bashrc; then + echo "GOPATH already set in ~/.bashrc." + else + echo "GOPATH=$HOME/go" >> ~/.bashrc + echo "GOPATH set in ~/.bashrc." + fi + + # Check if PATH is already set + if grep -q 'PATH=$GOPATH/bin:$GOROOT/bin:$PATH' ~/.bashrc; then + echo "PATH already set in ~/.bashrc." + else + echo 'PATH=$GOPATH/bin:$GOROOT/bin:$PATH' >> ~/.bashrc + echo "PATH set in ~/.bashrc." + fi + + # Source .bashrc to apply changes + echo "⏳Sourcing .bashrc to apply changes" + source ~/.bashrc + sleep 5 # Add a 5-second delay + + # Check GO Version + go version + sleep 5 # Add a 5-second delay + + # Install gRPCurl + echo "⏳Installing gRPCurl" + sleep 1 # Add a 1-second delay + go install github.com/fullstorydev/grpcurl/cmd/grpcurl@latest + } + +install_node() { + echo "Installing node..." + # Step 1: Update and Upgrade the Machine + echo "Updating the machine" + echo "⏳Processing..." + sleep 2 # Add a 2-second delay + + # Fof DEBIAN OS - Check if sudo and git is installed + if ! command -v sudo &> /dev/null + then + echo "sudo could not be found" + echo "Installing sudo..." + su -c "apt update && apt install sudo -y" + else + echo "sudo is installed" + fi + + if ! command -v git &> /dev/null + then + echo "git could not be found" + echo "Installing git..." + su -c "apt update && apt install git -y" + else + echo "git is installed" + fi + + sudo apt upgrade -y + + + # Step 2: Adjust network buffer sizes + echo "Adjusting network buffer sizes..." + if grep -q "^net.core.rmem_max=600000000$" /etc/sysctl.conf; then + echo "net.core.rmem_max=600000000 found inside /etc/sysctl.conf, skipping..." + else + echo -e "\n# Change made to increase buffer sizes for better network performance for ceremonyclient\nnet.core.rmem_max=600000000" | sudo tee -a /etc/sysctl.conf > /dev/null + fi + if grep -q "^net.core.wmem_max=600000000$" /etc/sysctl.conf; then + echo "net.core.wmem_max=600000000 found inside /etc/sysctl.conf, skipping..." + else + echo -e "\n# Change made to increase buffer sizes for better network performance for ceremonyclient\nnet.core.wmem_max=600000000" | sudo tee -a /etc/sysctl.conf > /dev/null + fi + sudo sysctl -p + + # Step 3: Check if directory ~/ceremonyclient exists, download from github + if [ -d ~/ceremonyclient ]; then + # Check if backup directory ~/backup/qnode_keys exists, if not create it + if [ ! -d ~/backup/qnode_keys ]; then + mkdir -p ~/backup/qnode_keys + fi + + # Check if files exist, then backup + if [ -f ~/ceremonyclient/node/.config/keys.yml ]; then + cp ~/ceremonyclient/node/.config/keys.yml ~/backup/qnode_keys/ + echo "✅ Backup of keys.yml created in ~/backup/qnode_keys folder" + fi + + if [ -f ~/ceremonyclient/node/.config/config.yml ]; then + cp ~/ceremonyclient/node/.config/config.yml ~/backup/qnode_keys/ + echo "✅ Backup of config.yml created in ~/backup/qnode_keys folder" + fi + fi + + # Step 4:Download Ceremonyclient + echo "⏳Downloading Ceremonyclient" + sleep 1 # Add a 1-second delay + cd ~ + if [ -d "ceremonyclient" ]; then + echo "Directory ceremonyclient already exists, skipping git clone..." + else + until git clone https://source.quilibrium.com/quilibrium/ceremonyclient.git || git clone https://git.quilibrium-mirror.ch/agostbiro/ceremonyclient.git; do + echo "Git clone failed, retrying..." + sleep 2 + done + fi + cd ~/ceremonyclient/ + git remote set-url origin https://source.quilibrium.com/quilibrium/ceremonyclient.git || git remote set-url origin https://git.quilibrium-mirror.ch/agostbiro/ceremonyclient.git + git checkout release + + # Set the version number + #VERSION="1.4.18" + + # Get the system architecture + # ARCH=$(uname -m) + + # Step 5:Determine the ExecStart line based on the architecture + # Get the current user's home directory + HOME=$(eval echo ~$HOME_DIR) + + # Use the home directory in the path + NODE_PATH="$HOME/ceremonyclient/node" + EXEC_START="$NODE_PATH/release_autorun.sh" + + # Step 6:Create Ceremonyclient Service + echo "⏳ Creating Ceremonyclient Service" + sleep 2 # Add a 2-second delay + + # Check if the file exists before attempting to remove it + if [ -f "/lib/systemd/system/ceremonyclient.service" ]; then + # If the file exists, remove it + rm /lib/systemd/system/ceremonyclient.service + echo "ceremonyclient.service file removed." + else + # If the file does not exist, inform the user + echo "ceremonyclient.service file does not exist. No action taken." + fi + + sudo tee /lib/systemd/system/ceremonyclient.service > /dev/null < /dev/null || { echo "Failed to enable gRPC! Exiting..."; exit 1; } + fi + else + echo "gRPC already enabled." + fi + + + # Check if the line listenRESTMultiaddr: /ip4/127.0.0.1/tcp/8338 exists + if ! line_exists "listenRESTMultiaddr: /ip4/127.0.0.1/tcp/8338" .config/config.yml; then + # Check if the line listenRESTMultiaddr: "" exists + if line_exists "listenRESTMultiaddr: \"\"" .config/config.yml; then + # Substitute listenRESTMultiaddr: "" with listenRESTMultiaddr: /ip4/127.0.0.1/tcp/8338 + sudo sed -i 's#^listenRESTMultiaddr:.*$#listenRESTMultiaddr: /ip4/127.0.0.1/tcp/8338#' .config/config.yml || { echo "Failed to enable gRPC! Exiting..."; exit 1; } + else + # Add listenRESTMultiaddr: /ip4/127.0.0.1/tcp/8338 + echo "listenRESTMultiaddr: /ip4/127.0.0.1/tcp/8338" | sudo tee -a .config/config.yml > /dev/null || { echo "Failed to enable gRPC! Exiting..."; exit 1; } + fi + else + echo "gRPC already enabled." + fi + + + + # Step 2: Enable Stats Collection + echo "Enabling Stats Collection..." + if ! line_exists " statsMultiaddr: \"/dns/stats.quilibrium.com/tcp/443\"" .config/config.yml; then + sudo sed -i '/^ *engine:/a\ statsMultiaddr: "/dns/stats.quilibrium.com/tcp/443"' .config/config.yml || { echo "Failed to enable Stats Collection! Exiting..."; exit 1; } + else + echo "Stats Collection already enabled." + fi + + # Check if both lines were added successfully + if line_exists "listenGrpcMultiaddr: /ip4/127.0.0.1/tcp/8337" .config/config.yml && line_exists " statsMultiaddr: \"/dns/stats.quilibrium.com/tcp/443\"" .config/config.yml; then + echo "Success: The script successfully edited your config.yml file." + else + echo "ERROR: The script failed to correctly edit your config.yml file." + echo "You may want to follow the online guide to do it manually." + exit 1 + fi + + echo "gRPC calls setup was successful." +} + +check_visibility() { + echo "Checking visibility..." + echo "⏳You need GO and grpcurl installed and configured on your machine to run this script. If you don't have them, please install and configure grpcurl first." + echo "You can find the installation instructions at https://docs.quilibrium.space/installing-prerequisites" + echo "⏳Processing..." + sleep 5 # Add a 5-second delay + + # Bootstrap peer list + bootstrap_peers=( + "EiDpYbDwT2rZq70JNJposqAC+vVZ1t97pcHbK8kr5G4ZNA==" + "EiCcVN/KauCidn0nNDbOAGMHRZ5psz/lthpbBeiTAUEfZQ==" + "EiDhVHjQKgHfPDXJKWykeUflcXtOv6O2lvjbmUnRrbT2mw==" + "EiDHhTNA0yf07ljH+gTn0YEk/edCF70gQqr7QsUr8RKbAA==" + "EiAnwhEcyjsHiU6cDCjYJyk/1OVsh6ap7E3vDfJvefGigw==" + "EiB75ZnHtAOxajH2hlk9wD1i9zVigrDKKqYcSMXBkKo4SA==" + "EiDEYNo7GEfMhPBbUo+zFSGeDECB0RhG0GfAasdWp2TTTQ==" + "EiCzMVQnCirB85ITj1x9JOEe4zjNnnFIlxuXj9m6kGq1SQ==" + ) + + # Run the grpcurl command and capture its output + output=$(grpcurl -plaintext localhost:8337 quilibrium.node.node.pb.NodeService.GetNetworkInfo) + + # Check if any of the specific peers are in the output + visible=false + for peer in "${bootstrap_peers[@]}"; do + if [[ $output == *"$peer"* ]]; then + visible=true + echo "You see $peer as a bootstrap peer" + else + echo "Peer $peer not found" + fi + done + + if $visible ; then + echo "Great, your node is visible!" + else + echo "Sorry, your node is not visible. Please restart your node and try again." + fi +} + +node_info() { + echo "Getting node info..." + cd ~/ceremonyclient/node && ./${NODE_BINARY} -node-info && cd ~ +} + +# Menu +while true; do + echo "Welcome! Please choose an option:" + echo "1) Install Prerequisites" + echo "2) Install Node" + echo "3) Configure grpcurl" + echo "4) Check Visibility" + echo "5) Node Info" + echo "6) Exit" + + read -p "Enter your choice: " choice + + case $choice in + 1) install_prerequisites ;; + 2) install_node ;; + 3) configure_grpcurl ;; + 4) check_visibility ;; + 5) node_info ;; + 6) break ;; + *) echo "Invalid option, please try again." ;; + esac +done \ No newline at end of file diff --git a/install/install.sh b/install/install.sh index 237f159..a10f201 100644 --- a/install/install.sh +++ b/install/install.sh @@ -1,39 +1,5 @@ #!/bin/bash -i -cd ~ - -# Step 0: Welcome -echo "This script is made with ❤️ by 0xOzgur.eth @ https://quilibrium.space " -echo "The script is prepared for Ubuntu machines. If you are using another operating system, please check the compatibility of the script." -echo "The script doesn't install GO or GrpCurl packages. If you want to install them please visit https://docs.quilibrium.space/installing-prerequisites page." -echo "⏳Enjoy and sit back while you are building your Quilibrium Node!" -echo "⏳Processing..." -sleep 10 # Add a 10-second delay - - -# Step 1: Update and Upgrade the Machine -echo "Updating the machine" -echo "⏳Processing..." -sleep 2 # Add a 2-second delay -apt update -apt upgrade -y -apt install sudo -y -apt install git -y - -# Step 2: Adjust network buffer sizes -echo "Adjusting network buffer sizes..." -if grep -q "^net.core.rmem_max=600000000$" /etc/sysctl.conf; then - echo "net.core.rmem_max=600000000 found inside /etc/sysctl.conf, skipping..." -else - echo -e "\n# Change made to increase buffer sizes for better network performance for ceremonyclient\nnet.core.rmem_max=600000000" | sudo tee -a /etc/sysctl.conf > /dev/null -fi -if grep -q "^net.core.wmem_max=600000000$" /etc/sysctl.conf; then - echo "net.core.wmem_max=600000000 found inside /etc/sysctl.conf, skipping..." -else - echo -e "\n# Change made to increase buffer sizes for better network performance for ceremonyclient\nnet.core.wmem_max=600000000" | sudo tee -a /etc/sysctl.conf > /dev/null -fi -sudo sysctl -p - # Installing Go 1.20.14 wget https://go.dev/dl/go1.20.14.linux-amd64.tar.gz @@ -91,7 +57,7 @@ cd ~ if [ -d "ceremonyclient" ]; then echo "Directory ceremonyclient already exists, skipping git clone..." else - until git clone https://source.quilibrium.com/quilibrium/ceremonyclient.git; do + until git clone https://source.quilibrium.com/quilibrium/ceremonyclient.git || git clone https://git.quilibrium-mirror.ch/agostbiro/ceremonyclient.git; do echo "Git clone failed, retrying..." sleep 2 done From b3ac438fc567f91c682f3f31fa5f14af97e9a9a5 Mon Sep 17 00:00:00 2001 From: 0xOzgur <29779769+0xOzgur@users.noreply.github.com> Date: Sun, 2 Jun 2024 20:12:32 +0300 Subject: [PATCH 12/22] bugfix --- Quilibrium.sh | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/Quilibrium.sh b/Quilibrium.sh index 6733739..dfc4d18 100644 --- a/Quilibrium.sh +++ b/Quilibrium.sh @@ -54,8 +54,8 @@ install_prerequisites() { } install_node() { - echo "Installing node..." - # Step 1: Update and Upgrade the Machine + echo "Installing node..." + # Step 1: Update and Upgrade the Machine echo "Updating the machine" echo "⏳Processing..." sleep 2 # Add a 2-second delay @@ -159,20 +159,20 @@ install_node() { echo "ceremonyclient.service file does not exist. No action taken." fi - sudo tee /lib/systemd/system/ceremonyclient.service > /dev/null < /dev/null < Date: Sun, 2 Jun 2024 20:16:39 +0300 Subject: [PATCH 13/22] bugfix --- Quilibrium.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Quilibrium.sh b/Quilibrium.sh index dfc4d18..086c8be 100644 --- a/Quilibrium.sh +++ b/Quilibrium.sh @@ -1,4 +1,4 @@ -#!/bin/bash -i +#!/bin/bash # Function for each menu option install_prerequisites() { From 1ab7cd19b6d9cb2553fcfd0fb41d1c4273e18189 Mon Sep 17 00:00:00 2001 From: 0xOzgur <29779769+0xOzgur@users.noreply.github.com> Date: Sun, 2 Jun 2024 20:20:01 +0300 Subject: [PATCH 14/22] Check visibility added --- Quilibrium.sh | 255 ++------------------------------------------------ 1 file changed, 9 insertions(+), 246 deletions(-) diff --git a/Quilibrium.sh b/Quilibrium.sh index 086c8be..9f1d325 100644 --- a/Quilibrium.sh +++ b/Quilibrium.sh @@ -2,260 +2,23 @@ # Function for each menu option install_prerequisites() { - echo "Installing prerequisites..." - # Installing Go 1.20.14 - wget https://go.dev/dl/go1.20.14.linux-amd64.tar.gz - sudo tar -xvf go1.20.14.linux-amd64.tar.gz || { echo "Failed to extract Go! Exiting..."; exit_message; exit 1; } - sudo mv go /usr/local || { echo "Failed to move go! Exiting..."; exit_message; exit 1; } - sudo rm go1.20.14.linux-amd64.tar.gz || { echo "Failed to remove downloaded archive! Exiting..."; exit_message; exit 1; } - - - # Step 4: Set Go environment variables - echo "⏳Setting Go environment variables..." - sleep 5 # Add a 5-second delay - - # Check if GOROOT is already set - if grep -q 'GOROOT=/usr/local/go' ~/.bashrc; then - echo "GOROOT already set in ~/.bashrc." - else - echo 'GOROOT=/usr/local/go' >> ~/.bashrc - echo "GOROOT set in ~/.bashrc." - fi - - # Check if GOPATH is already set - if grep -q "GOPATH=$HOME/go" ~/.bashrc; then - echo "GOPATH already set in ~/.bashrc." - else - echo "GOPATH=$HOME/go" >> ~/.bashrc - echo "GOPATH set in ~/.bashrc." - fi - - # Check if PATH is already set - if grep -q 'PATH=$GOPATH/bin:$GOROOT/bin:$PATH' ~/.bashrc; then - echo "PATH already set in ~/.bashrc." - else - echo 'PATH=$GOPATH/bin:$GOROOT/bin:$PATH' >> ~/.bashrc - echo "PATH set in ~/.bashrc." - fi - - # Source .bashrc to apply changes - echo "⏳Sourcing .bashrc to apply changes" - source ~/.bashrc - sleep 5 # Add a 5-second delay - - # Check GO Version - go version - sleep 5 # Add a 5-second delay - - # Install gRPCurl - echo "⏳Installing gRPCurl" - sleep 1 # Add a 1-second delay - go install github.com/fullstorydev/grpcurl/cmd/grpcurl@latest - } + echo "Installing prerequisites..." + # Your code here +} install_node() { echo "Installing node..." - # Step 1: Update and Upgrade the Machine - echo "Updating the machine" - echo "⏳Processing..." - sleep 2 # Add a 2-second delay - - # Fof DEBIAN OS - Check if sudo and git is installed - if ! command -v sudo &> /dev/null - then - echo "sudo could not be found" - echo "Installing sudo..." - su -c "apt update && apt install sudo -y" - else - echo "sudo is installed" - fi - - if ! command -v git &> /dev/null - then - echo "git could not be found" - echo "Installing git..." - su -c "apt update && apt install git -y" - else - echo "git is installed" - fi - - sudo apt upgrade -y - - - # Step 2: Adjust network buffer sizes - echo "Adjusting network buffer sizes..." - if grep -q "^net.core.rmem_max=600000000$" /etc/sysctl.conf; then - echo "net.core.rmem_max=600000000 found inside /etc/sysctl.conf, skipping..." - else - echo -e "\n# Change made to increase buffer sizes for better network performance for ceremonyclient\nnet.core.rmem_max=600000000" | sudo tee -a /etc/sysctl.conf > /dev/null - fi - if grep -q "^net.core.wmem_max=600000000$" /etc/sysctl.conf; then - echo "net.core.wmem_max=600000000 found inside /etc/sysctl.conf, skipping..." - else - echo -e "\n# Change made to increase buffer sizes for better network performance for ceremonyclient\nnet.core.wmem_max=600000000" | sudo tee -a /etc/sysctl.conf > /dev/null - fi - sudo sysctl -p - - # Step 3: Check if directory ~/ceremonyclient exists, download from github - if [ -d ~/ceremonyclient ]; then - # Check if backup directory ~/backup/qnode_keys exists, if not create it - if [ ! -d ~/backup/qnode_keys ]; then - mkdir -p ~/backup/qnode_keys - fi - - # Check if files exist, then backup - if [ -f ~/ceremonyclient/node/.config/keys.yml ]; then - cp ~/ceremonyclient/node/.config/keys.yml ~/backup/qnode_keys/ - echo "✅ Backup of keys.yml created in ~/backup/qnode_keys folder" - fi - - if [ -f ~/ceremonyclient/node/.config/config.yml ]; then - cp ~/ceremonyclient/node/.config/config.yml ~/backup/qnode_keys/ - echo "✅ Backup of config.yml created in ~/backup/qnode_keys folder" - fi - fi - - # Step 4:Download Ceremonyclient - echo "⏳Downloading Ceremonyclient" - sleep 1 # Add a 1-second delay - cd ~ - if [ -d "ceremonyclient" ]; then - echo "Directory ceremonyclient already exists, skipping git clone..." - else - until git clone https://source.quilibrium.com/quilibrium/ceremonyclient.git || git clone https://git.quilibrium-mirror.ch/agostbiro/ceremonyclient.git; do - echo "Git clone failed, retrying..." - sleep 2 - done - fi - cd ~/ceremonyclient/ - git remote set-url origin https://source.quilibrium.com/quilibrium/ceremonyclient.git || git remote set-url origin https://git.quilibrium-mirror.ch/agostbiro/ceremonyclient.git - git checkout release - - # Set the version number - #VERSION="1.4.18" - - # Get the system architecture - # ARCH=$(uname -m) - - # Step 5:Determine the ExecStart line based on the architecture - # Get the current user's home directory - HOME=$(eval echo ~$HOME_DIR) - - # Use the home directory in the path - NODE_PATH="$HOME/ceremonyclient/node" - EXEC_START="$NODE_PATH/release_autorun.sh" - - # Step 6:Create Ceremonyclient Service - echo "⏳ Creating Ceremonyclient Service" - sleep 2 # Add a 2-second delay - - # Check if the file exists before attempting to remove it - if [ -f "/lib/systemd/system/ceremonyclient.service" ]; then - # If the file exists, remove it - rm /lib/systemd/system/ceremonyclient.service - echo "ceremonyclient.service file removed." - else - # If the file does not exist, inform the user - echo "ceremonyclient.service file does not exist. No action taken." - fi - -sudo tee /lib/systemd/system/ceremonyclient.service > /dev/null < /dev/null || { echo "Failed to enable gRPC! Exiting..."; exit 1; } - fi - else - echo "gRPC already enabled." - fi - - - # Check if the line listenRESTMultiaddr: /ip4/127.0.0.1/tcp/8338 exists - if ! line_exists "listenRESTMultiaddr: /ip4/127.0.0.1/tcp/8338" .config/config.yml; then - # Check if the line listenRESTMultiaddr: "" exists - if line_exists "listenRESTMultiaddr: \"\"" .config/config.yml; then - # Substitute listenRESTMultiaddr: "" with listenRESTMultiaddr: /ip4/127.0.0.1/tcp/8338 - sudo sed -i 's#^listenRESTMultiaddr:.*$#listenRESTMultiaddr: /ip4/127.0.0.1/tcp/8338#' .config/config.yml || { echo "Failed to enable gRPC! Exiting..."; exit 1; } - else - # Add listenRESTMultiaddr: /ip4/127.0.0.1/tcp/8338 - echo "listenRESTMultiaddr: /ip4/127.0.0.1/tcp/8338" | sudo tee -a .config/config.yml > /dev/null || { echo "Failed to enable gRPC! Exiting..."; exit 1; } - fi - else - echo "gRPC already enabled." - fi - - - - # Step 2: Enable Stats Collection - echo "Enabling Stats Collection..." - if ! line_exists " statsMultiaddr: \"/dns/stats.quilibrium.com/tcp/443\"" .config/config.yml; then - sudo sed -i '/^ *engine:/a\ statsMultiaddr: "/dns/stats.quilibrium.com/tcp/443"' .config/config.yml || { echo "Failed to enable Stats Collection! Exiting..."; exit 1; } - else - echo "Stats Collection already enabled." - fi - - # Check if both lines were added successfully - if line_exists "listenGrpcMultiaddr: /ip4/127.0.0.1/tcp/8337" .config/config.yml && line_exists " statsMultiaddr: \"/dns/stats.quilibrium.com/tcp/443\"" .config/config.yml; then - echo "Success: The script successfully edited your config.yml file." - else - echo "ERROR: The script failed to correctly edit your config.yml file." - echo "You may want to follow the online guide to do it manually." - exit 1 - fi - - echo "gRPC calls setup was successful." + echo "Configuring grpcurl..." + # Your code here } check_visibility() { - echo "Checking visibility..." - echo "⏳You need GO and grpcurl installed and configured on your machine to run this script. If you don't have them, please install and configure grpcurl first." + echo "This script is made with ❤️ by 0xOzgur.eth @ https://quilibrium.space" + echo "⏳You need GO and grpcurl installed and configured on your machine to run this script. If you don't have them, please install and configure grpcurl first." echo "You can find the installation instructions at https://docs.quilibrium.space/installing-prerequisites" echo "⏳Processing..." sleep 5 # Add a 5-second delay @@ -295,7 +58,7 @@ check_visibility() { node_info() { echo "Getting node info..." - cd ~/ceremonyclient/node && ./${NODE_BINARY} -node-info && cd ~ + # Your code here } # Menu From b62a91cf2c601d149da4e00a06e9ab8e2415a0e8 Mon Sep 17 00:00:00 2001 From: 0xOzgur <29779769+0xOzgur@users.noreply.github.com> Date: Sun, 2 Jun 2024 20:38:30 +0300 Subject: [PATCH 15/22] test --- Quilibrium.sh | 44 ++++++++++++++++++++++---------------------- 1 file changed, 22 insertions(+), 22 deletions(-) diff --git a/Quilibrium.sh b/Quilibrium.sh index 9f1d325..dbef7e1 100644 --- a/Quilibrium.sh +++ b/Quilibrium.sh @@ -1,4 +1,26 @@ #!/bin/bash + echo "Welcome! Please choose an option:" +# Menu +while true; do + echo "1) Install Prerequisites" + echo "2) Install Node" + echo "3) Configure grpcurl" + echo "4) Check Visibility" + echo "5) Node Info" + echo "6) Exit" + + read -p "Enter your choice: " choice + + case $choice in + 1) install_prerequisites ;; + 2) install_node ;; + 3) configure_grpcurl ;; + 4) check_visibility ;; + 5) node_info ;; + 6) break ;; + *) echo "Invalid option, please try again." ;; + esac +done # Function for each menu option install_prerequisites() { @@ -61,25 +83,3 @@ node_info() { # Your code here } -# Menu -while true; do - echo "Welcome! Please choose an option:" - echo "1) Install Prerequisites" - echo "2) Install Node" - echo "3) Configure grpcurl" - echo "4) Check Visibility" - echo "5) Node Info" - echo "6) Exit" - - read -p "Enter your choice: " choice - - case $choice in - 1) install_prerequisites ;; - 2) install_node ;; - 3) configure_grpcurl ;; - 4) check_visibility ;; - 5) node_info ;; - 6) break ;; - *) echo "Invalid option, please try again." ;; - esac -done \ No newline at end of file From 83060941d7d6266af29b3ebc0e8d11acf4931994 Mon Sep 17 00:00:00 2001 From: 0xOzgur <29779769+0xOzgur@users.noreply.github.com> Date: Sun, 2 Jun 2024 20:54:10 +0300 Subject: [PATCH 16/22] test --- Quilibrium.sh | 249 +++++++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 225 insertions(+), 24 deletions(-) diff --git a/Quilibrium.sh b/Quilibrium.sh index dbef7e1..bcff590 100644 --- a/Quilibrium.sh +++ b/Quilibrium.sh @@ -1,36 +1,207 @@ #!/bin/bash - echo "Welcome! Please choose an option:" -# Menu -while true; do - echo "1) Install Prerequisites" - echo "2) Install Node" - echo "3) Configure grpcurl" - echo "4) Check Visibility" - echo "5) Node Info" - echo "6) Exit" - read -p "Enter your choice: " choice +# Get system information +ARCH=$(uname -m) +OS=$(uname -s) - case $choice in - 1) install_prerequisites ;; - 2) install_node ;; - 3) configure_grpcurl ;; - 4) check_visibility ;; - 5) node_info ;; - 6) break ;; - *) echo "Invalid option, please try again." ;; - esac -done +# Determine the node binary name based on the architecture and OS +if [ "$ARCH" = "x86_64" ]; then + if [ "$OS" = "Linux" ]; then + NODE_BINARY='node-1.4.18-linux-amd64' + elif [ "$OS" = "Darwin" ]; then + NODE_BINARY='node-1.4.18-darwin-amd64' + fi +elif [ "$ARCH" = "aarch64" ]; then + if [ "$OS" = "Linux" ]; then + NODE_BINARY='node-1.4.18-linux-arm64' + elif [ "$OS" = "Darwin" ]; then + NODE_BINARY='node-1.4.18-darwin-arm64' + fi +fi # Function for each menu option install_prerequisites() { - echo "Installing prerequisites..." - # Your code here +echo "Installing prerequisites..." +wget https://go.dev/dl/go1.20.14.linux-amd64.tar.gz +sudo tar -xvf go1.20.14.linux-amd64.tar.gz || { echo "Failed to extract Go! Exiting..."; exit_message; exit 1; } +sudo mv go /usr/local || { echo "Failed to move go! Exiting..."; exit_message; exit 1; } +sudo rm go1.20.14.linux-amd64.tar.gz || { echo "Failed to remove downloaded archive! Exiting..."; exit_message; exit 1; } + + +# Step 4: Set Go environment variables +echo "⏳Setting Go environment variables..." +sleep 5 # Add a 5-second delay + +# Check if GOROOT is already set +if grep -q 'GOROOT=/usr/local/go' ~/.bashrc; then + echo "GOROOT already set in ~/.bashrc." +else + echo 'GOROOT=/usr/local/go' >> ~/.bashrc + echo "GOROOT set in ~/.bashrc." +fi + +# Check if GOPATH is already set +if grep -q "GOPATH=$HOME/go" ~/.bashrc; then + echo "GOPATH already set in ~/.bashrc." +else + echo "GOPATH=$HOME/go" >> ~/.bashrc + echo "GOPATH set in ~/.bashrc." +fi + +# Check if PATH is already set +if grep -q 'PATH=$GOPATH/bin:$GOROOT/bin:$PATH' ~/.bashrc; then + echo "PATH already set in ~/.bashrc." +else + echo 'PATH=$GOPATH/bin:$GOROOT/bin:$PATH' >> ~/.bashrc + echo "PATH set in ~/.bashrc." +fi + +# Source .bashrc to apply changes +echo "⏳Sourcing .bashrc to apply changes" +source ~/.bashrc +sleep 5 # Add a 5-second delay + +# Check GO Version +go version +sleep 5 # Add a 5-second delay + +# Install gRPCurl +echo "⏳Installing gRPCurl" +sleep 1 # Add a 1-second delay +go install github.com/fullstorydev/grpcurl/cmd/grpcurl@latest } install_node() { echo "Installing node..." - # Your code here + # Step 1: Update and Upgrade the Machine +echo "Updating the machine" +echo "⏳Processing..." +sleep 2 # Add a 2-second delay + +# Fof DEBIAN OS - Check if sudo and git is installed +if ! command -v sudo &> /dev/null +then + echo "sudo could not be found" + echo "Installing sudo..." + su -c "apt update && apt install sudo -y" +else + echo "sudo is installed" +fi + +if ! command -v git &> /dev/null +then + echo "git could not be found" + echo "Installing git..." + su -c "apt update && apt install git -y" +else + echo "git is installed" +fi + +sudo apt upgrade -y + + +# Step 2: Adjust network buffer sizes +echo "Adjusting network buffer sizes..." +if grep -q "^net.core.rmem_max=600000000$" /etc/sysctl.conf; then + echo "net.core.rmem_max=600000000 found inside /etc/sysctl.conf, skipping..." +else + echo -e "\n# Change made to increase buffer sizes for better network performance for ceremonyclient\nnet.core.rmem_max=600000000" | sudo tee -a /etc/sysctl.conf > /dev/null +fi +if grep -q "^net.core.wmem_max=600000000$" /etc/sysctl.conf; then + echo "net.core.wmem_max=600000000 found inside /etc/sysctl.conf, skipping..." +else + echo -e "\n# Change made to increase buffer sizes for better network performance for ceremonyclient\nnet.core.wmem_max=600000000" | sudo tee -a /etc/sysctl.conf > /dev/null +fi +sudo sysctl -p + +# Step 3: Check if directory ~/ceremonyclient exists, download from github +if [ -d ~/ceremonyclient ]; then + # Check if backup directory ~/backup/qnode_keys exists, if not create it + if [ ! -d ~/backup/qnode_keys ]; then + mkdir -p ~/backup/qnode_keys + fi + + # Check if files exist, then backup + if [ -f ~/ceremonyclient/node/.config/keys.yml ]; then + cp ~/ceremonyclient/node/.config/keys.yml ~/backup/qnode_keys/ + echo "✅ Backup of keys.yml created in ~/backup/qnode_keys folder" + fi + + if [ -f ~/ceremonyclient/node/.config/config.yml ]; then + cp ~/ceremonyclient/node/.config/config.yml ~/backup/qnode_keys/ + echo "✅ Backup of config.yml created in ~/backup/qnode_keys folder" + fi +fi + +# Step 4:Download Ceremonyclient +echo "⏳Downloading Ceremonyclient" +sleep 1 # Add a 1-second delay +cd ~ +if [ -d "ceremonyclient" ]; then + echo "Directory ceremonyclient already exists, skipping git clone..." +else + until git clone https://source.quilibrium.com/quilibrium/ceremonyclient.git || git clone https://git.quilibrium-mirror.ch/agostbiro/ceremonyclient.git; do + echo "Git clone failed, retrying..." + sleep 2 + done +fi +cd ~/ceremonyclient/ +git remote set-url origin https://source.quilibrium.com/quilibrium/ceremonyclient.git || git remote set-url origin https://git.quilibrium-mirror.ch/agostbiro/ceremonyclient.git +git checkout release + +# Set the version number +# VERSION="1.4.18" + +# Get the system architecture +# ARCH=$(uname -m) + +# Step 5:Determine the ExecStart line based on the architecture +# Get the current user's home directory +HOME=$(eval echo ~$HOME_DIR) + +# Use the home directory in the path +NODE_PATH="$HOME/ceremonyclient/node" +EXEC_START="$NODE_PATH/release_autorun.sh" + +# Step 6:Create Ceremonyclient Service +echo "⏳ Creating Ceremonyclient Service" +sleep 2 # Add a 2-second delay + +# Check if the file exists before attempting to remove it +if [ -f "/lib/systemd/system/ceremonyclient.service" ]; then + # If the file exists, remove it + rm /lib/systemd/system/ceremonyclient.service + echo "ceremonyclient.service file removed." +else + # If the file does not exist, inform the user + echo "ceremonyclient.service file does not exist. No action taken." +fi + +sudo tee /lib/systemd/system/ceremonyclient.service > /dev/null < Date: Sun, 2 Jun 2024 21:06:48 +0300 Subject: [PATCH 17/22] Added functions --- Quilibrium.sh | 85 ++++++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 80 insertions(+), 5 deletions(-) diff --git a/Quilibrium.sh b/Quilibrium.sh index bcff590..253e98a 100644 --- a/Quilibrium.sh +++ b/Quilibrium.sh @@ -22,6 +22,10 @@ fi # Function for each menu option install_prerequisites() { echo "Installing prerequisites..." + +apt install cpulimit -y +apt install gawk -y #incase it is not instal + wget https://go.dev/dl/go1.20.14.linux-amd64.tar.gz sudo tar -xvf go1.20.14.linux-amd64.tar.gz || { echo "Failed to extract Go! Exiting..."; exit_message; exit 1; } sudo mv go /usr/local || { echo "Failed to move go! Exiting..."; exit_message; exit 1; } @@ -209,6 +213,75 @@ configure_grpcurl() { # Your code here } +update_node() { + echo "Configuring grpcurl..." + service ceremonyclient stop + +apt install cpulimit -y +apt install gawk -y #incase it is not installed + +# Step 1:Download Binary +echo "⏳ Downloading New Release v1.4.18" +cd ~/ceremonyclient +git remote set-url origin https://source.quilibrium.com/quilibrium/ceremonyclient.git || git remote set-url origin https://git.quilibrium-mirror.ch/agostbiro/ceremonyclient.git +git pull +git checkout release + +# Get the current user's home directory +HOME=$(eval echo ~$HOME_DIR) + +# Use the home directory in the path +NODE_PATH="$HOME/ceremonyclient/node" +EXEC_START="$NODE_PATH/release_autorun.sh" + +# Step 3:Re-Create Ceremonyclient Service +echo "⏳ Re-Creating Ceremonyclient Service" +sleep 2 # Add a 2-second delay +SERVICE_FILE="/lib/systemd/system/ceremonyclient.service" +if [ ! -f "$SERVICE_FILE" ]; then + echo "📝 Creating new ceremonyclient service file..." + if ! sudo tee "$SERVICE_FILE" > /dev/null <&2 + exit 1 + fi +else + echo "🔍 Checking existing ceremonyclient service file..." + # Check if the required lines exist and if they are different + if ! grep -q "WorkingDirectory=$NODE_PATH" "$SERVICE_FILE" || ! grep -q "ExecStart=$EXEC_START" "$SERVICE_FILE"; then + echo "🔄 Updating existing ceremonyclient service file..." + # Replace the existing lines with new values + sudo sed -i "s|WorkingDirectory=.*|WorkingDirectory=$NODE_PATH|" "$SERVICE_FILE" + sudo sed -i "s|ExecStart=.*|ExecStart=$EXEC_START|" "$SERVICE_FILE" + else + echo "✅ No changes needed." + fi +fi + +# Step 4:Start the ceremonyclient service +echo "✅ Starting Ceremonyclient Service" +sleep 2 # Add a 2-second delay +sudo systemctl daemon-reload +sudo systemctl enable ceremonyclient +sudo service ceremonyclient start + +# See the logs of the ceremonyclient service +echo "🎉 Welcome to Quilibrium Ceremonyclient v1.4.18" +} + check_visibility() { echo "This script is made with ❤️ by 0xOzgur.eth @ https://quilibrium.space" echo "⏳You need GO and grpcurl installed and configured on your machine to run this script. If you don't have them, please install and configure grpcurl first." @@ -257,7 +330,7 @@ node_info() { node_logs() { echo "Getting node logs..." - udo journalctl -u ceremonyclient.service -f --no-hostname -o cat + sudo journalctl -u ceremonyclient.service -f --no-hostname -o cat } # Menu @@ -266,10 +339,11 @@ while true; do echo "1) Install Prerequisites" echo "2) Install Node" echo "3) Configure grpCurl" - echo "4) Check Visibility" - echo "5) Node Info" - echo "6) Node Logs" - echo "7) Exit" + echo "4) Update Node" + echo "5) Check Visibility" + echo "6) Node Info" + echo "7) Node Logs" + echo "8) Exit" read -p "Enter your choice: " choice @@ -277,6 +351,7 @@ while true; do 1) install_prerequisites ;; 2) install_node ;; 3) configure_grpcurl ;; + 4) update_node ;; 4) check_visibility ;; 5) node_info ;; 6) node_logs ;; From 0236ba0d3a412afa63f4f8c36da6715e93ebf391 Mon Sep 17 00:00:00 2001 From: 0xOzgur <29779769+0xOzgur@users.noreply.github.com> Date: Sun, 2 Jun 2024 22:59:19 +0300 Subject: [PATCH 18/22] Quilibrium For Dummies is ready --- Quilibrium.sh => quilibrium_for_dummies.sh | 211 ++++++++++++++++----- 1 file changed, 161 insertions(+), 50 deletions(-) rename Quilibrium.sh => quilibrium_for_dummies.sh (65%) diff --git a/Quilibrium.sh b/quilibrium_for_dummies.sh similarity index 65% rename from Quilibrium.sh rename to quilibrium_for_dummies.sh index 253e98a..a2b6535 100644 --- a/Quilibrium.sh +++ b/quilibrium_for_dummies.sh @@ -1,4 +1,12 @@ -#!/bin/bash +#!/bin/bash -i + +# Source .bashrc to make GO work if it is not working +source ~/.bashrc + +clear + +# Set the version number +VERSION="1.4.18" # Get system information ARCH=$(uname -m) @@ -8,14 +16,18 @@ OS=$(uname -s) if [ "$ARCH" = "x86_64" ]; then if [ "$OS" = "Linux" ]; then NODE_BINARY='node-1.4.18-linux-amd64' + GO_BINARY='go1.20.14.linux-amd64.tar.gz' elif [ "$OS" = "Darwin" ]; then NODE_BINARY='node-1.4.18-darwin-amd64' + GO_BINARY='go1.20.14.linux-amd64.tar.gz' fi elif [ "$ARCH" = "aarch64" ]; then if [ "$OS" = "Linux" ]; then NODE_BINARY='node-1.4.18-linux-arm64' + GO_BINARY='go1.20.14.linux-arm64.tar.gz' elif [ "$OS" = "Darwin" ]; then - NODE_BINARY='node-1.4.18-darwin-arm64' + NODE_BINARY='node-1.4.18-darwin-arm64.tar.gz' + GO_BINARY='go1.20.14.linux-arm64.tar.gz' fi fi @@ -23,11 +35,36 @@ fi install_prerequisites() { echo "Installing prerequisites..." -apt install cpulimit -y -apt install gawk -y #incase it is not instal +echo "Updating the machine" +echo "⏳Processing..." +sleep 2 # Add a 2-second delay -wget https://go.dev/dl/go1.20.14.linux-amd64.tar.gz -sudo tar -xvf go1.20.14.linux-amd64.tar.gz || { echo "Failed to extract Go! Exiting..."; exit_message; exit 1; } +# Fof DEBIAN OS - Check if sudo and git is installed +if ! command -v sudo &> /dev/null +then + echo "sudo could not be found" + echo "Installing sudo..." + su -c "apt update && apt install sudo -y" +else + echo "sudo is installed" +fi + +if ! command -v git &> /dev/null +then + echo "git could not be found" + echo "Installing git..." + su -c "apt update && apt install git -y" +else + echo "git is installed" +fi +sudo apt update +sudo apt upgrade -y + +apt install cpulimit -y +apt install gawk -y #incase it is not installed + +wget https://go.dev/dl/$GO_BINARY || { echo "Failed to download Node! Exiting..."; exit_message; exit 1; } +sudo tar -xvf $GO_BINARY || { echo "Failed to extract Go! Exiting..."; exit_message; exit 1; } sudo mv go /usr/local || { echo "Failed to move go! Exiting..."; exit_message; exit 1; } sudo rm go1.20.14.linux-amd64.tar.gz || { echo "Failed to remove downloaded archive! Exiting..."; exit_message; exit 1; } @@ -75,35 +112,9 @@ sleep 1 # Add a 1-second delay go install github.com/fullstorydev/grpcurl/cmd/grpcurl@latest } + install_node() { echo "Installing node..." - # Step 1: Update and Upgrade the Machine -echo "Updating the machine" -echo "⏳Processing..." -sleep 2 # Add a 2-second delay - -# Fof DEBIAN OS - Check if sudo and git is installed -if ! command -v sudo &> /dev/null -then - echo "sudo could not be found" - echo "Installing sudo..." - su -c "apt update && apt install sudo -y" -else - echo "sudo is installed" -fi - -if ! command -v git &> /dev/null -then - echo "git could not be found" - echo "Installing git..." - su -c "apt update && apt install git -y" -else - echo "git is installed" -fi - -sudo apt upgrade -y - - # Step 2: Adjust network buffer sizes echo "Adjusting network buffer sizes..." if grep -q "^net.core.rmem_max=600000000$" /etc/sysctl.conf; then @@ -153,8 +164,6 @@ cd ~/ceremonyclient/ git remote set-url origin https://source.quilibrium.com/quilibrium/ceremonyclient.git || git remote set-url origin https://git.quilibrium-mirror.ch/agostbiro/ceremonyclient.git git checkout release -# Set the version number -# VERSION="1.4.18" # Get the system architecture # ARCH=$(uname -m) @@ -210,11 +219,67 @@ echo "🎉Welcome to Quilibrium Ceremonyclient" configure_grpcurl() { echo "Configuring grpcurl..." - # Your code here + line_exists() { + grep -qF "$1" "$2" +} + +# Step 1: Enable gRPC +echo "Enabling gRPC..." +cd "$HOME/ceremonyclient/node" || { echo "Failed to change directory to ~/ceremonyclient/node! Exiting..."; exit 1; } + +# Check if the line listenGrpcMultiaddr: /ip4/127.0.0.1/tcp/8337 exists +if ! line_exists "listenGrpcMultiaddr: /ip4/127.0.0.1/tcp/8337" .config/config.yml; then + # Check if the line listenGrpcMultiaddr: "" exists + if line_exists "listenGrpcMultiaddr: \"\"" .config/config.yml; then + # Substitute listenGrpcMultiaddr: "" with listenGrpcMultiaddr: /ip4/127.0.0.1/tcp/8337 + sudo sed -i 's#^listenGrpcMultiaddr:.*$#listenGrpcMultiaddr: /ip4/127.0.0.1/tcp/8337#' .config/config.yml || { echo "Failed to enable gRPC! Exiting..."; exit 1; } + else + # Add listenGrpcMultiaddr: /ip4/127.0.0.1/tcp/8337 + echo "listenGrpcMultiaddr: /ip4/127.0.0.1/tcp/8337" | sudo tee -a .config/config.yml > /dev/null || { echo "Failed to enable gRPC! Exiting..."; exit 1; } + fi +else + echo "gRPC already enabled." +fi + + +# Check if the line listenRESTMultiaddr: /ip4/127.0.0.1/tcp/8338 exists +if ! line_exists "listenRESTMultiaddr: /ip4/127.0.0.1/tcp/8338" .config/config.yml; then + # Check if the line listenRESTMultiaddr: "" exists + if line_exists "listenRESTMultiaddr: \"\"" .config/config.yml; then + # Substitute listenRESTMultiaddr: "" with listenRESTMultiaddr: /ip4/127.0.0.1/tcp/8338 + sudo sed -i 's#^listenRESTMultiaddr:.*$#listenRESTMultiaddr: /ip4/127.0.0.1/tcp/8338#' .config/config.yml || { echo "Failed to enable gRPC! Exiting..."; exit 1; } + else + # Add listenRESTMultiaddr: /ip4/127.0.0.1/tcp/8338 + echo "listenRESTMultiaddr: /ip4/127.0.0.1/tcp/8338" | sudo tee -a .config/config.yml > /dev/null || { echo "Failed to enable gRPC! Exiting..."; exit 1; } + fi +else + echo "gRPC already enabled." +fi + + + +# Step 2: Enable Stats Collection +echo "Enabling Stats Collection..." +if ! line_exists " statsMultiaddr: \"/dns/stats.quilibrium.com/tcp/443\"" .config/config.yml; then + sudo sed -i '/^ *engine:/a\ statsMultiaddr: "/dns/stats.quilibrium.com/tcp/443"' .config/config.yml || { echo "Failed to enable Stats Collection! Exiting..."; exit 1; } +else + echo "Stats Collection already enabled." +fi + +# Check if both lines were added successfully +if line_exists "listenGrpcMultiaddr: /ip4/127.0.0.1/tcp/8337" .config/config.yml && line_exists " statsMultiaddr: \"/dns/stats.quilibrium.com/tcp/443\"" .config/config.yml; then + echo "Success: The script successfully edited your config.yml file." +else + echo "ERROR: The script failed to correctly edit your config.yml file." + echo "You may want to follow the online guide to do it manually." + exit 1 +fi + +echo "gRPC calls setup was successful." } update_node() { - echo "Configuring grpcurl..." + echo "Updating node..." service ceremonyclient stop apt install cpulimit -y @@ -279,15 +344,12 @@ sudo systemctl enable ceremonyclient sudo service ceremonyclient start # See the logs of the ceremonyclient service -echo "🎉 Welcome to Quilibrium Ceremonyclient v1.4.18" +echo "🎉 Welcome to Quilibrium Ceremonyclient $VERSION" } check_visibility() { - echo "This script is made with ❤️ by 0xOzgur.eth @ https://quilibrium.space" - echo "⏳You need GO and grpcurl installed and configured on your machine to run this script. If you don't have them, please install and configure grpcurl first." - echo "You can find the installation instructions at https://docs.quilibrium.space/installing-prerequisites" echo "⏳Processing..." - sleep 5 # Add a 5-second delay + sleep 2 # Add a 2-second delay # Bootstrap peer list bootstrap_peers=( @@ -324,18 +386,61 @@ check_visibility() { node_info() { echo "Getting node info..." - cd ~/ceremonyclient/node && ./${NODE_BINARY} -node-info + cd ~/ceremonyclient/node && ./$NODE_BINARY -node-info } node_logs() { echo "Getting node logs..." - sudo journalctl -u ceremonyclient.service -f --no-hostname -o cat + # sudo journalctl -u ceremonyclient.service -f --no-hostname -o cat + # sudo journalctl -u ceremonyclient.service -n 100 --no-hostname -o cat } +restart_node() { + echo "Restarting node..." + service ceremonyclient restart +} + +stop_node() { + echo "Stopping node..." + service ceremonyclient stop + echo "Node stopped" +} + + # Menu - echo "Welcome! Please choose an option:" while true; do + clear + echo "This script is made with ❤️ by 0xOzgur.eth @ https://quilibrium.space" + echo "Welcome to Quilibrium for Dummies!" + +echo " + _____ _ _ _ _ _ + / ___ \ (_) (_) | (_) + | | | |_ _ _| |_| | _ ____ _ _ _ ____ + | | |_| | | | | | | || \ / ___) | | | | \ + \ \____| |_| | | | | |_) ) | | | |_| | | | | + \_____)\____|_|_|_|____/|_| |_|\____|_|_|_| + + ___ + / __) + | |__ ___ ____ + | __) _ \ / ___) + | | | |_| | | + _| \___/|_| + + _____ _ + (____ \ (_) + _ \ \ _ _ ____ ____ _ ____ ___ + | | | | | | | \| \| |/ _ )/___) + | |__/ /| |_| | | | | | | | ( (/ /|___ | + |_____/ \____|_|_|_|_|_|_|_|\____|___/ + " + + + + echo "Please choose an option:" + echo "1) Install Prerequisites" echo "2) Install Node" echo "3) Configure grpCurl" @@ -343,7 +448,9 @@ while true; do echo "5) Check Visibility" echo "6) Node Info" echo "7) Node Logs" - echo "8) Exit" + echo "8) Restart Node" + echo "9) Stop Node" + echo "e) Exit" read -p "Enter your choice: " choice @@ -352,10 +459,14 @@ while true; do 2) install_node ;; 3) configure_grpcurl ;; 4) update_node ;; - 4) check_visibility ;; - 5) node_info ;; - 6) node_logs ;; - 7) break ;; + 5) check_visibility ;; + 6) node_info ;; + 7) node_logs ;; + 8) restart_node ;; + 9) stop_node ;; + e) break ;; *) echo "Invalid option, please try again." ;; esac + + read -n 1 -s -r -p "Press any key to continue" done \ No newline at end of file From e0bcb99a5a9a278ee8d8441f771d00659e13d34d Mon Sep 17 00:00:00 2001 From: 0xOzgur <29779769+0xOzgur@users.noreply.github.com> Date: Sun, 2 Jun 2024 23:13:49 +0300 Subject: [PATCH 19/22] bugfix node logs --- quilibrium_for_dummies.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/quilibrium_for_dummies.sh b/quilibrium_for_dummies.sh index a2b6535..2eeaafa 100644 --- a/quilibrium_for_dummies.sh +++ b/quilibrium_for_dummies.sh @@ -392,7 +392,7 @@ node_info() { node_logs() { echo "Getting node logs..." - # sudo journalctl -u ceremonyclient.service -f --no-hostname -o cat + sudo journalctl -u ceremonyclient.service -f --no-hostname -o cat # sudo journalctl -u ceremonyclient.service -n 100 --no-hostname -o cat } From 696f66a26aa966ed226de6712c67f9b41f46f2f0 Mon Sep 17 00:00:00 2001 From: 0xOzgur <29779769+0xOzgur@users.noreply.github.com> Date: Sun, 2 Jun 2024 23:36:05 +0300 Subject: [PATCH 20/22] Update README.md Quilibrium for Dummies added --- README.md | 25 ++++++++++++++++++++++--- 1 file changed, 22 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index b42ef9d..978b616 100644 --- a/README.md +++ b/README.md @@ -1,13 +1,32 @@ # Quilibrium Tools -Autoinstaller Script for Quilibrium as a Service + +**Quilibrium for Dummies** + +This script is an all-in-one quil usage software for newcomers. + +For installation and first run, please run + + wget https://raw.githubusercontent.com/0xOzgur/QuilibriumTools/main/quilibrium_for_dummies.sh + chmod u+x quilibrium_for_dummies.sh + ./quilibrium_for_dummies.sh + +After first run, when you need to reach your node, you need to run only; + + ./quilibrium_for_dummies.sh + + + + +**Autoinstaller Script for Quilibrium as a Service** Use below command to install v1.4.18 wget -O - https://raw.githubusercontent.com/0xOzgur/QuilibriumTools/main/install/install_quilibrium_service.sh | bash -If you need to upgrade your node from previous version to 1.4.18, apply below command +**Autoupdater** +If you need to update your node from previous version to 1.4.18, apply below command wget -O - https://raw.githubusercontent.com/0xOzgur/QuilibriumTools/main/update.sh | bash -For easy management of your nodes I created some shortcodes. You can import .profile or .bash_profile (Some Debian installations) file and source. Then you can easily query node related infos. \ No newline at end of file +For easy management of your nodes I created some shortcodes. You can import .profile or .bash_profile (Some Debian installations) file and source. Then you can easily query node related infos. From 55a3f761c1962c560d0d0fc9efd243295d37c3fd Mon Sep 17 00:00:00 2001 From: 0xOzgur <29779769+0xOzgur@users.noreply.github.com> Date: Mon, 3 Jun 2024 00:25:20 +0300 Subject: [PATCH 21/22] Version variable fixed --- quilibrium_for_dummies.sh | 59 ++++++++++++++++++++------------------- 1 file changed, 31 insertions(+), 28 deletions(-) diff --git a/quilibrium_for_dummies.sh b/quilibrium_for_dummies.sh index 2eeaafa..a654012 100644 --- a/quilibrium_for_dummies.sh +++ b/quilibrium_for_dummies.sh @@ -8,38 +8,40 @@ clear # Set the version number VERSION="1.4.18" -# Get system information +# Determine the ExecStart line based on the architecture ARCH=$(uname -m) OS=$(uname -s) # Determine the node binary name based on the architecture and OS if [ "$ARCH" = "x86_64" ]; then if [ "$OS" = "Linux" ]; then - NODE_BINARY='node-1.4.18-linux-amd64' - GO_BINARY='go1.20.14.linux-amd64.tar.gz' + NODE_BINARY="node-$VERSION-linux-amd64" + GO_BINARY="go1.20.14.linux-amd64.tar.gz" elif [ "$OS" = "Darwin" ]; then - NODE_BINARY='node-1.4.18-darwin-amd64' - GO_BINARY='go1.20.14.linux-amd64.tar.gz' + NODE_BINARY="node-$VERSION-darwin-amd64" + GO_BINARY="go1.20.14.linux-amd64.tar.gz" fi elif [ "$ARCH" = "aarch64" ]; then if [ "$OS" = "Linux" ]; then - NODE_BINARY='node-1.4.18-linux-arm64' - GO_BINARY='go1.20.14.linux-arm64.tar.gz' + NODE_BINARY="node-$VERSION-linux-arm64" + GO_BINARY="go1.20.14.linux-arm64.tar.gz" elif [ "$OS" = "Darwin" ]; then - NODE_BINARY='node-1.4.18-darwin-arm64.tar.gz' - GO_BINARY='go1.20.14.linux-arm64.tar.gz' + NODE_BINARY="node-$VERSION-darwin-arm64.tar.gz" + GO_BINARY="go1.20.14.linux-arm64.tar.gz" fi fi # Function for each menu option install_prerequisites() { echo "Installing prerequisites..." +sleep 1 # Add a 1-second delay echo "Updating the machine" echo "⏳Processing..." -sleep 2 # Add a 2-second delay +sleep 1 # Add a 1-second delay # Fof DEBIAN OS - Check if sudo and git is installed +# Step 1.1: Prepare Machine if ! command -v sudo &> /dev/null then echo "sudo could not be found" @@ -48,7 +50,7 @@ then else echo "sudo is installed" fi - +# ınstall git if not installed if ! command -v git &> /dev/null then echo "git could not be found" @@ -57,21 +59,25 @@ then else echo "git is installed" fi + +# Update the machine sudo apt update sudo apt upgrade -y +# Install cpu limit and gawk apt install cpulimit -y apt install gawk -y #incase it is not installed +# Download and install Go wget https://go.dev/dl/$GO_BINARY || { echo "Failed to download Node! Exiting..."; exit_message; exit 1; } sudo tar -xvf $GO_BINARY || { echo "Failed to extract Go! Exiting..."; exit_message; exit 1; } sudo mv go /usr/local || { echo "Failed to move go! Exiting..."; exit_message; exit 1; } sudo rm go1.20.14.linux-amd64.tar.gz || { echo "Failed to remove downloaded archive! Exiting..."; exit_message; exit 1; } -# Step 4: Set Go environment variables +# Set Go environment variables echo "⏳Setting Go environment variables..." -sleep 5 # Add a 5-second delay +sleep 2 # Add a 2-second delay # Check if GOROOT is already set if grep -q 'GOROOT=/usr/local/go' ~/.bashrc; then @@ -100,11 +106,11 @@ fi # Source .bashrc to apply changes echo "⏳Sourcing .bashrc to apply changes" source ~/.bashrc -sleep 5 # Add a 5-second delay +sleep 2 # Add a 2-second delay # Check GO Version go version -sleep 5 # Add a 5-second delay +sleep 2 # Add a 2-second delay # Install gRPCurl echo "⏳Installing gRPCurl" @@ -112,10 +118,10 @@ sleep 1 # Add a 1-second delay go install github.com/fullstorydev/grpcurl/cmd/grpcurl@latest } - +# Install Node install_node() { echo "Installing node..." -# Step 2: Adjust network buffer sizes +# Adjust network buffer sizes echo "Adjusting network buffer sizes..." if grep -q "^net.core.rmem_max=600000000$" /etc/sysctl.conf; then echo "net.core.rmem_max=600000000 found inside /etc/sysctl.conf, skipping..." @@ -129,7 +135,7 @@ else fi sudo sysctl -p -# Step 3: Check if directory ~/ceremonyclient exists, download from github +# Check if directory ~/ceremonyclient exists, download from github if [ -d ~/ceremonyclient ]; then # Check if backup directory ~/backup/qnode_keys exists, if not create it if [ ! -d ~/backup/qnode_keys ]; then @@ -148,7 +154,7 @@ if [ -d ~/ceremonyclient ]; then fi fi -# Step 4:Download Ceremonyclient +# Download Ceremonyclient echo "⏳Downloading Ceremonyclient" sleep 1 # Add a 1-second delay cd ~ @@ -165,10 +171,7 @@ git remote set-url origin https://source.quilibrium.com/quilibrium/ceremonyclien git checkout release -# Get the system architecture -# ARCH=$(uname -m) -# Step 5:Determine the ExecStart line based on the architecture # Get the current user's home directory HOME=$(eval echo ~$HOME_DIR) @@ -208,12 +211,12 @@ EOF sudo systemctl daemon-reload sudo systemctl enable ceremonyclient -# Step 7: Start the ceremonyclient service +# Start the ceremonyclient service echo "✅Starting Ceremonyclient Service" sleep 1 # Add a 1-second delay sudo service ceremonyclient start -# Step 8: See the logs of the ceremonyclient service +# See the logs of the ceremonyclient service echo "🎉Welcome to Quilibrium Ceremonyclient" } @@ -258,7 +261,7 @@ fi -# Step 2: Enable Stats Collection +# Enable Stats Collection echo "Enabling Stats Collection..." if ! line_exists " statsMultiaddr: \"/dns/stats.quilibrium.com/tcp/443\"" .config/config.yml; then sudo sed -i '/^ *engine:/a\ statsMultiaddr: "/dns/stats.quilibrium.com/tcp/443"' .config/config.yml || { echo "Failed to enable Stats Collection! Exiting..."; exit 1; } @@ -286,7 +289,7 @@ apt install cpulimit -y apt install gawk -y #incase it is not installed # Step 1:Download Binary -echo "⏳ Downloading New Release v1.4.18" +echo "⏳ Downloading New Release v$VERSION" cd ~/ceremonyclient git remote set-url origin https://source.quilibrium.com/quilibrium/ceremonyclient.git || git remote set-url origin https://git.quilibrium-mirror.ch/agostbiro/ceremonyclient.git git pull @@ -299,7 +302,7 @@ HOME=$(eval echo ~$HOME_DIR) NODE_PATH="$HOME/ceremonyclient/node" EXEC_START="$NODE_PATH/release_autorun.sh" -# Step 3:Re-Create Ceremonyclient Service +# Re-Create Ceremonyclient Service echo "⏳ Re-Creating Ceremonyclient Service" sleep 2 # Add a 2-second delay SERVICE_FILE="/lib/systemd/system/ceremonyclient.service" @@ -344,7 +347,7 @@ sudo systemctl enable ceremonyclient sudo service ceremonyclient start # See the logs of the ceremonyclient service -echo "🎉 Welcome to Quilibrium Ceremonyclient $VERSION" +echo "🎉 Welcome to Quilibrium Ceremonyclient v$VERSION" } check_visibility() { From c64153f4277fc3a549810f5d22b278d5f2badd81 Mon Sep 17 00:00:00 2001 From: 0xOzgur <29779769+0xOzgur@users.noreply.github.com> Date: Mon, 3 Jun 2024 00:28:13 +0300 Subject: [PATCH 22/22] expalanation prune --- quilibrium_for_dummies.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/quilibrium_for_dummies.sh b/quilibrium_for_dummies.sh index a654012..f3a05a0 100644 --- a/quilibrium_for_dummies.sh +++ b/quilibrium_for_dummies.sh @@ -179,7 +179,7 @@ HOME=$(eval echo ~$HOME_DIR) NODE_PATH="$HOME/ceremonyclient/node" EXEC_START="$NODE_PATH/release_autorun.sh" -# Step 6:Create Ceremonyclient Service +# Create Ceremonyclient Service echo "⏳ Creating Ceremonyclient Service" sleep 2 # Add a 2-second delay @@ -226,7 +226,7 @@ configure_grpcurl() { grep -qF "$1" "$2" } -# Step 1: Enable gRPC +# Enable gRPC echo "Enabling gRPC..." cd "$HOME/ceremonyclient/node" || { echo "Failed to change directory to ~/ceremonyclient/node! Exiting..."; exit 1; } @@ -288,7 +288,7 @@ update_node() { apt install cpulimit -y apt install gawk -y #incase it is not installed -# Step 1:Download Binary +# Download Binary echo "⏳ Downloading New Release v$VERSION" cd ~/ceremonyclient git remote set-url origin https://source.quilibrium.com/quilibrium/ceremonyclient.git || git remote set-url origin https://git.quilibrium-mirror.ch/agostbiro/ceremonyclient.git @@ -339,7 +339,7 @@ else fi fi -# Step 4:Start the ceremonyclient service +# Start the ceremonyclient service echo "✅ Starting Ceremonyclient Service" sleep 2 # Add a 2-second delay sudo systemctl daemon-reload