Skip to content

Setup up a GoShimmer node (Joining the Pollen testnet)

Luca Moser edited this page Jun 30, 2020 · 25 revisions

This page describes how to setup your own GoShimmer node in the Pollen testnet with Docker.

DISCLAIMER: Note that there will be breaking changes frequently (approx. bi-weekly) where the entire network needs to upgrade. If you don't have time to continuously monitor and upgrade your node, then running a GoShimmer node might not be for you. We want to emphasize that running a GoShimmer node requires proper knowledge in Linux and IT related topics such as networking and so on. It is not meant as a node to be run by people with little experience in the mentioned fields. Do not plan to run any production level services on your node/network.

Contents
Why you should run a node
Installing GoShimmer with Docker
Running the GoShimmer node
Managing the GoShimmer node lifecycle
Setting up the Grafana dashboard

Why you should run a node

Running a node in the Pollen testnet helps us in the following ways:

  • It increases the amount of nodes in the network and thus lets it form a more realistic network.
  • Your node will be configured to send debug log messages to a centralized logger from which we can assess and debug research questions and occurring problems.
  • Your node is configured to send metric data to a centralized analysis server where we store information such as resource consumption, traffic, FPC vote context processing and so on. This data helps us further fostering the development of GoShimmer and assessing network behavior.
  • If you expose your HTTP API port, you provide an entrypoint for other people to interact with the network.

Note that any metric data is anonymous.

Installing GoShimmer with Docker

Hardware Requirements

Note that we do not provide a Docker image or binaries for ARM based systems such as Raspberry Pis.

We recommend running GoShimmer on a x86 VPS with following minimum hardware specs:

  • 2 cores / 4 threads
  • 4 GB of memory
  • 40 GB of disk space

A cheap CX21 Hetzner instance is thereby sufficient.

If you plan on running your GoShimmer node from home, please only do so if you know how to properly configure NAT on your router, as otherwise your node will not correctly participate in the network.


In the following sections we are going to use a CX21 Hetzner instance with Ubuntu 20.04 while being logged in as root

Lets first upgrade the packages on our system:

$ apt update && apt dist-upgrade -y

Install Docker

Install needed dependencies:

$ apt-get install \
     apt-transport-https \
     ca-certificates \
     curl \
     gnupg-agent \
     software-properties-common

Add Docker’s official GPG key:

$ curl -fsSL https://download.docker.com/linux/ubuntu/gpg | apt-key add -

Verify that the GPG key matches:

$ apt-key fingerprint 0EBFCD88
pub   rsa4096 2017-02-22 [SCEA]
      9DC8 5822 9FC7 DD38 854A  E2D8 8D81 803C 0EBF CD88
uid           [ unknown] Docker Release (CE deb) <[email protected]>
sub   rsa4096 2017-02-22 [S]

Add the actual repository:

$ add-apt-repository \
   "deb [arch=amd64] https://download.docker.com/linux/ubuntu \
   $(lsb_release -cs) \
   stable"

Update the package index and finally install docker:

$ apt update
Hit:1 http://mirror.hetzner.de/ubuntu/packages focal InRelease
Hit:2 http://mirror.hetzner.de/ubuntu/packages focal-updates InRelease   
...
Reading package lists... Done
Building dependency tree       
Reading state information... Done
All packages are up to date.
root@ubuntu-4gb-hel1-1:~# apt-get install docker-ce docker-ce-cli containerd.io

Check whether docker is running by executing docker ps:

$ docker ps
CONTAINER ID        IMAGE               COMMAND             CREATED             STATUS              PORTS               NAMES

Install Docker Compose

Docker compose gives us the ability to define our services with docker-compose.yml files instead of having to define all container parameters directly on the CLI.

Download docker compose:

$ curl -L "https://github.com/docker/compose/releases/download/1.26.0/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose

Make it executable:

$ chmod +x /usr/local/bin/docker-compose

Check that docker compose works:

$ docker-compose --version
docker-compose version 1.26.0, build d4451659

Define the docker-compose.yml

First, lets create a user defined bridged network. Unlike the already existing bridge network, the user defined one will have container name DNS resolution for containers within that network. This is useful if later we want to setup additional containers which need to speak with the GoShimmer container.

$ docker network create --driver=bridge shimmer
c726034d295c3df66803b92c71ca517a0cf0e3c65c1c6d84ee5fa34ae76cbcd4

Lets create a folder holding our docker-compose.yml:

$ mkdir /opt/goshimmer

Lets create a folder holding our database:

$ cd /opt/goshimmer
$ mkdir db
$ chmod 0777 db

Finally, lets create our docker-compose.yml:

$ nano docker-compose.yml

and add following content:

version: '3.3'

networks:
  outside:
    external:
      name: shimmer

