GithubHelp home page GithubHelp logo

near-failover's Introduction

near-failover

A utility for maintaining neard nodes across regions. This code is responsible for watching all nodes, checking its status & metrics to make decisions about leader election. This allows failover in the event issues occur on a primary validating node.

Key features:

  • ✅ Leader Election
  • ✅ Automated Key Management
  • ✅ Advanced Alerting & Warnings (Slack)
  • ✅ Uptime Reporting
  • ✅ Multi-region Multi-node Compare
  • ✅ Remote Logging

1. Install

Install without systemctl:

npm i
cp .env.example .env

# Configure your .env before proceeding
npm start

Install with systemctl:

npm i
cp .env.example .env

# Configure your .env before proceeding
sudo ./setup.sh

NOTE: Needs sudo for install of systemctl process.

2. Configure

nano .env

You will need to configure the following env variables:

# Options: mainnet, testnet, guildnet
NEAR_ENV=guildnet
REGION=CA
CURRENCY=USD

# Where your /data folder is
BASE_PATH=

NF_MAINNET_NODE=rpc.mainnet.near.org
NF_GUILDNET_NODE=rpc.openshards.io
NF_TESTNET_NODE=rpc.testnet.near.org
NF_BETANET_NODE=rpc.betanet.near.org

# comma separated IPs
NODES_MAINNET=""
NODES_TESTNET=""
NODES_GUILDNET=""
NODES_BETANET=""

# Your staking contract for each network, for reporting
STAKE_CONTRACT_MAINNET=""
STAKE_CONTRACT_TESTNET=""
STAKE_CONTRACT_GUILDNET=""
STAKE_CONTRACT_BETANET=""

# Interval in millis
CHECK_INTERVAL=25000
REPORT_INTERVAL=21600000
LOW_BLOCKS_THRESHOLD=200
LOW_PEER_THRESHOLD=10

# For crontab
UPTIME_SYSTEM_URL=
# For failover checks
UPTIME_SYNC_URL=

SLACK_TOKEN=
SLACK_CHANNEL=
SLACK_LOG_CHANNEL=
SLACK_REPORT_CHANNEL=
# 10 mins
SLACK_STATUS_INTERVAL=600000

2. B - Key backups

IMPORTANT! If you haven't setup failover keys yet, please do the following command to automatically create, configure & backup your keys:

npm run keys

3. Start

If you didn't install the systemctl, you can start the service like this:

npm start

If you did install systemctl process, make sure its working by:

sudo systemctl status nearfailover.service

and view logs:

journalctl -f -u nearfailover.service
tail -f ~/near-failover/failover.log
tail -f ~/near-failover/failovererror.log

Manual Maintenance

If you want to manually trigger a node becoming a validator or syncing node, you can do 1 of the following:

# For moving into validator node
npm run validator

# For moving into syncing node
npm run sync

Support us!

If you found this useful, consider staking with our validator: steak.poolv1.near or making a donation to our DAO: near send YOUR_ACCOUNT.near steakdao.sputnik-dao.near 5

near-failover's People

Contributors

trevorjtclarke avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.