Skip to content

Linking to ethstats.net

benjaminion edited this page Dec 4, 2016 · 6 revisions

Now you've got your Parity node running, you want it to show up on the very funky https://ethstats.net/ dashboard, right? The good news is that a docker-based solution is available from the GitHub eth-net-intelligence-api repository.

Build the ethnetintel docker image

Download the Docker file from the repository and build an image as follows.

wget https://raw.githubusercontent.com/cubedro/eth-net-intelligence-api/master/Dockerfile
docker build -t ethnetintel:latest .

Mounting app.json file and getting the password

Once you have your image, there is a local configuration file required, app.json which needs to be stored outside the container so that it survives image updates and container rebuilds. You can download this too from the repository. I put it in /share/homes/admin/docker/ethnetintel/app.json on the QNAP filesystem.

Some lines in this file need to be edited for your configuration. It's pretty self-explanatory.

One of the lines sets a WS_SECRET value. This you need to get hold of from someone in the know. I got it by asking nicely on the Parity Gitter channel.

Docker Compose

Docker Compose comes into its own when managing the Parity and the EthNetIntel images together. Here's what I'm using: the Parity part is unchanged; the EthNetIntel part is added.

version: '2'
services:
  parity:
    image: ethcore/parity:beta-release
    entrypoint: /build/parity/target/release/parity --cache-size 512 --pruning fast --warp
    network_mode: 'host'
    volumes:
      - /share/CACHEDEV2_DATA/parity:/root/.parity
    mem_limit: 1.5G
  ethnetintel:
    image: ethnetintel
    depends_on:
      - parity
    volumes:
      - /share/homes/admin/docker/ethnetintel/app.json:/home/ethnetintel/eth-net-intelligence-api/app.json
    network_mode: 'host'
    mem_limit: 200M

Now you just need to do docker-compose up -d and Docker Compose will manage everything. It will restart containers only if necessary, and will start-up Parity before starting EthNetIntel (due to the depends_on clause).

The notes in the Docker file for EthNetIntel suggest that the EthNetIntel container should "own" the network and the Ethereum node should depend on that. However, I find that the EthNetIntel process needs to be restarted much more frequently than Parity, so it's better for the Parity container to "own" the network so that EthNetIntel can be restarted without restarting Parity. In my current set-up, both containers use the host network, so this is not an issue.

Periodically Restarting EthNetIntel

For reasons unclear - and believe me I've tried hard to diagnose it - once a day the EthNetIntel process stops relaying statistics to the ethstats.net site. The container continues to run, everything looks OK locally, but the data stops getting through.

Having totally failed to get to the bottom of this I've taken a brute-force approach and now use a cron job to restart the container periodically.

I added the following line to /etc/config/crontab. Modify it to use your container name, and the path to your docker command, if necessary. This will restart the EthNetIntel container only if it is already running.

43 * * * * /share/CACHEDEV2_DATA/.qpkg/container-station/bin/docker inspect ethnetintel_ethnetintel_1 >/dev/null 2>&1 && /share/CACHEDEV2_DATA/.qpkg/container-station/bin/docker restart ethnetintel_ethnetintel_1

Now run

crontab /etc/config/crontab

This will restart the EthNetIntel container at 43 minutes past every hour, which is effective, if somewhat inelegant. This addition seems to survive reboots of the NAS.