services:
  goshimmer:
    image: iotaledger/goshimmer:v0.2.0
    container_name: goshimmer
    hostname: goshimmer
    restart: unless-stopped
    volumes:
      - "./db:/tmp/mainnetdb:rw"   
      - "/etc/localtime:/etc/localtime:ro"
    ports:
      # Autopeering 
      - "0.0.0.0:14626:14626/udp"
      # Gossip
      - "0.0.0.0:14666:14666/tcp"
      # FPC
      - "0.0.0.0:10895:10895/tcp"
      # HTTP API
      - "0.0.0.0:8080:8080/tcp"
      # Dashboard
      - "0.0.0.0:8081:8081/tcp"
      # pprof profiling
      - "0.0.0.0:6061:6061/tcp"
    environment:
      - ANALYSIS_CLIENT_SERVERADDRESS=ressims.iota.cafe:21888
      - AUTOPEERING_ENTRYNODES=2PV5487xMw5rasGBXXWeqSi4hLz7r19YBt8Y1TGAsQbj@ressims.iota.cafe:15626
      - AUTOPEERING_PORT=14626
      - DASHBOARD_BINDADDRESS=0.0.0.0:8081
      - GOSSIP_PORT=14666
      - WEBAPI_BINDADDRESS=0.0.0.0:8080
      - PROFILING_BINDADDRESS=0.0.0.0:6061
      - NETWORKDELAY_ORIGINPUBLICKEY=9DB3j9cWYSuEEtkvanrzqkzCQMdH1FGv3TawJdVbDxkd
      - FPC_BINDADDRESS=0.0.0.0:10895
      - PROMETHEUS_BINDADDRESS=0.0.0.0:9311
    command: >
      --skip-config=true
      --node.disablePlugins=
      --node.enablePlugins=remotelog,networkdelay,spammer,prometheus
      --logger.level=info
      --logger.disableEvents=false
      --logger.remotelog.serverAddress=ressims.iota.cafe:5213
    networks:
      - outside

Note how we are setting up NATs for different ports:

Port Functionality Protocol
14626 Autopeering UDP
14666 Gossip TCP
10895 FPC TCP/HTTP
8080 HTTP API TCP/HTTP
8081 Dashboard TCP/HTTP
6061 pprof HTTP API TCP/HTTP

It is important that the ports are correctly mapped so that the node for example actively participates in FPC votes or can gain inbound neighbors.

If the UDP NAT mapping is not configured correctly, GoShimmer will terminate with an error message stating to check the NAT configuration

Running the GoShimmer node

Within the /opt/goshimmer folder where the docker-compose.yml resides, simply execute:

$ docker-compose up -d
Pulling goshimmer (iotaledger/goshimmer:0.2.0)...
...

to start the GoShimmer node.

You should see your container running now:

CONTAINER ID        IMAGE               COMMAND                  CREATED             STATUS              PORTS                                                                                                                                    NAMES
687f52b78cb5        iotaledger/goshimmer:0.2.0       "/run/goshimmer --sk…"   19 seconds ago      Up 17 seconds       0.0.0.0:6061->6061/tcp, 0.0.0.0:8080-8081->8080-8081/tcp, 0.0.0.0:10895->10895/tcp, 0.0.0.0:14666->14666/tcp, 0.0.0.0:14626->14626/udp   goshimmer

You can follow the log output of the node via:

$ docker logs -f --since=1m goshimmer

Syncing

When the node starts for the first time, it must synchronize its state with the rest of the network. In the log, you should find lines similar to the following output:

2020-06-26T16:26:05+02:00	INFO	Sync	sync/plugin.go:195	added message 4yJMX2MDap as anchor point (1 of 3 collected)
2020-06-26T16:26:05+02:00	INFO	Sync	sync/plugin.go:195	added message 5TRCjD7PkB as anchor point (2 of 3 collected)
2020-06-26T16:26:05+02:00	INFO	Sync	sync/plugin.go:195	added message 5kgZXF9rTS as anchor point (3 of 3 collected)

GoShimmer uses anchor points (first seen messages after starting the node) to determine whether it is synchronized. When all anchor point messages become solid (meaning their past history is known), the node sets itself as synchronized.

After the anchor points become solid, the node monitors itself for desynchronization:

2020-06-26T16:29:08+02:00	INFO	Sync	sync/plugin.go:205	anchor message 5kgZXF9rTS has become solid
2020-06-26T16:29:08+02:00	INFO	Sync	sync/plugin.go:205	anchor message 5TRCjD7PkB has become solid
2020-06-26T16:29:08+02:00	INFO	Sync	sync/plugin.go:205	anchor message 4yJMX2MDap has become solid
2020-06-26T16:29:08+02:00	INFO	Sync	sync/plugin.go:237	all anchor messages have become solid, marking node as synced
2020-06-26T16:29:08+02:00	INFO	Sync	sync/plugin.go:113	monitoring for desynchronization

Depending on how old the network is, the synchronization process can take several minutes to hours, since the node is actually synchronizing back to the genesis message.

Dashboard

The dashboard of your GoShimmer node should be accessible via http://<your-ip>:8081. If your node is still synchronizing, you might see a higher inflow of MPS.

