Deploy Nethermind with Monitoring stack

Recipe for a fast and easy terraform deployment of Nethermind Client and Monitoring stack (Grafana/Prometheus/Seq)

Below tutorial will guide you through the Nethermind node deployment together with full monitoring stack which consists of:

  • Grafana with a beautiful, preloaded dashboard to monitor your Nethermind node performance

  • Prometheus/Pushgateway to pull and push metrics generated by Nethermind client

  • Seq to have an easy, queriable view of Nethermind client logs

Prerequisites

  • Cloud provider (in this tutorial we will be using Digital Ocean, the terraform recipe can be configured to use any other provider of your choice UpCloud/AWS/Google etc.)

🛠 Setting up

First of all let us download repository with necessary files

git clone https://github.com/NethermindEth/terraform-nethermind

Let's move to the cloned directory

cd terraform-nethermind/

Create a terraform.tfvars file and add these 2 variables

terraform.tfvars
terraform.tfvars
do_token = "Your DigitalOcean token goes here"
pvt_key = "path/to/your/private_ssh_key"

Make sure that the public_key variable in main.tf file points to your Public key path

main.tf
main.tf
resource "digitalocean_ssh_key" "key" {
name = "SSH Key Example for "
public_key = file("./private.key.pub")
}

How to get those variables? (skip this part if you know already)

do_token

Can be generated on DigitalOcean panel. First go to the API management (bottom of the left navigation panel)

Click on the Generate New Token button

Give it a name and generate

Copy the token and place in its spot in terraform.tfvars file

pvt_key

Generate ssh key, we will be using ed25519 algorithm in our example

ssh-keygen -t ed25519 -a 100 -f private.key

pvt_key variable will now look like this:

pvt_key = "./private.key"

Running the stack

Confirm that terraform can be initialized, run this command from within terraform-templates directory

terraform init

You should see a green light in your console

Let's preview our plan before applying and save it so that it can be used in a future

terraform plan -out myplan

You can now provide some basic configuration to your VM/Nethermind Node

A list of available configs can be found here

🧯 If you chose to enable JsonRpc (it will run on port 8545 by default) make sure that you set up Firewall rules either in DigitalOcean or by using Linux iptables

Let's apply our plan and start deploying whole stack (it should take no longer than 3 minutes)

terraform apply myplan

Wait until terraform is done deploying and if everything went smooth you should see

Exploring the stack

Grab the IP of your new Droplet from the DigitalOcean panel

Grafana Dashboard

Go to the YOUR_DROPLET_IP:3000

Login to Grafana with admin:admin credentials and change the password if you wish

Go to YOUR_DROPLET_IP:3000/dashboards endpoint

Click on the Nethermind Dashboard and you should see charts with Nethermind metrics

Prometheus

Go to the YOUR_DROPLET_IP:9090

Explore Nethermind metrics, visualize and analyse using prometheus syntax, a list of available metrics with their descriptions can be found here:

Pushgateway

Go to the YOUR_DROPLET_IP:9091 and verify if metrics are inflowing

Seq

Go to the YOUR_DROPLET_IP:5341, you will be albe to query your Nethermind client logs. Feel free to create some useful Signals, Queries or Dashboards.

Destroying the stack

Use below command to destroy your terraform stack (We will need to provide variables, can be random, once again as we haven't set any default values for them. Hopefully it will change in the future.)

terraform destroy --auto-approve