Skip to content

Commit

Permalink
[Docs/Tools] Validator: support multiple networks + cheat sheet (#941)
Browse files Browse the repository at this point in the history
## Summary

Allows to support multiple networks in the installation script.

## Issue


- pokt-network/pocket-network-genesis#9
  • Loading branch information
okdas authored Nov 27, 2024
1 parent fa86fe8 commit 76d131c
Show file tree
Hide file tree
Showing 9 changed files with 544 additions and 157 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ sudo apt-get update
if command -v ufw > /dev/null 2>&1; then
sudo ufw allow from 172.16.0.0/12
sudo ufw allow from 192.168.0.0/16
echo "UFW rules added for Docker networks"
echo "UFW rules added for Docker networks and validator endpoint"
else
echo "UFW is not installed, skipping firewall configuration"
fi
Expand Down Expand Up @@ -106,9 +106,18 @@ cd poktroll-docker-compose-example

## Update your environment

First, copy the sample environment file:
```bash
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

Then set your external IP and source the environment:
```bash
EXTERNAL_IP=$(curl -4 ifconfig.me/ip)
sed -i -e s/NODE_HOSTNAME=/NODE_HOSTNAME=$EXTERNAL_IP/g .env

Expand Down Expand Up @@ -169,15 +178,19 @@ FINALLY, `source .env` to update the environment variables.

## Fund your accounts

Run the following:
Run the following to see your addresses:

```bash
show_actor_addresses
```

For each one, fund the accounts using the [faucet](https://faucet.testnet.pokt.network/)
Get the faucet URL for your network:

```bash
show_faucet_url
```

Next, run this helper (it's part of `helpers.sh`) to find each of them 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
Expand Down
145 changes: 145 additions & 0 deletions docusaurus/docs/operate/quickstart/full_node_cheatsheet.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,145 @@
---
sidebar_position: 3
title: Full Node Cheat Sheet
---

This cheat sheet provides quick instructions for installing a Full Node using an automated script.

- [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)

### Pre-Requisites

1. **Linux-based System**: Ensure you have a Debian-based Linux distribution (other distributions may work but are not fully supported).
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

To install and set up a Full Node, follow these steps:

1. **Download the Installation Script**:

```bash
curl -O https://raw.githubusercontent.com/pokt-network/poktroll/main/tools/installer/full-node.sh
```

2. **Run the Script with Sudo Privileges**:

```bash
sudo bash full-node.sh
```

3. **Follow the Prompts**:

- **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).
- **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`.

### What Gets Installed

When you run the installation script, the following components are set up:

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/`

4. **Systemd Service**: A service that manages the node:
- 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.

<!--
## Becoming a Validator
TODO(@okdas, #754): Add instructions for becoming a validator.
-->
14 changes: 0 additions & 14 deletions docusaurus/docs/operate/quickstart/validator_cheatsheet.md

This file was deleted.

108 changes: 0 additions & 108 deletions docusaurus/docs/operate/run_a_node/full_node_cosmovisor.md

This file was deleted.

Loading

0 comments on commit 76d131c

Please sign in to comment.