diff --git a/Liteserver-hostnames-fix.sh b/Liteserver-hostnames-fix.sh new file mode 100644 index 0000000..85bf3df --- /dev/null +++ b/Liteserver-hostnames-fix.sh @@ -0,0 +1,14 @@ +#!/bin/bash +echo "Created by Kasiimh1 - https://gist.github.com/kasiimh1/7d6d72e9def6ea6b1103c90ae89007e8" + +#Fix 'unable to resolve host VPSHOSTNAME: Name or service not known' on Liteserver! +hostname="$(cat /proc/sys/kernel/hostname)" +echo -n "Do you have the 'hostname: Name or service not known' when signing in via SSH? (y/n)? " +read answer + +if [ "$answer" != "${answer#[Yy]}" ]; then + echo "Editing hostfile to add $hostname entry" + echo "127.0.0.1 " $hostname >> /etc/hosts +fi + +echo "Exiting!" diff --git a/Migrate.README.md b/Migrate.README.md new file mode 100644 index 0000000..2dc3b34 --- /dev/null +++ b/Migrate.README.md @@ -0,0 +1,71 @@ +# StorX Farmer Node Migration Tool +**Allow seamless moving of a a Farmer/Storage Node on StorX Network** + +**Preliminaries** +- Already running and staked node: instructions found below if not already setup: + +``` + https://github.com/StorXNetwork/StorX-Node/blob/main/README.md + ``` + +- Mutilple VPS's, the source staked node and the destination node. + +**Warning:** + +- Currently staked node will have it's reputation changed back to 1 (your SRX is still staked) upon reaching over 10 reputation the status of the node will change back to farmer, rewards will contiune. + +- In talks with the devs (to allow new/updated IP Address to be allocated to a staked node, without rep resetting to 0). + +----- + +# How To Migrate StorX Farmer Node + +**Fetch Migrate Script** + +Bootstrap Command StorX Node Migration from Github:- +``` + sudo su -c "bash <(wget -qO- https://raw.githubusercontent.com/kasiimh1/StorX-Node/main/migrate-tool.sh)" root +``` + +Execute the script by running the command below: + +``` +bash StorX-Node-Migrate-Tool.sh +``` + +Will ask you to enter the following: + +**VPS IP ADDRESS**: e.g. 192.168.0.1 + +**VPS SSH Password**: e.g. alpine + +--------------------------------- + +## Features + +- Automatically install all dependencies +- Fetch latest StorX Files for Docker +- Copy all existing Files from Source Node -> Destination Node (including all data files, config files and auto updates them to work on the new VPS) +- Starts Up the StorX Farmer Node on Destination VPS +- Shuts Down StorX Farmer Node on Source VPS +- *Keeps Files/Folders intact on Source VPS* + + +## How It Works + +- Installs dependencies on new VPS +- zip exisiting StorX-Node folder +- scp copy from Source -> Destination VPS +- Fetch latest docker image +- start up node on Destination VPS and shutdown node on Source VPS + +*Files remain on Source VPS* + +## Troubleshooting + +Public discussions on the technical issues, post articles and request for Enhancements and Technical Contributions. + +- [Telegram](https://t.me/StorXNetwork) - Stay updated with all the Announcements. +- [Discord](https://discord.gg/ha4Jufj2Nm) - Join the community to find answers to all your questions. +- [Reddit](https://www.reddit.com/r/StorXNetwork) - Join the channel to have a healthy interaction with the community. +- [GitHub](https://github.com/StorXNetwork) - Join the developers community on GitHub diff --git a/README.md b/README.md index 75bc11f..dc4fa65 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,5 @@ # StorX Farmer Node + **Run a Farmer/Storage Node on StorX Network** This guide will instruct you how to set up Farmer/Storage Node on the StorX Network @@ -8,16 +9,31 @@ This guide will instruct you how to set up Farmer/Storage Node on the StorX Netw - If there are any issues the possibility of your node getting slashed. - To compensate for the efforts, running a community memes are rewarded with SRX Tokens, knowing that you contribute to the security of a decentralized network while growing your stash. - If you need help, please reach out on the [Community Page](https://storx.tech/support.html). The community members are there to help answer questions and provide tips from experience. +------ + **How many SRX (StorX Native Tokens) do I need?** -To qualify for Farmer/Storage Node on StorX Network, you need between **1000 - 1 Million SRX,** with the existential deposit, plus **XDC for transaction fees.** +To qualify for Farmer/Storage Node on StorX Network, you need between **6000 - 1 Million SRX,** with the existential deposit, plus **XDC for transaction fees.** + +**Note: The minimum staking amount will be updated as per the new incremental model from 03/08/2021 onwards. [Refer](https://medium.com/storx-network/storx-farm-node-minimum-staking-increment-model-to-avoid-srx-token-inflation-7a343cf89401)** + +----- + +We requests Storage Node operators to maintain Good Node Reputation to ensure StorX Ecosystem works perfectly. + +**Tips for maintaining a Good Node Reputation:** +- Ensure Strong Cloud Infrastructure. +- Higher SRX Stake adds value to “Good” Node Reputation. +- Ensure 100% uptime. +- Always ensure nodes maintain the latest software patch and OS updates. + **Warning:** -Any SRX that you stake for Farmer/Storage Node on StorX Network is liable to be slashed, meaning that an insecure or improper setup may result in loss of reputation leading to slashing of Farmer/Storage Node on StorX Network. +- Underperformance can lead to disqualification of nodes, which can lead to No ‘hosting and staking rewards’. Repeated low reputation can lead to a penalty; Staked SRX might be burned as a penalty as it may harm StorX Storage Network. +- Any SRX that you stake for Farmer/Storage Node on StorX Network is liable to be slashed, meaning that an insecure or improper setup may result in loss of reputation leading to slashing of Farmer/Storage Node on StorX Network. ----- @@ -127,38 +143,14 @@ How to upgrade your StorX node with the latest changes? sudo bash ./upgrade.sh ``` -## How to change a node's wallet address - -``` - cd StorX-Node -``` +## How to Migrate your StorX Farmer Node +How to Migrate your StorX node to another VPS? -Get the current (i.e. Old) wallet address that you want to update: -``` - sed -n 's/^WALLETADD=*//p' .env -``` +https://github.com/kasiimh1/StorX-Node/blob/main/Migrate.README.md -Update the wallet address (copy the old one from the CLI response above): +## Fix 'hostname: Name or service not known' on Liteserver -``` - sed -i 's/OldWalletAddress/NewWalletAddress/g' .env -``` - -Replace OldWalletAddress and NewWalletAddress above with your actual old and new wallet addresses - -Re-start the StorX Node app (as described in the previous sections) - -``` - sudo docker-compose -f docker-services.yml down - sudo docker-compose -f docker-services.yml up -d - -``` - -Finally, if desired, you can check the node status (as described in the previous sections) - -``` - sudo bash ./getstatus.sh -``` +``` sudo su -c "bash <(wget -qO- https://raw.githubusercontent.com/kasiimh1/StorX-Node/main/Liteserver-hostnames-fix.sh)" root ``` ## Troubleshooting diff --git a/migrate-tool.sh b/migrate-tool.sh new file mode 100644 index 0000000..378051b --- /dev/null +++ b/migrate-tool.sh @@ -0,0 +1,62 @@ +#!/bin/bash +echo "Created by Kasiimh1 - https://gist.github.com/kasiimh1/6c856393f622b816febdaeffd8e9f4c6" + +echo "Enter Source VPS IP" +read sourceIP + +echo "Installing dependencies" +sudo apt-get update + +sudo apt-get install \ + apt-transport-https \ + ca-certificates \ + curl \ + git \ + p7zip-full \ + software-properties-common -y + +echo "Zipping Source StorX-Node folder for migration" +ssh root@$sourceIP 'sudo apt-get install p7zip-full && 7z a StorX-Node.zip StorX-Node/' + +echo "Copying files to new VPS" +scp -r root@$sourceIP:/root/StorX-Node.zip ./ + +echo "Inflating files to /StorX-Node" +sudo 7z x StorX-Node.zip +cd StorX-Node + +echo "Installing Docker" +curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add - + +sudo add-apt-repository \ + "deb [arch=amd64] https://download.docker.com/linux/ubuntu \ + $(lsb_release -cs) \ + stable" + +sudo apt-get update +sudo apt-get install docker-ce -y + +echo "Installing Docker-Compose" + +curl -L "https://github.com/docker/compose/releases/download/1.29.2/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose + +chmod +x /usr/local/bin/docker-compose +sleep 5 +echo "Docker Compose Installed successfully" + +echo "Upgrading StorX Network Configuration Scripts" + +git pull +echo "Upgrading Docker Images" +sudo docker pull storxnetwork/storxnode:latest + +echo "Shutting Down Source Node" +ssh root@$sourceIP 'cd StorX-Node && sudo docker-compose -f docker-services.yml down' + +echo "Shutting Down Node" +sudo docker-compose -f docker-services.yml down + +echo "Starting Up Node" + +sudo docker-compose -f docker-services.yml up -d +echo "Congrats! Your Node has been successfully updated with latest changes and been migrated to new VPS!" diff --git a/upgrade.sh b/upgrade.sh index 1d24362..2563a8f 100644 --- a/upgrade.sh +++ b/upgrade.sh @@ -1,9 +1,16 @@ #!/bin/bash - +echo "Fetching Distro Updates & Upgrades" +apt update +apt upgrade -y +apt dist-upgrade -y +echo "Removing unused files that were automatically installed!" +apt autoremove -y echo "Upgrading StorX Network Configuration Scripts" git pull echo "Upgrading Docker Images" sudo docker pull storxnetwork/storxnode:latest sudo docker-compose -f docker-services.yml down sudo docker-compose -f docker-services.yml up -d -echo "Congrats! Your Node has been successfully updated with latest changes!" \ No newline at end of file +echo "Congrats! Your Node has been successfully updated with latest changes!" +echo "Restarting VPS ....." +sudo reboot \ No newline at end of file