diff --git a/contrib/validators/automatic-fullnode-installer.sh b/contrib/validators/automatic-fullnode-installer.sh new file mode 100644 index 0000000000..d2ec445350 --- /dev/null +++ b/contrib/validators/automatic-fullnode-installer.sh @@ -0,0 +1,129 @@ +#################################### +## Variables +#################################### +MONIKER=$1 +if [ -z "$MONIKER" ]; then + echo "Validator moniker not given. Please specify it as the first argument" + exit 0 +fi + +USER=$(id -u -n) + + +#################################### +## Setup environmental variables +#################################### +echo "===> Setting up environmental variables" + +if [ -z "$GOBIN" ]; then + { + echo "export GOBIN=$HOME/go/bin" >> ~/.profile + source ~/.profile + } &> /dev/null +fi + +if [ -z "$DAEMON_NAME" ]; then + { + echo " " >> ~/.profile + echo "# Setup Cosmovisor" >> ~/.profile + echo "export DAEMON_NAME=desmosd" >> ~/.profile + echo "export DAEMON_HOME=$HOME/.desmosd" >> ~/.profile + echo "export DAEMON_RESTART_AFTER_UPGRADE=on" >> ~/.profile + source ~/.profile + } &> /dev/null +fi + +echo "===> Completed environmental variables setup" +echo "" + +#################################### +## Setup Cosmovisor +#################################### +echo "===> Setting up Cosmovisor" + +echo "=====> Downloading Cosmovisor" +# Download Cosmovisor +{ + git clone https://github.com/cosmos/cosmos-sdk.git ~/cosmos + cd ~/cosmos/cosmovisor + make cosmovisor + cp cosmovisor $GOBIN/cosmovisor + cd ~ +} &> /dev/null + +# Prepare Cosmovisor +echo "=====> Installing up Cosmovisor" +{ + wget -O desmosd-cosmovisor.zip http://ipfs.io/ipfs/QmbHnXy4mGuCDEaJF18DGTF86vtbgLZG5cffowoZypgwUj + mkdir -p ~/.desmosd + unzip desmosd-cosmovisor.zip -d ~/.desmosd +} &> /dev/null + +echo "===> Completed Cosmovisor setup" +echo "" + +#################################### +## Setup Desmos +#################################### +echo "===> Setting up Desmos" + +# Setup desmosd to use Cosmovisor +{ + alias desmosd=~/.desmosd/cosmovisor/current/bin/desmosd + alias desmoscli=~/.desmosd/cosmovisor/current/bin/desmoscli +} &> /dev/null + +# Setup the chain +echo "=====> Initializing the chain" +{ + desmosd init $MONIKER +} &> /dev/null + +# Download the genesis file +echo "=====> Downloading the genesis file" +{ + curl https://raw.githubusercontent.com/desmos-labs/morpheus/master/genesis.json -o $HOME/.desmosd/config/genesis.json +} &> /dev/null + +# Setup the persistent peers +echo "=====> Setting persistent peers" +{ + sed -i -e 's/persistent_peers = ""/persistent_peers = "7fed5624ca577eb0333d3631b5e4f16ba1736979@54.180.98.75:26656,5077b7964d71d8758f7fc01cac01d0e2d55b8c18@18.196.238.210:26656,bdd98ec74fe56146f08e886239e52373f6821ce3@51.15.113.208:26656,e30d9bb713d17d1e4380b2e2a6df4b5c76c73eb1@34.212.106.82:26656"/g' ~/.desmosd/config/config.toml +} &> /dev/null + +echo "===> Completed Desmos setup" +echo "" + +#################################### +## Setup the service +#################################### +echo "===> Setting up Desmos service" + +{ + FILE=/etc/systemd/system/desmosd.service + sudo tee $FILE > /dev/null < /dev/null + +echo "====> Starting Desmos service" +{ + sudo systemctl daemon-reload + sudo systemctl enable desmosd + sudo systemctl start desmosd +} &> /dev/null + +tail -100f /var/log/syslog diff --git a/docs/.vuepress/config.js b/docs/.vuepress/config.js index ee659c5029..c026af9fe0 100644 --- a/docs/.vuepress/config.js +++ b/docs/.vuepress/config.js @@ -91,7 +91,15 @@ module.exports = { collapsable: true, children: [ ["fullnode/overview", "Overview"], - ["fullnode/setup", "Setup"], + { + title: "Setup", + collapsable: false, + children: [ + ["fullnode/setup/overview", "Overview"], + ["fullnode/setup/automatic", "Automatic setup"], + ["fullnode/setup/manual", "Manual setup"], + ] + }, ["fullnode/rocksdb-installation", "Using RocksDB"], ["fullnode/update", "Update"], ] diff --git a/docs/fullnode/overview.md b/docs/fullnode/overview.md index 1b72630087..80ebe9e808 100644 --- a/docs/fullnode/overview.md +++ b/docs/fullnode/overview.md @@ -3,4 +3,4 @@ A full-node is a program that fully validates transactions and blocks of a block Of course, it is possible and encouraged for users to run full-nodes even if they do not plan to be validators. -If you would like to become a **Desmos** validator, you must first run a **Desmos** fullnode. To do so, please refer to the [installation instructions](setup.md). +If you would like to become a **Desmos** validator, you must first run a **Desmos** fullnode. To do so, please refer to the [installation instructions](setup/overview.md). diff --git a/docs/fullnode/setup/automatic.md b/docs/fullnode/setup/automatic.md new file mode 100644 index 0000000000..c6b913ba12 --- /dev/null +++ b/docs/fullnode/setup/automatic.md @@ -0,0 +1,59 @@ +# Automatic full node setup +Following you will find how to download and execute the script that allows you to run a Desmos full node in minutes. + +:::warning Requirements +Before proceeding, make sure you have read the [overview page](overview.md) and your system satisfied the needed requirements. +::: + +## 1. Download the script +You can get the script by executing + +```shell +wget -O install-desmos-fullnode https://raw.githubusercontent.com/desmos-labs/desmos/master/contrib/validators/automatic-fullnode-installer.sh +``` + +Once you downloaded it properly, you need to change its permissions making it executable: + +```shell +chmod +x ./install-desmos-fullnode +``` + +## 2. Execute the script +Once you got the script, you are now ready to use it. + +### Parameters +In order to work, it needs the following parameters: + +1. The `moniker` of the validator you are creating. + This is just a string that will allow you to identify the validator you are running locally. It can be anything you want. + +### Running the script +Once you are ready to run the script, just execute: + +```shell +./install-desmos-fullnode +``` + +E.g: + +``` +./install-desmos-fullnode my-validator +``` + +## How it works +The script will perform the following operations. + +1. **Environment setup** + It will create all the necessary environmental variables. + +2. **Cosmovisor setup** + It will download Cosmovisor and set it up so that your node is able to automatically update based on on-chain upgrades. + +3. **Desmos setup** + It will download and install Desmos properly so that your node is able to start syncing and also update itself based on all the on-chain upgrades that have been done until now. + +4. **Service setup** + It will setup a system service to make sure Desmos runs properly in the background. + +5. **Service start and log output** + Finally, it will start the system service and output the logs from it. You will see it syncing the blocks properly and catching up with the rest of the chain. diff --git a/docs/fullnode/setup.md b/docs/fullnode/setup/manual.md similarity index 71% rename from docs/fullnode/setup.md rename to docs/fullnode/setup/manual.md index 3fd35f8537..77845f9d31 100644 --- a/docs/fullnode/setup.md +++ b/docs/fullnode/setup/manual.md @@ -1,96 +1,16 @@ -# Installing and running a Desmos fullnode +# Manual full node setup +Following you will find the instructions on how to manually setup your Desmos full node. -:::warning This guide is for new fullnodes only -If you have previously run a fullnode and you wish to update it instead, please follow the [updating guide](update.md). +:::warning Requirements +Before starting, make sure you read the [setup overview](overview.md) to make sure your hardware meets the needed requirements. ::: -## Requirements -In order to run a full node, the following minimum hardware requirements should be met: - -- 2 CPU cores -- 4GB of RAM -- 40GB disk space - -However, these requirements **will not** be sufficient in the future. For this reason, if you plan to run your validator node for an indefinite amount of time, we suggest you to use the following hardware: - -- 4 CPU cores -- 8GB of RAM or more -- 512GB of disk space or more - - -## 1. Setup your environment -In order to run a fullnode, you need to build `desmosd` and `desmoscli` which require `Go`, `git`, `gcc` and `make` installed. - -This process depends on your working environment. - -:::: tabs - -::: tab Linux -The following example is based on **Ubuntu (Debian)** and assumes you are using a terminal environment by default. Please run the equivalent commands if you are running other Linux distributions. - -```bash -# Install git, gcc and make -sudo apt install build-essential --yes - -# Install Go with Snap -sudo snap install go --classic - -# Export environment variables -echo 'export GOPATH="$HOME/go"' >> ~/.profile -echo 'export PATH="$GOPATH/bin:$PATH"' >> ~/.profile -source ~/.profile -``` - -::: - -::: tab MacOS -To install the required build tools, simple [install Xcode from the Mac App Store](https://apps.apple.com/hk/app/xcode/id497799835?l=en&mt=12). - -To install `Go` on __MacOS__, the best option is to install with [__Homebrew__](https://brew.sh/). To do so, open the `Terminal` application and run the following command: - -```bash -# Install Homebrew -/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" -``` - - -> If you don't know how to open a `Terminal`, you can search it by typing `terminal` in `Spotlight`. - -After __Homebrew__ is installed, run - -```bash -# Install Go using Homebrew -brew install go - -# Install Git using Homebrew -brew install git - -# Export environment variables -echo 'export GOPATH="$HOME/go"' >> ~/.profile -echo 'export PATH="$GOPATH/bin:$PATH"' >> ~/.profile -source ~/.profile -``` - -::: - -::: tab Windows -The software has not been tested on __Windows__. If you are currently running a __Windows__ PC, the following options should be considered: - -1. Switch to a __Mac__ 👨‍💻. -2. Wipe your hard drive and install a __Linux__ system on your PC. -3. Install a separate __Linux__ system using [VirtualBox](https://www.virtualbox.org/wiki/Downloads) -4. Run a __Linux__ instance on a cloud provider. - -Note that is still possible to build and run the software on __Windows__ but it may give you unexpected results and it may require additional setup to be done. If you insist to build and run the software on __Windows__, the best bet would be installing the [Chocolatey](https://chocolatey.org/) package manager. - -::: - -:::: - -## 2. Build the software +## 1. Build the software +:::tip Choose your DB backend Before installing the software, a consideration must be done. -By default, Desmos uses [LevelDB](https://github.com/google/leveldb) as its database backend engine. However, since version `v0.6.0` we've also added the possibility of optionally using [Facebook's RocksDB](https://github.com/facebook/rocksdb), which, although still being experimental, is know to be faster and could lead to lower syncing times. If you want to try out RocksDB (which we suggest you to do) you can take a look at our [RocksDB installation guide](rocksdb-installation.md) before proceeding further. +By default, Desmos uses [LevelDB](https://github.com/google/leveldb) as its database backend engine. However, since version `v0.6.0` we've also added the possibility of optionally using [Facebook's RocksDB](https://github.com/facebook/rocksdb), which, although still being experimental, is know to be faster and could lead to lower syncing times. If you want to try out RocksDB (which we suggest you to do) you can take a look at our [RocksDB installation guide](../rocksdb-installation.md) before proceeding further. +::: The following operations will all be done in the terminal environment under your home directory. @@ -120,7 +40,7 @@ If the software is built successfully, `desmosd` and `desmoscli` will be located desmosd version --long ``` -## 3. Initialize the Desmos working directory +## 2. Initialize the Desmos working directory Configuration files and chain data will be stored inside the `.desmosd` directory under your home directory by default. It will be created when you initialize the environment. ```bash @@ -130,7 +50,7 @@ desmosd init You can choose any moniker your like. It will be saved in the `config.toml` under the `.desmosd` working directory. -## 4. Get the genesis file +## 3. Get the genesis file To connect to or start a new network, a genesis file is required. The file contains all the settings telling how the genesis block of the network should look like. To connect to the `morpheus` testnets, you will need the corresponding genesis file of each testnet. Visit the [testnet repo](https://github.com/desmos-labs/morpheus) and download the correct genesis file by running the following command. ```bash @@ -142,7 +62,7 @@ rm $HOME/.desmosd/config/genesis.json curl https://raw.githubusercontent.com/desmos-labs/morpheus/master/genesis.json -o $HOME/.desmosd/config/genesis.json ``` -## 5. Connect to persistent peer +## 4. Connect to persistent peer To properly run your node, you will need to connect it to other full nodes running with the same software and genesis file. This can be done configuring the `persisten_peers` value inside the `config.toml` file localed under the `.desmosd` working directory. ```bash @@ -160,7 +80,7 @@ persistent_peers = "7fed5624ca577eb0333d3631b5e4f16ba1736979@54.180.98.75:26656" Save the file and exit the text editor. ## (Optional) Change your database backend -If you would like to run your node using [Facebook's RocksDB](https://github.com/facebook/rocksdb) as the database backend, and you have correctly built the Desmos binaries to work with it following the instructions at [point 2](#2-build-the-software), there is one more thing you need to do. +If you would like to run your node using [Facebook's RocksDB](https://github.com/facebook/rocksdb) as the database backend, and you have correctly built the Desmos binaries to work with it following the instructions at [point 1](#1-build-the-software), there is one more thing you need to do. In order to tell Tendermint to use RocksDB as its database backend engine, you are required to change the following like inside the `config.toml` file: @@ -174,9 +94,9 @@ To become db_backend="rocksdb" ``` -Once you have done so, you can go ahead with [point 6](#6-start-the-desmos-node). +Once you have done so, you can go ahead with [point 5](#5-start-the-desmos-node). -## 6. Start the Desmos node +## 5. Start the Desmos node Now you are good to run the full node. To do so, run: ```bash @@ -232,7 +152,7 @@ You should see an output like the following one: If you see that the `catching_up` value is `false` under the `sync_info`, it means that you are fully synced. If it is `true`, it means your node is still syncing. -After your node is fully synced, you can consider running your full node as a [validator node](../validators/setup.md). +After your node is fully synced, you can consider running your full node as a [validator node](../../validators/setup.md). ## (Optional) Configure the service To allow your `desmosd` instance to run in the background as a service you need to execute the following command diff --git a/docs/fullnode/setup/overview.md b/docs/fullnode/setup/overview.md new file mode 100644 index 0000000000..22a6b35b1f --- /dev/null +++ b/docs/fullnode/setup/overview.md @@ -0,0 +1,119 @@ +# Installing and running a Desmos fullnode + +:::warning This guide is for new fullnodes only +If you have previously run a fullnode and you wish to update it instead, please follow the [updating guide](../update.md). +::: + +## Hardware requirements +### Understanding pruning +In order to run a full node, different hardware requirements should be met based on the pruning strategy you would like to use. + +*Pruning* is the term used to identify the periodic action that can be taken in order to free some disk space on your full node. This is done by removing old blocks data from the disk, freeing up space. + +Inside Desmos, there are various types of pruning strategies that can be applied. The main ones are: + +- `default`: the last 100 states are kept in addition to every 500th state; pruning at 10 block intervals + +- `nothing`: all historic states will be saved, nothing will be deleted (i.e. archiving node) + +- `everything`: all saved states will be deleted, storing only the current state; pruning at 10 block intervals + +### Hardware requirements +You can easily understand how using a pruning strategy of `nothing` will use more disk space than `everything`. For this reason, there are different disk space that we recommend based on the pruning strategy you choose: + +| Pruning strategy | Minimum disk space | Recommended disk space | +| :--------------: | :----------------: | :--------------------: | +| `nothing` | 20 GB | 40 GB | +| `default` | 80 GB | 120 GB | +| `everything` | 120 GB | \> 240 GB | + +A part from disk space, the following requirements should be met. + +| Minimum CPU cores | Recommended CPU cores | +| :---------------: | :-------------------: | +| 2 | 4 | + +| Minimum RAM | Recommended RAM | +| :---------------: | :-------------------: | +| 4 GB | 8 GB | + + +## 1. Setup your environment +In order to run a fullnode, you need to build `desmosd` and `desmoscli` which require `Go`, `git`, `gcc` and `make` installed. + +This process depends on your working environment. + +:::: tabs + +::: tab Linux +The following example is based on **Ubuntu (Debian)** and assumes you are using a terminal environment by default. Please run the equivalent commands if you are running other Linux distributions. + +```bash +# Install git, gcc and make +sudo apt install build-essential --yes + +# Install Go with Snap +sudo snap install go --classic + +# Export environment variables +echo 'export GOPATH="$HOME/go"' >> ~/.profile +echo 'export PATH="$GOPATH/bin:$PATH"' >> ~/.profile +source ~/.profile +``` + +::: + +::: tab MacOS +To install the required build tools, simple [install Xcode from the Mac App Store](https://apps.apple.com/hk/app/xcode/id497799835?l=en&mt=12). + +To install `Go` on __MacOS__, the best option is to install with [__Homebrew__](https://brew.sh/). To do so, open the `Terminal` application and run the following command: + +```bash +# Install Homebrew +/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" +``` + + +> If you don't know how to open a `Terminal`, you can search it by typing `terminal` in `Spotlight`. + +After __Homebrew__ is installed, run + +```bash +# Install Go using Homebrew +brew install go + +# Install Git using Homebrew +brew install git + +# Export environment variables +echo 'export GOPATH="$HOME/go"' >> ~/.profile +echo 'export PATH="$GOPATH/bin:$PATH"' >> ~/.profile +source ~/.profile +``` + +::: + +::: tab Windows +The software has not been tested on __Windows__. If you are currently running a __Windows__ PC, the following options should be considered: + +1. Switch to a __Mac__ 👨‍💻. +2. Wipe your hard drive and install a __Linux__ system on your PC. +3. Install a separate __Linux__ system using [VirtualBox](https://www.virtualbox.org/wiki/Downloads) +4. Run a __Linux__ instance on a cloud provider. + +Note that is still possible to build and run the software on __Windows__ but it may give you unexpected results and it may require additional setup to be done. If you insist to build and run the software on __Windows__, the best bet would be installing the [Chocolatey](https://chocolatey.org/) package manager. + +::: + +:::: + +## 2. Install the software +Once you have setup your environment correctly, you are now ready to install the Desmos software and start your full node. + +In order to do so, you have two options: + +1. [Automatic installation](automatic.md). + This requires you to run a few commands so that you can easily have a Desmos full node running in a couple of minutes. This is recommended to most users that do not yet have the skills to go through a manual setup. + +2. [Manual installation](manual.md). + This is recommended to the those who want to understand each step or want to customize their setup accordingly to their needs. It is not recommended to people running a validator for the first time, although everyone should take a look at it once. diff --git a/docs/fullnode/update.md b/docs/fullnode/update.md index 2fb5cb87c3..f084c269f8 100644 --- a/docs/fullnode/update.md +++ b/docs/fullnode/update.md @@ -18,7 +18,7 @@ Make sure that every node has a unique `priv_validator.json`. Do not copy the `p ## 2. Upgrade the software Now it is time to upgrade the software. -Go into the directory in which you have installed `desmos`. If you have followed the [installation instructions](setup.md) and didn't change the path, it should be `/home/$USER/desmos`: +Go into the directory in which you have installed `desmos`. If you have followed the [installation instructions](setup/overview.md) and didn't change the path, it should be `/home/$USER/desmos`: ```bash cd diff --git a/docs/testnets/join-public.md b/docs/testnets/join-public.md index dde3a0a6c0..126cd66553 100644 --- a/docs/testnets/join-public.md +++ b/docs/testnets/join-public.md @@ -6,12 +6,12 @@ See the [testnet repo](https://github.com/desmos-labs/morpheus) for information ## Validators :::warning Requires desmos executables -To join the public testnet you **must** have [`desmoscli` and `desmosd` installed](../fullnode/setup.md). +To join the public testnet you **must** have [`desmoscli` and `desmosd` installed](../fullnode/setup/overview.md). ::: To become a testnet validators, the mainnet instructions apply: -1. [Create a full node](../fullnode/setup.md). +1. [Create a full node](../fullnode/setup/overview.md). 2. [Become a validator](../validators/setup.md) The only difference is the Desmos software version and genesis file. See the [testnet repo](https://github.com/desmos-labs/morpheus) for information on testnets, including the correct version of Desmos to use and details about the genesis file. diff --git a/docs/validators/upgrades/automatic/setup.md b/docs/validators/upgrades/automatic/setup.md index ce063f29cf..9692724aa9 100644 --- a/docs/validators/upgrades/automatic/setup.md +++ b/docs/validators/upgrades/automatic/setup.md @@ -4,7 +4,7 @@ The following guide allows you to setup your Desmos node along with the [`cosmos ## 1. Setup `desmosd` If you haven't already, please setup the `desmosd` binary and your validator node. You can do so by following these guides: -1. [Setup a full node](../../../fullnode/setup.md) +1. [Setup a full node](../../../fullnode/setup/overview.md) 2. [Setup a validator node](../../setup.md) ## 2. Setup `cosmosd` diff --git a/docs/validators/upgrades/manual.md b/docs/validators/upgrades/manual.md index fc145e7a5d..9cadea716d 100644 --- a/docs/validators/upgrades/manual.md +++ b/docs/validators/upgrades/manual.md @@ -9,7 +9,7 @@ If you wish to run a new validator node instead, please reference the [setup ins ## 1. Stop the currently running node. First of all we need to stop the currently running validator node. To do so you can go inside the console where you have run `desmosd start` and type `Ctrl + C`. This will halt your fullnode gracefully. -If you have also setup a [background service](../../fullnode/setup.md#optional-configure-the-service), please stop that too by executing the following command: +If you have also setup a [background service](../../fullnode/setup/manual.md#optional-configure-the-service), please stop that too by executing the following command: ```bash systemctl stop desmosd