Skip to content
This repository has been archived by the owner on Nov 2, 2023. It is now read-only.
/ snowplow Public archive

quick and easy tool for running and monitoring an avalanche validator

License

Notifications You must be signed in to change notification settings

patrick-ogrady/snowplow

Repository files navigation

snowplow

snowplow

quick and easy tool for running and monitoring an avalanche validator

SNOWPLOW IS CONSIDERED ALPHA SOFTWARE. USE AT YOUR OWN RISK!

Origins

When setting up my own avalanche validator, I couldn't find any simple tools to backup my validator staking credentials or send simple text message alerts if the validator went haywire. So, I made my own snowplow to help tame the avalanche...zing.

Install

To install snowplow, you must first install golang (to compile the code). I don't plan on hosting any pre-built binaries because I think it is important that the users of this tool compile their own code (for their own safety).

git clone https://github.com/patrick-ogrady/snowplow;
make install;

Usage

For all of the following operations, snowplow assumes your staking credentials are kept in .avalanchego/staking (relative directory). Note, this is different that avalanchego which assumes these credentials are in $HOME/.avalanchego/staking.

Staking

Create Staking Credentials

This command will generate new staking credentials in the .avalanchego/staking folder, if staking credentials do not yet exist in that folder.

snowplow staking create

View NodeID

This command will print the NodeID associated with the staking credentials in the .avalanchego/staking folder, if they exist.

snowplow staking view

Encrypt + Backup Staking Credentials

This command encrypts and backs up your staking credentials to the Google Cloud Storage bucket of your choosing.

export GOOGLE_APPLICATION_CREDENTIALS=path/to/credentials.json
snowplow staking backup [bucket]

Before running this command, make sure to export your GOOGLE_APPLICATION_CREDENTIALS in your terminal. You can learn more about Google Cloud's authentication mechanism here.

Restore + Decrypt Staking Credentials

This command restores and decrypts the staking credentials of the validator of your choosing from the Google Cloud Storage bucket of your choosing.

export GOOGLE_APPLICATION_CREDENTIALS=path/to/credentials.json
snowplow staking restore [bucket] [node ID]

Before running this command, make sure to export your GOOGLE_APPLICATION_CREDENTIALS in your terminal. You can learn more about Google Cloud's authentication mechanism here.

DB

Backup DB

This command backs up your validator db to the Google Cloud Storage bucket of your choosing.

export GOOGLE_APPLICATION_CREDENTIALS=path/to/credentials.json
snowplow db backup [bucket] [name]

Before running this command, make sure to export your GOOGLE_APPLICATION_CREDENTIALS in your terminal. You can learn more about Google Cloud's authentication mechanism here.

Restore DB

This command restores the validator db of your choosing from the Google Cloud Storage bucket of your choosing.

export GOOGLE_APPLICATION_CREDENTIALS=path/to/credentials.json
snowplow db restore [bucket] [name]

Before running this command, make sure to export your GOOGLE_APPLICATION_CREDENTIALS in your terminal. You can learn more about Google Cloud's authentication mechanism here.

Google Cloud Deployment

Setup VM

This sequence of commands sets up an Ubuntu 20.04 LTS OS on Google Cloud to run an avalanche validator.

git clone https://github.com/patrick-ogrady/snowplow;
cd snowplow;
./scripts/setup.sh;
export PATH=$PATH:~/go/bin;

Build Node

This command builds a Docker image containing avalanchego and the health monitoring mechanism from snowplow.

make docker-build

To use Docker on Google Cloud, you may need to prepend sudo to this command.

Start Node

This command starts a Docker container that starts avalanchego and the health monitoring mechanism from snowplow. Making a request to port 8080 will return a 200 status when the validator is considered healthy.

make run-mainnet

To use Docker on Google Cloud, you may need to prepend sudo to this command.

Google Cloud Monitoring

By default, snowplow will upload relevant metrics to Google Cloud Monitoring when deployed on Google Cloud (no config file needed).

Local Deployment

Build Node

This command builds a Docker image containing avalanchego and the health monitoring mechanism from snowplow.

make docker-build

Start Node

This command starts a Docker container that starts avalanchego and the health monitoring mechanism from snowplow. Making a request to port 8080 will return a 200 status when the validator is considered healthy.

make run-mainnet

Twilio Notifications

To enable text message alerts from Twilio, you must populate a yaml file at .avalanchego/.snowplow.yaml (in the same directory containing your staking keys).

twilio:
  accountSid: "<accountSid>"
  authToken: "<authToken>"
  sender: "<sender phone number>"
  recipient: "<your phone number>"