diff --git a/docusaurus/docs/operate/quickstart/docker_compose_debian_cheatsheet.md b/docusaurus/docs/operate/quickstart/docker_compose_debian_cheatsheet.md index afc6b8a63..d9eb90a05 100644 --- a/docusaurus/docs/operate/quickstart/docker_compose_debian_cheatsheet.md +++ b/docusaurus/docs/operate/quickstart/docker_compose_debian_cheatsheet.md @@ -89,9 +89,9 @@ sudo apt-get install docker-ce docker-ce-cli containerd.io docker-buildx-plugin You can optionally create a new user and give it sudo permissions instead of using `root`. ```bash -export USERNAME=olshansky -sudo adduser $USERNAME -sudo usermod -aG sudo $USERNAME +adduser poktroll +usermod -aG docker,sudo poktroll +su - poktroll ``` ## Retrieve the source code @@ -114,9 +114,9 @@ cp .env.sample .env By default, the `.env` file uses `testnet-beta`. If you want to use a different network, update the `NETWORK_NAME` in your `.env` file to one of: -- `testnet-alpha` - Unstable testnet -- `testnet-beta` - Stable testnet (default) -- `mainnet` - Production network +- `testnet-alpha`: Unstable testnet (use at your own risk) +- `testnet-beta`: Stable testnet (default) +- `mainnet`: Production network (not launched yet) Then set your external IP and source the environment: @@ -179,7 +179,7 @@ FINALLY, `source .env` to update the environment variables. ## Fund your accounts -Run the following to see your addresses: +Run the following helper command to see your addresses: ```bash show_actor_addresses @@ -191,7 +191,8 @@ Get the faucet URL for your network: show_faucet_url ``` -Fund each address using the faucet URL shown above. Then run this helper to find each account on the explorer: +Fund each address using the faucet URL shown above. +Then run this helper to find each account on the explorer: ```bash show_explorer_urls diff --git a/docusaurus/docs/operate/quickstart/docker_compose_walkthrough.md b/docusaurus/docs/operate/quickstart/docker_compose_walkthrough.md index 229a03f71..fa2e87a0a 100644 --- a/docusaurus/docs/operate/quickstart/docker_compose_walkthrough.md +++ b/docusaurus/docs/operate/quickstart/docker_compose_walkthrough.md @@ -152,40 +152,29 @@ Update `NODE_HOSTNAME` in `.env` to the IP address or hostname of your node. For sed -i -e s/NODE_HOSTNAME=/NODE_HOSTNAME=69.42.690.420/g .env ``` -### [Optional] Create a new user - -:::note - -Make sure to replace `olshansky` with your username. - -::: +### [Recommended] Create a new user You can generally do everything as the `root` user, but it's recommended to create a new user and give it sudo permissions. This is necessary, in particular, if you want to use [homebrew](https://brew.sh/) [to install `poktrolld`](../user_guide/install.md). -```bash -# Create a new user and give sudo permissions -export USERNAME=olshansky -sudo adduser $USERNAME -sudo usermod -aG sudo $USERNAME -``` - -Then, switch to the new user: +You can create a new user (e.g. poktroll), provide sudo permissions and switch users like so: ```bash -su - olshansky +adduser poktroll +sudo usermod -aG docker,sudo poktroll +su - poktroll ``` -You can also avoid needing to pass in the password each time by running the following: +In order to avoid needing to pass in the password each time by running the following: ```bash # Optionally avoid needing to provide a password sudo vi /etc/sudoers # Add the following line to the end of the file -olshansky ALL=(ALL) NOPASSWD:ALL +poktroll ALL=(ALL) NOPASSWD:ALL ``` ## A. Deploying a Full Node diff --git a/docusaurus/docs/operate/quickstart/full_node_cheatsheet.md b/docusaurus/docs/operate/quickstart/full_node_cheatsheet.md index d2986bb30..49d8beaf2 100644 --- a/docusaurus/docs/operate/quickstart/full_node_cheatsheet.md +++ b/docusaurus/docs/operate/quickstart/full_node_cheatsheet.md @@ -1,21 +1,33 @@ --- -sidebar_position: 3 title: Full Node Cheat Sheet +sidebar_position: 3 --- -This cheat sheet provides quick instructions for installing a Full Node using an automated script. +## Full Node Cheat Sheet Using Systemd & Cosmovisor + +This cheat sheet provides quick copy-pasta like instructions for installing and +running a Full Node using an automated script. + +:::tip +If you're interested in understanding the underlying details, or having full control over every +step of the process, check out the [Full Node Walkthrough](../run_a_node/full_node_walkthrough.md). + +::: + +- [Introduction](#introduction) - [Pre-Requisites](#pre-requisites) -- [Install a Full Node using Cosmovisor](#install-a-full-node-using-cosmovisor) -- [What Gets Installed](#what-gets-installed) -- [Useful Commands](#useful-commands) - - [Check the status of your node](#check-the-status-of-your-node) - - [View the logs](#view-the-logs) - - [Stop the node](#stop-the-node) - - [Start the node](#start-the-node) - - [Restart the node](#restart-the-node) - - [Advanced Operations](#advanced-operations) -- [Automatic Upgrades](#automatic-upgrades) +- [Install and Run a Full Node using Cosmovisor](#install-and-run-a-full-node-using-cosmovisor) + - [Automatic Upgrades Out of the Box](#automatic-upgrades-out-of-the-box) +- [FAQ \& Troubleshooting](#faq--troubleshooting) +- [\[OPTIONAL\] Do you care to know what just happened?](#optional-do-you-care-to-know-what-just-happened) + +### Introduction + +This guide will help you install a Full Node for Pocket Network, +**using helper that abstract out some of the underlying complexity.** + +Running a Full Node is the first step toward becoming a Validator, Supplier, or Gateway. ### Pre-Requisites @@ -23,9 +35,14 @@ This cheat sheet provides quick instructions for installing a Full Node using an 2. **Root or Sudo Access**: You need administrative privileges to run the installation script. 3. **Dedicated Server or Virtual Machine**: Any provider should work (Vultr and Hetzner have been tested). -### Install a Full Node using Cosmovisor +### Install and Run a Full Node using Cosmovisor + +:::info +This section script will handle the installation of dependencies, user creation, +environment variable setup, and configuration of Cosmovisor and `poktrolld`. +::: -To install and set up a Full Node, follow these steps: +Follow the instructions below to **quickly** install and set up a Full Node: 1. **Download the Installation Script**: @@ -43,24 +60,44 @@ To install and set up a Full Node, follow these steps: - **Choose the Network**: Select `testnet-alpha`, `testnet-beta`, or `mainnet`. - **Set Username**: Input the desired username to run `poktrolld` (default: `poktroll`). - - **Set Node Moniker**: Input the node moniker (default: your hostname). + - **Set Node Moniker**: Input the node moniker (default: your `hostname`). - **Confirm Seeds and Genesis File**: The script fetches seeds and the genesis file automatically. - **External IP Address**: The script detects your external IP address. Confirm or input manually if incorrect. -The script will handle the installation of dependencies, user creation, environment variable setup, and configuration of Cosmovisor and `poktrolld`. +#### Automatic Upgrades Out of the Box -### What Gets Installed +Your node is configured to handle chain upgrades automatically through Cosmovisor. No manual intervention is required for standard upgrades. -When you run the installation script, the following components are set up: +When a chain upgrade is proposed and approved: + +1. Cosmovisor will download the new binary +2. The node will stop at the designated upgrade height +3. Cosmovisor will switch to the new binary +4. The node will restart automatically + +### FAQ & Troubleshooting + +See the [FAQ & Troubleshooting section in the Full Node Walkthrough](../run_a_node/full_node_walkthrough.md#faq--troubleshooting) +for examples of useful commands, common debugging instructions and other advanced usage. + +### [OPTIONAL] Do you care to know what just happened? + +:::info +This section is optional and for informational purposes only. +::: + +If you're interested in understanding what just got installed, keep reading... 1. **System User**: A dedicated user (default: `poktroll`) is created to run the node securely. 2. **Cosmovisor**: A binary manager that handles chain upgrades automatically: + - Location: `/home/poktroll/bin/cosmovisor` - Purpose: Manages different versions of `poktrolld` and handles chain upgrades - Configuration: Set up to automatically download and switch to new binaries during upgrades 3. **Poktrolld**: The core node software: + - Location: `/home/poktroll/.poktroll/cosmovisor/genesis/bin/poktrolld` - Configuration: `/home/poktroll/.poktroll/config/` - Data: `/home/poktroll/.poktroll/data/` @@ -69,77 +106,3 @@ When you run the installation script, the following components are set up: - Name: `cosmovisor.service` - Status: Enabled and started automatically - Configured for automatic restarts and upgrades - -### Useful Commands - -After installation, you can manage your node using the following commands: - -#### Check the status of your node - -```bash -sudo systemctl status cosmovisor.service -``` - -#### View the logs - -```bash -sudo journalctl -u cosmovisor.service -f -``` - -#### Stop the node - -```bash -sudo systemctl stop cosmovisor.service -``` - -#### Start the node - -```bash -sudo systemctl start cosmovisor.service -``` - -#### Restart the node - -```bash -sudo systemctl restart cosmovisor.service -``` - -#### Advanced Operations - -Check the current version: -```bash -sudo -u poktroll poktrolld version -``` - -View the Cosmovisor directory structure: -```bash -ls -la /home/poktroll/.poktroll/cosmovisor/ -``` - -Check if an upgrade is available: -```bash -ls -la /home/poktroll/.poktroll/cosmovisor/upgrades/ -``` - -View node configuration: -```bash -cat /home/poktroll/.poktroll/config/config.toml -``` - -### Automatic Upgrades - -Your node is configured to handle chain upgrades automatically through Cosmovisor. When a chain upgrade is proposed and approved: - -1. Cosmovisor will download the new binary -2. The node will stop at the designated upgrade height -3. Cosmovisor will switch to the new binary -4. The node will restart automatically - -No manual intervention is required for standard upgrades. - - diff --git a/docusaurus/docs/operate/quickstart/gateway_cheatsheet.md b/docusaurus/docs/operate/quickstart/gateway_cheatsheet.md index e74e32bf3..3eb2df9d0 100644 --- a/docusaurus/docs/operate/quickstart/gateway_cheatsheet.md +++ b/docusaurus/docs/operate/quickstart/gateway_cheatsheet.md @@ -1,5 +1,5 @@ --- -sidebar_position: 5 +sidebar_position: 7 title: Gateway Cheat Sheet --- @@ -91,8 +91,8 @@ export APP_ADDR=$(poktrolld keys show application -a) :::tip -You can put the above in a special `~/.pocketrc` and add `source ~/.pocketrc` to -your `~/.bashrc` file for a cleaner organization. +You can put the above in a special `~/.poktrollrc` and add `source ~/.poktrollrc` to +your `~/.profile` file for a cleaner organization. ::: diff --git a/docusaurus/docs/operate/quickstart/service_cheatsheet.md b/docusaurus/docs/operate/quickstart/service_cheatsheet.md index c1cfa6bf0..4e3304db5 100644 --- a/docusaurus/docs/operate/quickstart/service_cheatsheet.md +++ b/docusaurus/docs/operate/quickstart/service_cheatsheet.md @@ -1,5 +1,5 @@ --- -sidebar_position: 6 +sidebar_position: 5 title: Service Cheat Sheet --- @@ -60,13 +60,14 @@ Here is an example of the output on Beta TestNet as of writing this document: You can use the `add-service` command to create a new service like so: ```bash -poktrolld tx service add-service ${SERVICE_ID} "${SERVICE_NAME_OR_DESCRIPTION}" ${COMPUTE_UNITS_PER_RELAY} --from ${SERVICE_OWNER} +poktrolld tx service add-service ${SERVICE_ID} "${SERVICE_NAME_OR_DESCRIPTION}" ${COMPUTE_UNITS_PER_RELAY} \ + --fees 1upokt --from ${SERVICE_OWNER} --chain-id ${CHAIN_ID} ``` Here is a concrete copy-pasta assuming you have created and funded a new account called `$USER`: ```bash -poktrolld tx service add-service "svc-$USER" "service description for $USER" 69 \ +poktrolld tx service add-service "svc-$USER" "service description for $USER" 13 \ --node https://shannon-testnet-grove-rpc.beta.poktroll.com \ --fees 1upokt --from $USER --chain-id pocket-beta ``` @@ -74,7 +75,7 @@ poktrolld tx service add-service "svc-$USER" "service description for $USER" 69 Optionally, you can add some more flags to be ultra-verbose about your local environment: ```bash -poktrolld tx service add-service "svc-$USER" "service description for $USER" 69 \ +poktrolld tx service add-service "svc-$USER" "service description for $USER" 13 \ --node https://shannon-testnet-grove-rpc.beta.poktroll.com \ --fees 1upokt --from $USER --chain-id pocket-beta \ --home ~/.poktroll --keyring-backend test \ diff --git a/docusaurus/docs/operate/quickstart/validator_cheatsheet.md b/docusaurus/docs/operate/quickstart/validator_cheatsheet.md new file mode 100644 index 000000000..f12ffe560 --- /dev/null +++ b/docusaurus/docs/operate/quickstart/validator_cheatsheet.md @@ -0,0 +1,30 @@ +--- +title: Validator Cheat Sheet +sidebar_position: 4 +--- + +## Validator Cheat Sheet + + + +This cheat sheet provides quick copy-pasta like instructions for installing and +running a Validator using an automated script. + +:::tip + +If you're interested in understanding everything, or having full control of every +step, check out the [Validator Walkthrough](../run_a_node/validator_walkthrough.md). + +::: + +- [Introduction](#introduction) + - [Pre-Requisites](#pre-requisites) + +## Introduction + +This guide will help you install a Validator on Pocket Network, +**using helpers that abstract out some of the underlying complexity.** + +### Pre-Requisites + +1. **Run a Full Node**: Make sure you have followed the [Full Node Cheat Sheet](../quickstart/full_node_cheatsheet.md) to install and run a Full Node first diff --git a/docusaurus/docs/operate/run_a_node/full_node_walkthrough.md b/docusaurus/docs/operate/run_a_node/full_node_walkthrough.md index d0adb768c..8723b73d4 100644 --- a/docusaurus/docs/operate/run_a_node/full_node_walkthrough.md +++ b/docusaurus/docs/operate/run_a_node/full_node_walkthrough.md @@ -1,37 +1,72 @@ --- -title: Full Node (systemd) +title: Full Node Walkthrough sidebar_position: 2 --- -## Run a Validator +## Run a Full Node Using Systemd & Cosmovisor -This walkthrough provides step-by-step instructions to manually install and configure a Full Node from scratch. +This walkthrough provides a detailed step-by-step instructions to install and +configure a Pocket Network Full Node from scratch. + +:::tip + +If you're comfortable using an automated scripts, or simply want to _copy-pasta_ a +few commands to get started, check out the [Full Node Cheat Sheet](../quickstart/full_node_cheatsheet.md). + +::: - [Introduction](#introduction) - [Pre-Requisites](#pre-requisites) -- [Step 1: Create a New User](#step-1-create-a-new-user) -- [Step 2: Install Dependencies](#step-2-install-dependencies) -- [Step 3: Set Up Environment Variables](#step-3-set-up-environment-variables) -- [Step 4: Install Cosmovisor](#step-4-install-cosmovisor) -- [Step 5: Install `poktrolld`](#step-5-install-poktrolld) -- [Step 6: Configure `poktrolld`](#step-6-configure-poktrolld) -- [Step 7: Set Up `systemd` Service](#step-7-set-up-systemd-service) -- [Step 8: Open Firewall Ports](#step-8-open-firewall-ports) -- [Next Steps](#next-steps) +- [1. Install Dependencies](#1-install-dependencies) +- [2. Create a New User](#2-create-a-new-user) +- [3. Set Up Environment Variables for Cosmovisor](#3-set-up-environment-variables-for-cosmovisor) +- [4. Install Cosmovisor](#4-install-cosmovisor) +- [5. Install `poktrolld`](#5-install-poktrolld) +- [6. Retrieve the latest genesis file](#6-retrieve-the-latest-genesis-file) +- [7. Network Configuration](#7-network-configuration) +- [8. Set Up `systemd` Service](#8-set-up-systemd-service) +- [9. Configure your Firewall](#9-configure-your-firewall) +- [FAQ \& Troubleshooting](#faq--troubleshooting) + - [How do I check the node is accessible from another machine?](#how-do-i-check-the-node-is-accessible-from-another-machine) + - [How do I view the node status?](#how-do-i-view-the-node-status) + - [How do I view the node logs?](#how-do-i-view-the-node-logs) + - [How do I stop my node?](#how-do-i-stop-my-node) + - [How do I start my node?](#how-do-i-start-my-node) + - [How do I restart my node?](#how-do-i-restart-my-node) + - [How do I query the latest block (i.e. check the node height)?](#how-do-i-query-the-latest-block-ie-check-the-node-height) + - [How do I check the node version?](#how-do-i-check-the-node-version) + - [How do I check the Cosmosvisor directory structure?](#how-do-i-check-the-cosmosvisor-directory-structure) + - [How do I check if an upgrade is available?](#how-do-i-check-if-an-upgrade-is-available) + - [How do I view node configuration?](#how-do-i-view-node-configuration) ### Introduction -This guide will help you install a Full Node for Pocket Network manually, giving you control over each step of the process. Running a Full Node is the first step toward becoming a Validator. +This guide will help you install a Full Node for Pocket Network, from scratch, manually, +**giving you control over each step of the process**. + +Running a Full Node is the first step toward becoming a Validator, Supplier, or Gateway. + +These instructions are **intended to be run on a Linux machine**. -**TL;DR**: If you're comfortable using an automated script, check out the [Full Node Cheat Sheet](../quickstart/full_node_cheatsheet.md) for quick setup instructions. +The instructions outlined here use [Cosmovisor](https://docs.cosmos.network/v0.45/run-node/cosmovisor.html) +to enable automatic binary upgrades. ### Pre-Requisites -- **Linux-based System**: Preferably Debian-based distributions. -- **Root or Sudo Access**: Administrative privileges are required. -- **Dedicated Server or Virtual Machine**: Any provider is acceptable. +1. **Linux-based System**: Preferably Debian-based distributions. +2. **Root or Sudo Access**: Administrative privileges are required. +3. **Dedicated Server or Virtual Machine**: Any provider is acceptable. -### Step 1: Create a New User +### 1. Install Dependencies + +Update your package list and install necessary dependencies: + +```bash +sudo apt-get update +sudo apt-get install -y curl tar wget jq +``` + +### 2. Create a New User Create a dedicated user to run `poktrolld`: @@ -45,127 +80,108 @@ Set a password when prompted, and add the user to the sudo group: sudo usermod -aG sudo poktroll ``` -### Step 2: Install Dependencies - -Update your package list and install necessary dependencies: +And switch to the `poktroll` user: ```bash -sudo apt-get update -sudo apt-get install -y curl tar wget jq +sudo su - poktroll ``` -### Step 3: Set Up Environment Variables +### 3. Set Up Environment Variables for Cosmovisor -Switch to the `poktroll` user and set environment variables required for Cosmovisor: +Create a `.poktrollrc` file and set environment variables: ```bash -sudo su - poktroll -``` +touch ~/.poktrollrc -Add the following to your `.profile`: +echo "export DAEMON_NAME=poktrolld" >> ~/.poktrollrc +echo "export DAEMON_HOME=\$HOME/.poktroll" >> ~/.poktrollrc +echo "export DAEMON_RESTART_AFTER_UPGRADE=true" >> ~/.poktrollrc +echo "export DAEMON_ALLOW_DOWNLOAD_BINARIES=true" >> ~/.poktrollrc +echo "export UNSAFE_SKIP_BACKUP=false" >> ~/.poktrollrc -```bash -echo "export DAEMON_NAME=poktrolld" >> ~/.profile -echo "export DAEMON_HOME=\$HOME/.poktroll" >> ~/.profile -echo "export DAEMON_RESTART_AFTER_UPGRADE=true" >> ~/.profile -echo "export DAEMON_ALLOW_DOWNLOAD_BINARIES=true" >> ~/.profile -echo "export UNSAFE_SKIP_BACKUP=false" >> ~/.profile +echo "source ~/.poktrollrc" >> ~/.profile source ~/.profile ``` -### Step 4: Install Cosmovisor - -Download and install Cosmovisor: +### 4. Install Cosmovisor :::info -Alternatively, you can follow the [official cosmovisor installation instructions](https://docs.cosmos.network/main/build/tooling/cosmovisor#installation). +Instead of following the instructions below, you can follow the [official cosmovisor installation instructions](https://docs.cosmos.network/main/build/tooling/cosmovisor#installation). ::: +Download and install Cosmovisor: + ```bash mkdir -p $HOME/.local/bin COSMOVISOR_VERSION="v1.6.0" ARCH=$(uname -m) -if [ "$ARCH" = "x86_64" ]; then +if [ "$ARCH" = "x86_64" ]; then ARCH="amd64" -elif [ "$ARCH" = "aarch64" ]; then +elif [ "$ARCH" = "aarch64" ]; then ARCH="arm64" fi curl -L "https://github.com/cosmos/cosmos-sdk/releases/download/cosmovisor%2F${COSMOVISOR_VERSION}/cosmovisor-${COSMOVISOR_VERSION}-linux-${ARCH}.tar.gz" | tar -zxvf - -C $HOME/.local/bin + echo 'export PATH=$HOME/.local/bin:$PATH' >> ~/.profile source ~/.profile ``` +### 5. Install `poktrolld` -### Step 5: Install `poktrolld` +Follow the instructions in the [CLI Installation Guide](../user_guide/install.md) page to install `poktrolld`. -Download and install `poktrolld`: +Create a symlink of the binary so Comosvisor knows where to find it: -1. **Download Genesis and Extract Version**: +```bash +mkdir -p $HOME/.poktroll/cosmovisor/genesis/bin +ln -sf $(which poktrolld) $HOME/.poktroll/cosmovisor/genesis/bin/poktrolld +``` - ```bash - # Select network (testnet-alpha, testnet-beta, or mainnet) - NETWORK="testnet-beta" # Change this to your desired network - - # Create config directory if it doesn't exist - mkdir -p $HOME/.poktroll/config - - # Download genesis file - GENESIS_URL="https://raw.githubusercontent.com/pokt-network/pocket-network-genesis/master/shannon/${NETWORK}/genesis.json" - curl -s -o $HOME/.poktroll/config/genesis.json "$GENESIS_URL" - - # Extract version and set architecture - POKTROLLD_VERSION=$(jq -r '.app_version' < $HOME/.poktroll/config/genesis.json) - ARCH=$(uname -m) - if [ "$ARCH" = "x86_64" ]; then ARCH="amd64" - elif [ "$ARCH" = "aarch64" ]; then ARCH="arm64" - fi - ``` +### 6. Retrieve the latest genesis file -2. **Download and Install the Binary**: +Follow the instructions below to download the latest genesis file. - Create the cosmovisor genesis directory and download the binary. - ```bash - mkdir -p $HOME/.poktroll/cosmovisor/genesis/bin - curl -L "https://github.com/pokt-network/poktroll/releases/download/v${POKTROLLD_VERSION}/poktroll_linux_${ARCH}.tar.gz" | tar -zxvf - -C $HOME/.poktroll/cosmovisor/genesis/bin - chmod +x $HOME/.poktroll/cosmovisor/genesis/bin/poktrolld - ln -sf $HOME/.poktroll/cosmovisor/genesis/bin/poktrolld $HOME/.local/bin/poktrolld - ``` +```bash +# Select network (testnet-alpha, testnet-beta, or mainnet) +NETWORK="testnet-beta" # Change this to your desired network -### Step 6: Configure `poktrolld` +# Create config directory if it doesn't exist +mkdir -p $HOME/.poktroll/config -Initialize configuration files and set up the node: +# Download genesis file +GENESIS_URL="https://raw.githubusercontent.com/pokt-network/pocket-network-genesis/master/shannon/${NETWORK}/genesis.json" +curl -s -o $HOME/.poktroll/config/genesis.json "$GENESIS_URL" +``` -1. **Extract Chain ID and Initialize Node**: +### 7. Network Configuration - ```bash - # Extract chain-id from existing genesis - CHAIN_ID=$(jq -r '.chain_id' < $HOME/.poktroll/config/genesis.json) - - # Initialize the node - poktrolld init "YourNodeMoniker" --chain-id="$CHAIN_ID" --home=$HOME/.poktroll - ``` +:::note +You may see a message saying `genesis.json file already exists`. - :::note - You may see a message saying `genesis.json file already exists`. This is expected since we downloaded the genesis file in Step 5. The initialization will still complete successfully and set up the required configuration files. - ::: +This is expected since we downloaded the genesis file in Step 5. The initialization will still complete successfully and set up the required configuration files. +::: -2. **Set Seeds**: +Run the following commands to configure your network environment appropriately: - ```bash - SEEDS_URL="https://raw.githubusercontent.com/pokt-network/pocket-network-genesis/master/shannon/${NETWORK}/seeds" - SEEDS=$(curl -s "$SEEDS_URL") - sed -i -e "s|^seeds *=.*|seeds = \"$SEEDS\"|" $HOME/.poktroll/config/config.toml - ``` +```bash +# Extract chain-id from existing genesis +CHAIN_ID=$(jq -r '.chain_id' < $HOME/.poktroll/config/genesis.json) -3. **Set External Address**: +# Initialize the node +poktrolld init "YourNodeMoniker_REPLACE_ME" --chain-id="$CHAIN_ID" --home=$HOME/.poktroll - ```bash - EXTERNAL_IP=$(curl -s https://api.ipify.org) - sed -i -e "s|^external_address *=.*|external_address = \"${EXTERNAL_IP}:26656\"|" $HOME/.poktroll/config/config.toml - ``` +# Set the seeds +SEEDS_URL="https://raw.githubusercontent.com/pokt-network/pocket-network-genesis/master/shannon/${NETWORK}/seeds" +SEEDS=$(curl -s "$SEEDS_URL") +sed -i -e "s|^seeds *=.*|seeds = \"$SEEDS\"|" $HOME/.poktroll/config/config.toml + +# Set External Address +EXTERNAL_IP=$(curl -s https://api.ipify.org) +sed -i -e "s|^external_address *=.*|external_address = \"${EXTERNAL_IP}:26656\"|" $HOME/.poktroll/config/config.toml +``` -### Step 7: Set Up `systemd` Service +### 8. Set Up `systemd` Service Create a `systemd` service file to manage the node: @@ -201,52 +217,104 @@ sudo systemctl enable cosmovisor.service sudo systemctl start cosmovisor.service ``` -### Step 8: Open Firewall Ports +### 9. Configure your Firewall -To ensure your node can properly participate in the P2P network, you need to make port `26656` accessible from the internet. This may involve: +To ensure your node can properly participate in the P2P network, you need to make port `26656` accessible from the internet. + +This may involve one or more of the following: + +1. **Configuring your firewall for UFW**: -1. **Configuring your firewall**: - - For UFW: ```bash sudo ufw allow 26656/tcp ``` - For iptables: +2. **Configuring your firewall for iptables**: + ```bash sudo iptables -A INPUT -p tcp --dport 26656 -j ACCEPT ``` -2. **Cloud Provider Settings**: - - If running on a cloud provider (AWS, GCP, Azure, etc.), ensure you configure the security groups or firewall rules to allow inbound traffic on port 26656. - -3. **Router Configuration**: - - If running behind a router, configure port forwarding for port 26656 to your node's internal IP address. +3. **Cloud Provider Settings**: If running on a cloud provider (AWS, GCP, Azure, etc.), ensure you configure the security groups or firewall rules to allow inbound traffic on port 26656. +4. **Router Configuration**: If running behind a router, configure port forwarding for port 26656 to your node's internal IP address. +5. **Verify your port** is accessible using a tool like netcat or telnet from another machine: + + ```bash + nc -vz your_server_ip 26656 + ``` + +### FAQ & Troubleshooting + +#### How do I check the node is accessible from another machine? -You can verify your port is accessible using a tool like netcat or telnet from another machine: ```bash nc -vz your_server_ip 26656 ``` -### Next Steps +#### How do I view the node status? -Your Full Node is now up and running. You can check its status and logs using the commands: +```bash +sudo systemctl status cosmovisor.service +``` -- **Check Status**: +#### How do I view the node logs? - ```bash - sudo systemctl status cosmovisor.service - ``` +```bash +sudo journalctl -u cosmovisor.service -f +``` -- **View Logs**: +#### How do I stop my node? - ```bash - sudo journalctl -u cosmovisor.service -f - ``` +```bash +sudo systemctl stop cosmovisor.service +``` + +#### How do I start my node? + +```bash +sudo systemctl start cosmovisor.service +``` + +#### How do I restart my node? + +```bash +sudo systemctl restart cosmovisor.service +``` - +```bash +poktrolld query block --type=height --node http://localhost:26657 +``` + +Or, using curl: + +```bash +curl -X GET http://localhost:26657/block | jq +``` + +#### How do I check the node version? + +```bash +poktrolld version +``` + +#### How do I check the Cosmosvisor directory structure? + +```bash +ls -la /home/poktroll/.poktroll/cosmovisor/ +``` + +#### How do I check if an upgrade is available? + +```bash +ls -la /home/poktroll/.poktroll/cosmovisor/upgrades/ +``` + +#### How do I view node configuration? + +```bash +cat /home/poktroll/.poktroll/config/config.toml +``` diff --git a/docusaurus/docs/operate/run_a_node/gateway_walkthrough.md b/docusaurus/docs/operate/run_a_node/gateway_walkthrough.md index 7dcc399b0..8dc7a31f4 100644 --- a/docusaurus/docs/operate/run_a_node/gateway_walkthrough.md +++ b/docusaurus/docs/operate/run_a_node/gateway_walkthrough.md @@ -1,6 +1,6 @@ --- title: Gateway Walkthrough -sidebar_position: 4 +sidebar_position: 6 --- # Run a Gateway diff --git a/docusaurus/docs/operate/run_a_node/validator_walkthrough.md b/docusaurus/docs/operate/run_a_node/validator_walkthrough.md new file mode 100644 index 000000000..6c8842f52 --- /dev/null +++ b/docusaurus/docs/operate/run_a_node/validator_walkthrough.md @@ -0,0 +1,29 @@ +--- +title: Validator Walkthrough +sidebar_position: 4 +--- + +## Validator Walkthrough + + + +This walkthrough provides a detailed step-by-step instructions to run a validator node for Pocket Network. + +:::tip + +If you're comfortable using an automated scripts, or simply want to _copy-pasta_ a +few commands to get started, check out the [Validator Cheat Sheet](../quickstart/validator_cheatsheet.md). + +::: + +- [Introduction](#introduction) +- [Pre-Requisites](#pre-requisites) + +## Introduction + +This guide will help you install a Validator on Pocket Network, from scratch, manually, +**giving you control over each step of the process**. + +## Pre-Requisites + +1. **Run a Full Node**: Make sure you have followed the [Full Node Walkthrough](../run_a_node/full_node_walkthrough.md) to install and run a Full Node first diff --git a/tools/installer/full-node.sh b/tools/installer/full-node.sh index 1274933de..f6c2abdb0 100644 --- a/tools/installer/full-node.sh +++ b/tools/installer/full-node.sh @@ -28,7 +28,7 @@ check_root() { # Function to install jq if not installed install_jq() { - if ! command -v jq &> /dev/null; then + if ! command -v jq &>/dev/null; then print_color $YELLOW "Installing jq..." if [ -f /etc/debian_version ]; then apt-get update @@ -50,16 +50,19 @@ install_jq() { get_user_input() { # Ask user which network to install echo "Which network would you like to install?" - echo "1) testnet-alpha" - echo "2) testnet-beta" - echo "3) mainnet" + echo "1) testnet-alpha (unstable)" + echo "2) testnet-beta (recommended)" + echo "3) mainnet (not launched yet)" read -p "Enter your choice (1-3): " network_choice case $network_choice in - 1) NETWORK="testnet-alpha" ;; - 2) NETWORK="testnet-beta" ;; - 3) NETWORK="mainnet" ;; - *) print_color $RED "Invalid network choice. Exiting."; exit 1 ;; + 1) NETWORK="testnet-alpha" ;; + 2) NETWORK="testnet-beta" ;; + 3) NETWORK="mainnet" ;; + *) + print_color $RED "Invalid network choice. Exiting." + exit 1 + ;; esac print_color $GREEN "Installing the $NETWORK network." @@ -84,7 +87,7 @@ get_user_input() { fi # Extract chain_id from genesis.json - CHAIN_ID=$(jq -r '.chain_id' < "$GENESIS_FILE") + CHAIN_ID=$(jq -r '.chain_id' <"$GENESIS_FILE") if [ -z "$CHAIN_ID" ]; then print_color $RED "Failed to extract chain_id from genesis file." exit 1 @@ -142,10 +145,12 @@ install_dependencies() { print_color $GREEN "Dependencies installed successfully." } +# TODO_TECHDEBT(@okdas): Use `.poktrollrc` across the board to create a clean +# separation of concerns for pocket specific configurations and debugging. # Function to set up environment variables setup_env_vars() { print_color $YELLOW "Setting up environment variables..." - sudo -u "$POKTROLL_USER" bash << EOF + sudo -u "$POKTROLL_USER" bash <> \$HOME/.profile echo "export DAEMON_HOME=\$HOME/.poktroll" >> \$HOME/.profile echo "export DAEMON_RESTART_AFTER_UPGRADE=true" >> \$HOME/.profile @@ -160,9 +165,9 @@ EOF setup_cosmovisor() { print_color $YELLOW "Setting up Cosmovisor..." ARCH=$(uname -m) - if [ "$ARCH" = "x86_64" ]; then + if [ "$ARCH" = "x86_64" ]; then ARCH="amd64" - elif [ "$ARCH" = "aarch64" ]; then + elif [ "$ARCH" = "aarch64" ]; then ARCH="arm64" else print_color $RED "Unsupported architecture: $ARCH" @@ -172,7 +177,7 @@ setup_cosmovisor() { COSMOVISOR_VERSION="v1.6.0" COSMOVISOR_URL="https://github.com/cosmos/cosmos-sdk/releases/download/cosmovisor%2F${COSMOVISOR_VERSION}/cosmovisor-${COSMOVISOR_VERSION}-linux-${ARCH}.tar.gz" - sudo -u "$POKTROLL_USER" bash << EOF + sudo -u "$POKTROLL_USER" bash <> \$HOME/.profile @@ -181,14 +186,13 @@ EOF print_color $GREEN "Cosmovisor set up successfully." } - # Function to download and set up Poktrolld setup_poktrolld() { print_color $YELLOW "Setting up Poktrolld..." ARCH=$(uname -m) - if [ "$ARCH" = "x86_64" ]; then + if [ "$ARCH" = "x86_64" ]; then ARCH="amd64" - elif [ "$ARCH" = "aarch64" ]; then + elif [ "$ARCH" = "aarch64" ]; then ARCH="arm64" else print_color $RED "Unsupported architecture: $ARCH" @@ -196,7 +200,7 @@ setup_poktrolld() { fi # Extract the version from genesis.json using jq - POKTROLLD_VERSION=$(jq -r '.app_version' < "$GENESIS_FILE") + POKTROLLD_VERSION=$(jq -r '.app_version' <"$GENESIS_FILE") print_color $YELLOW "Detected version from genesis: $POKTROLLD_VERSION" if [ -z "$POKTROLLD_VERSION" ]; then @@ -204,12 +208,15 @@ setup_poktrolld() { exit 1 fi + # TODO_TECHDEBT(@okdas): Conslidate this business logic with what we have + # in `user_guide/install.md` to avoid duplication and have consistency. + # Construct the release URL with proper version format RELEASE_URL="https://github.com/pokt-network/poktroll/releases/download/v${POKTROLLD_VERSION}/poktroll_linux_${ARCH}.tar.gz" print_color $YELLOW "Attempting to download from: $RELEASE_URL" # Download and extract directly as the POKTROLL_USER - sudo -u "$POKTROLL_USER" bash << EOF + sudo -u "$POKTROLL_USER" bash < /etc/systemd/system/cosmovisor.service << EOF + cat >/etc/systemd/system/cosmovisor.service < /dev/null; then + if command -v ufw &>/dev/null; then print_color $YELLOW "ufw is installed." - + # Check if rule already exists if ufw status | grep -q "26656"; then print_color $YELLOW "Port 26656 is already allowed in ufw rules." return fi - + read -p "Do you want to open port 26656 for p2p communication? (Y/n): " open_port if [[ $open_port =~ ^[Yy] ]]; then ufw allow 26656 @@ -347,4 +356,4 @@ main() { print_color $YELLOW "View logs with: sudo journalctl -u cosmovisor.service -f" } -main \ No newline at end of file +main