Skip to content
by Unity Nodes
Development

[Report] Automated Near Validator Node Deployment - AWS Edition by KalakendraDAO

2 posts269 views10 likesLast activity Oct 2022

  1. Monish016OP 7

    EasyDeploy — AWS Edition

    Automated Near Validator Node Deployment

    Summary​

    An automation solution for deploying a NEAR validator node in AWS with few clicks. The goal is to ease the node deployment so that anyone can easily deploy a validator node.

    Motivation​

    Participation in Stake Wars III and joining NEAR’s mission to bring ‘Chunk-Only Producers’ to Mainnet paved the way to this automation. It was a challenge to actively run a Chunk-Only Producer node with all the required packages by following the instructions provided here.

    Considering the time taken and the complexity involved in deploying a validator node, we designed this automation solution in AWS to completely ease the process. This makes it easy for anyone in the community deploying a node themself.

    Interface​

    AWS CloudFormation stack deploys an EC2 instance within a new VPC as per the inputs provided which executes multiple startup scripts in sequence that installs all the required packages once the node EC2 instance has launched. Startup scripts are cloned from this GitHub repo.

    #!/bin/bash
    exec > >(tee /var/log/user-data.log|logger -t user-data -s 2>/dev/console) 2>&1
    cd ~
    sudo yum install -y git // installs git package
    git clone https://github.com/kalakendradao/public_projects // clones the scripts repository
    cd public_projects/node_automation/
    network="${ChainNetwork}" // chain network to deploy the node
    nearcore_version="${NearcoreVersion}" // nearcore version to download
    mkdir ${ChainNetwork}
    tr -d "\r" < setup_part1.sh > cleaned_part1.sh // Installs all the required packages and utils
    tr -d "\r" < setup_part2.sh > cleaned_part2.sh // configures 
              
    tr -d "\r" < setup_part3.sh > cleaned_part3.sh // compiles the nearcore libraries, dowloads config.json, download latest snapshot and initiates the node.
    sh cleaned_part1.sh $network $nearcore_version >output_1.log 2>&1
              
    sudo su - $USER -c 'sh /$USER/public_projects/node_automation/cleaned_part2.sh' >output_2.log 2>&1 &
    disown
    

    Instructions​

    Detailed step-by-step instructions are published here.

    Drawbacks​

    • This automation is limited to AWS Cloud for now and can be deployed only using AWS CloudFormation.
    • Currently, the CloudFormation stack deploys an EC2 node only with Debian Operating System.
    • Packages installation doesn’t include any monitoring tools.

    Future possibilities​

    • Expanding the solution to automate deployments in Google Cloud and Physical machines.
    • Including more flavors of Linux operating systems in the CloudFormation deployment stack.
    • Including monitoring utils like Grafana, and Prometheus to the installation script.
  2. Bakaka 3

    Thank you so much, it is really helpful.