Skip to content

Instantly share code, notes, and snippets.

@Validatrium
Last active September 5, 2022 10:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Validatrium/1647e7cf8e8e3f02ad9b21b604a0bdd6 to your computer and use it in GitHub Desktop.
Save Validatrium/1647e7cf8e8e3f02ad9b21b604a0bdd6 to your computer and use it in GitHub Desktop.
passage mainnet setup with monitoring. By validatrium

Tutorial created by Validatrium (more info on our projects at validatrium.com)

Info

Steps

  1. Setup
  2. Install dependencies and binaries
  3. Create wallet
  4. Configure your node
  5. Run node
  6. Monitoring

links

  1. Official Validator Guide

Setup

Preconfig

useradd passage -mU -G sudo -s /bin/bash
passwd passage # enter password for agoric 
su - passage

# set node name
ACCOUNT=<node-name> 
CHAIN=passage-1

Install dependencies and binaries

# upgrade ubuntu
sudo apt update && sudo apt upgrade -y
sudo apt install build-essential jq -y

# install go 
wget https://go.dev/dl/go1.17.5.linux-amd64.tar.gz
rm -rf $HOME/go && tar -C $HOME -xzf go1.17.5.linux-amd64.tar.gz

echo 'export GOPATH=/usr/local/go' >> $HOME/.bashrc 
echo 'export GOBIN=$GOPATH/bin' >> $HOME/.bashrc 
echo 'export PATH=$PATH:$GOBIN' >> $HOME/.bashrc 
source $HOME/.bashrc

# install passage
git clone https://github.com/envadiv/Passage3D && cd Passage3D
git checkout v1.0.0
make install

# verify everything is installed 
passage version --long

Create wallet

# init agoric home directory
passage init $ACCOUNT --chain-id $CHAIN
# create new key 
passage keys add $ACCOUNT
# or restore existing
passage keys add $ACCOUNT --recover


# save wallet & valoper address to variables: 
ADDRESS=$(passage keys show $ACCOUNT -a)
VALIDATOR=$(passage keys show $ACCOUNT -a --bech val)

Do not forget to save mnemonic in the safe place!

Save some useful variables

cat << EOF >> $HOME/.bashrc
. <(passage completion)

export ACCOUNT=$ACCOUNT
export CHAIN=$CHAIN
export ADDRESS=$ADDRESS
export VALIDATOR=$VALIDATOR
EOF
source $HOME/.bashrc

Configure your node

curl -s https://raw.githubusercontent.com/envadiv/mainnet/main/passage-1/genesis.json > ~/.passage/config/genesis.json
passage tendermint unsafe-reset-all

peers="69975e7afdf731a165e40449fcffc75167a084fc@104.131.169.70:26656,d35d652b6cb3bf7d6cb8d4bd7c036ea03e7be2ab@116.203.182.185:26656,ffacd3202ded6945fed12fa4fd715b1874985b8c@3.98.38.91:26656,8e0b0d4f80d0d2853f853fbd6a76390113f07d72@65.108.127.249:26656,0111da7144fd2e8ce0dfe17906ef6fd760325aca@142.132.213.231:26656"

seeds="aebb8431609cb126a977592446f5de252d8b7fa1@104.236.201.138:26656,b6beabfb9309330944f44a1686742c2751748b83@5.161.47.163:26656,7a9a36630523f54c1a0d56fc01e0e153fd11a53d@167.235.24.145:26656"

# Replace the seeds and persistent_peers values
sed -i.bak -e "s/^persistent_peers *=.*/persistent_peers = \"$peers\"/" $HOME/.passage/config/config.toml
sed -i.bak -e "s/^seeds *=.*/seeds = \"$seeds\"/" $HOME/.passage/config/config.toml

# set pruning options
pruning="custom" && \
pruning_keep_recent="100" && \
pruning_keep_every="0" && \
pruning_interval="10" && \
sed -i -e "s/^pruning *=.*/pruning = \"$pruning\"/" $HOME/.passage/config/app.toml 
sed -i -e "s/^pruning-keep-recent *=.*/pruning-keep-recent = \"$pruning_keep_recent\"/" $HOME/.passage/config/app.toml 
sed -i -e "s/^pruning-keep-every *=.*/pruning-keep-every = \"$pruning_keep_every\"/" $HOME/.passage/config/app.toml 
sed -i -e "s/^pruning-interval *=.*/pruning-interval = \"$pruning_interval\"/" $HOME/.passage/config/app.toml

Run node

You can run it in background using screen or tmux for example:

passage start

Or run this as a systemd service

sudo tee <<EOF >/dev/null /etc/systemd/system/passaged.service
[Unit]
Description=passage node
After=network-online.target
[Service]
User=$USER
ExecStart=$(which passage) start
Restart=always
RestartSec=3
LimitNOFILE=4096
[Install]
WantedBy=multi-user.target
EOF

sudo systemctl enable passaged
sudo systemctl daemon-reload
sudo systemctl start passaged

MONITORING

Notifications you will recieve with this config

  • free disk space is less than 20% and 10% - (low disk space notification)
  • height is not changing - (network connection error notification)
  • node process is not running - (node has been turned off)
  • node hasn't peers - (no peers - no sync. It's important)
  • validator isn't in active set - (to know if you're in jail)
  • RPC server is not running - (important to monitor parameters listed above)
  • API service is not running - (For future updates, by default it's not working. But you can turn it on)

Required:

  1. root account on server
  2. telegram bot token .You can follow this instruction
  3. Reciever chat_id. Follow this guide to get your telegram id:
cd /root
apt install monit jq -y

# clone our repository: 
git clone https://github.com/Validatrium/valmonit.git

# enable monitoring in monit configuration: 
echo "
include /root/valmonit/conf/passage/*
include /root/valmonit/conf/system
include /root/valmonit/conf/default-cosmos-monitoring
" >> /etc/monit/monitrc

# set your telegram.conf
cd $HOME/valmonit
cp telegram.conf.example telegram.conf
# enter your "telegram-id" and "bot-token"
nano telegram.conf

# verify that you can get notifications: 
./bin/sendtelegram -m "hi there!" -c ./telegram.conf

# by default it's monitor rpc-port/26657 and api-port/1317
# if you run on other ports you have to change it in: 
nano sh/cosmos-rpc.sh

# you can enable web interface for your monitoring tool:
# but it's not actually required
cat <<EOF >> /etc/monit/monitrc
set httpd port 2812 and     # run on port 2812
  use      address 0.0.0.0  # run on internet interface 
  allow    *                # allow everyone connetc
  allow    admin:monit      # user:password pair
EOF

# restart monitoring tool 
systemctl restart monit

Tutorial created by Validatrium (more info on our projects at validatrium.com)

If you have any additional questions regarding this tutorial, please join Passage official discord channel and tag Validatrium members.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment