diff --git a/install/install_docker.sh b/install/install_docker.sh index aed9097..65158d2 100644 --- a/install/install_docker.sh +++ b/install/install_docker.sh @@ -55,11 +55,12 @@ echo "⏳Downloading Ceremonyclient" sleep 2 # Add a 2-second delay git clone https://github.com/QuilibriumNetwork/ceremonyclient.git cd ~/ceremonyclient +git checkout release # Step 7:Build Docker Container echo "⏳Building Ceremonyclient Container" sleep 2 # Add a 2-second delay -docker build --build-arg GIT_COMMIT=$(git log -1 --format=%h) -t quilibrium -t quilibrium:1.4.17 . +docker build --build-arg GIT_COMMIT=$(git log -1 --format=%h) -t quilibrium -t quilibrium:1.4.18 . # Step 8:Run Ceremonyclient Container echo "✅Running Ceremonyclient Container" diff --git a/install/install_quilibrium_service.sh b/install/install_quilibrium_service.sh index 4612ba1..35887ca 100644 --- a/install/install_quilibrium_service.sh +++ b/install/install_quilibrium_service.sh @@ -1,10 +1,12 @@ #!/bin/bash cd ~ - # Step 0: Welcome -echo "This script is made with ❤️ by 0xOzgur.eth" -echo "⏳Enjoy and sit back while you are building your Quilibrium Ceremony Client!" + +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 @@ -12,8 +14,11 @@ sleep 10 # Add a 10-second delay echo "Updating the machine" echo "⏳Processing..." sleep 2 # Add a 2-second delay -apt-get update -apt-get upgrade -y + +sudo apt update +sudo apt upgrade -y +sudo apt install git -y + # Step 2: Adjust network buffer sizes echo "Adjusting network buffer sizes..." @@ -29,28 +34,82 @@ else fi sudo sysctl -p -# Step 3:Download Ceremonyclient +# Step 3: Check if directory ~/ceremonyclient exists and remove it +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 + + # Remove existing directory ~/ceremonyclient + echo "🗑️ Removing existing directory ~/ceremonyclient..." + rm -rf ~/ceremonyclient +fi + +# Step 4:Download Ceremonyclient echo "⏳Downloading Ceremonyclient" -sleep 2 # Add a 2-second delay -git clone https://github.com/QuilibriumNetwork/ceremonyclient.git +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://github.com/QuilibriumNetwork/ceremonyclient.git; do + echo "Git clone failed, retrying..." + sleep 2 + done +fi +cd ~/ceremonyclient/ +git checkout release -cd ~/ceremonyclient/node +# Set the version number +VERSION="1.4.18" -# Step 4:Download Binary -echo "⏳Downloading Binary" -sleep 2 # Add a 2-second delay -wget https://github.com/QuilibriumNetwork/ceremonyclient/releases/download/v1.4.17/node-1.4.17-linux-amd64.bin -ls -mv node*.bin node +# Get the system architecture +ARCH=$(uname -m) -# Step 5:Make the file executable -echo "⏳Making the Binary executable" -sleep 2 # Add a 2-second delay -chmod +x node +# 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" + +if [ "$ARCH" = "x86_64" ]; then + EXEC_START="$NODE_PATH/node-$VERSION-linux-amd64" +elif [ "$ARCH" = "aarch64" ]; then + EXEC_START="$NODE_PATH/node-$VERSION-linux-arm64" +elif [ "$ARCH" = "arm64" ]; then + EXEC_START="$NODE_PATH/node-$VERSION-darwin-arm64" +else + echo "Unsupported architecture: $ARCH" + exit 1 +fi # Step 6:Create Ceremonyclient Service -echo "⏳Creating Ceremonyclient Service" +echo "⏳ Re-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 || true - - -alias e="exit" -alias cm="ps -eo comm,pcpu --sort -pcpu | head -8; ps -eo comm,pmem --sort -pmem | head -8" -alias st='curl -s https://raw.githubusercontent.com/sivel/speedtest-cli/master/speedtest.py | python3' -alias myip='curl icanhazip.com' -alias wttr='curl wttr.in' - -neofetch - - -alias peer-count='cd ~/ceremonyclient/node && grpcurl -plaintext -max-msg-sz 150000000 localhost:8337 quilibrium.node.node.pb.NodeService.GetPeerInfo | grep peerId | wc -l && cd ~' -alias node-info='cd ~/ceremonyclient/node && GOEXPERIMENT=arenas go run ./... -node-info && cd ~' -alias db-console='cd ~/ceremonyclient/node && - GOEXPERIMENT=arenas go run ./... --db-console && cd ~' -alias balance='cd ~/ceremonyclient/node && GOEXPERIMENT=arenas go run ./... -balance && cd ~' -alias nlog='sudo journalctl -u ceremonyclient.service -f --no-hostname -o cat' -alias nstart='service ceremonyclient start' -alias nrestart='service ceremonyclient restart' -alias nstop='service ceremonyclient stop' diff --git a/update.sh b/update.sh index 485c978..633caec 100644 --- a/update.sh +++ b/update.sh @@ -1,8 +1,9 @@ #!/bin/bash # Step 0: Welcome -echo "This script is made with ❤️ by 0xOzgur.eth" +echo "This script is made with ❤️ by https://quilibrium.space @ 0xOzgur.eth" 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..." sleep 10 # Add a 10-second delay @@ -15,6 +16,30 @@ cd ~/ceremonyclient git pull git checkout release +# Set the version number +VERSION="1.4.18" + +# Get the system architecture +ARCH=$(uname -m) + +# Get the current user's home directory +HOME=$(eval echo ~$HOME_DIR) + +# Use the home directory in the path +NODE_PATH="$HOME/ceremonyclient/node" + +# Step10.1:Determine the ExecStart line based on the architecture +if [ "$ARCH" = "x86_64" ]; then + EXEC_START="$NODE_PATH/node-$VERSION-linux-amd64" +elif [ "$ARCH" = "aarch64" ]; then + EXEC_START="$NODE_PATH/node-$VERSION-linux-arm64" +elif [ "$ARCH" = "arm64" ]; then + EXEC_START="$NODE_PATH/node-$VERSION-darwin-arm64" +else + echo "Unsupported architecture: $ARCH" + exit 1 +fi + # Step 3:Re-Create Ceremonyclient Service echo "⏳ Re-Creating Ceremonyclient Service" sleep 2 # Add a 2-second delay @@ -28,7 +53,7 @@ Type=simple Restart=always RestartSec=5s WorkingDirectory=/root/ceremonyclient/node -ExecStart=/root/ceremonyclient/node/node-1.4.18-linux-amd64 +ExecStart=$EXEC_START [Install] WantedBy=multi-user.target @@ -37,9 +62,9 @@ EOF # Step 4:Start the ceremonyclient service echo "✅ Starting Ceremonyclient Service" sleep 2 # Add a 2-second delay -systemctl daemon-reload -systemctl enable ceremonyclient -service ceremonyclient start +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"