After a while, your node's dashboard should also display up to 8 neighbors:

HTTP API

GoShimmer also exposes an HTTP API. To check whether that works correctly, you can access it via http://<your-ip>:8080/info which should return a JSON response in the form of:

{
  "version": "v0.2.0",
  "synced": true,
  "identityID": "69RxiehGQ2c",
  "publicKey": "52Gzw9bo7k2dARFi4yxtt3B8xMht5UeFQX7pWdLFnxV5",
  "enabledPlugins": [
    "Analysis-Client",
    "Autopeering",
    "CLI",
    "Config",
    "DRNG",
    "Dashboard",
    "Database",
    "Gossip",
    ...
    "WebAPI info Endpoint",
    "WebAPI message Endpoint"
  ],
  "disabledPlugins": [
    "Analysis-Dashboard",
    "Analysis-Server",
    "Banner",
    "Bootstrap",
    "Faucet",
    "WebAPI Auth"
  ]
}

Managing the GoShimmer node lifecycle

Stopping the node
$ docker-compose stop
Resetting the node
$ docker-compose stop
$ docker-compose rm -f
Upgrading the node

Same as "Resetting the node" then change the image version in the docker-compose.yml, delete the content within db and then start the node with:

$ docker-compose up -d
Following log output
$ docker logs -f --since=1m goshimmer
Create a log.txt
$ docker logs goshimmer > log.txt

Setting up the Grafana dashboard

Add Prometheus and Grafana Containers to docker-compose.yml

Append the following to the previously described docker-compose.yml file:

  prometheus:
    image: prom/prometheus:latest
    container_name: prometheus
    restart: unless-stopped
    ports:
      - "9090:9090/tcp"
    command:
      - --config.file=/etc/prometheus/prometheus.yml
    volumes:
      - ./prometheus/prometheus.yml:/etc/prometheus/prometheus.yml:ro
      - ./prometheus/data:/prometheus:rw
    depends_on:
      - goshimmer
    networks:
      - outside

  grafana:
    image: grafana/grafana:latest
    container_name: grafana
    restart: unless-stopped
    environment:
      # path to provisioning definitions can only be defined as
      # environment variables for grafana within docker
      - GF_PATHS_PROVISIONING=/var/lib/grafana/provisioning
    ports:
      - "3000:3000/tcp"
    user: "472"
    volumes:
      - ./grafana:/var/lib/grafana:rw
    networks:
      - outside

Create Prometheus config

  1. Create a prometheus/data directory in /opt/goshimmer:
$ cd /opt/goshimmer
$ mkdir -p prometheus/data
  1. Create a prometheus.yml in prometheus directory:
$ nano prometheus/prometheus.yml

The content of the file should be:

scrape_configs:
    - job_name: goshimmer_local
      scrape_interval: 5s
      static_configs:
      - targets:
        - goshimmer:9311
  1. Add permissions to prometheus config directory:
$ chmod -R 777 prometheus

Create Grafana configs

  1. Create necessary config dirs in /opt/goshimmer/.
$ mkdir -p grafana/provisioning/datasources grafana/provisioning/dashboards grafana/provisioning/notifiers
$ mkdir -p grafana/dashboards
  1. Create a datasource configuration file in grafana/provisioning/datasources:
$ nano grafana/provisioning/datasources/datasources.yaml

With the following content:

apiVersion: 1

datasources:
  - name: Prometheus
    type: prometheus
    # <string, required> access mode. proxy or direct (Server or Browser in the UI). Required
    access: proxy
    orgId: 1
    url: http://prometheus:9090
    jsonData:
      graphiteVersion: '1.1'
      timeInterval: '1s'
    # <string> json object of data that will be encrypted.
    secureJsonData:
      # <string> database password, if used
      password:
      # <string> basic auth password
      basicAuthPassword:
    version: 1
    # <bool> allow users to edit datasources from the UI.
    editable: true
  1. Create a dashboard configuration file in grafana/provisioning/dashboards:
$ nano grafana/provisioning/dashboards/dashboards.yaml

With the following content:

apiVersion: 1

providers:
  - name: 'Goshimmer Local Metrics'
    orgId: 1
    folder: ''
    type: file
    disableDeletion: false
    editable: true
    updateIntervalSeconds: 10
    allowUiUpdates: true
    options:
      path: /var/lib/grafana/dashboards
  1. Add predefined Goshimmer Local Metrics Dashboard.

Head over to the GoShimmer repository and download local_dashboard.json.

$ wget https://raw.githubusercontent.com/iotaledger/goshimmer/master/tools/monitoring/grafana/dashboards/local_dashboard.json
$ cp local_dashboard.json grafana/dashboards
  1. Add permissions to Grafana config folder
$ chmod -R 777 grafana

Run GoShimmer with Prometheus and Grafana:

$ docker-compose up -d

The Grafana dashboard should be accessible at http://<your-ip>:3000.

Default login credentials are:

  • username: admin
  • password: admin