Install and monitor skypool’s Nimiq client via ansible playbook, systemd and ruby & cron

INTRODUCTION

This is a short entry to document installation and monitoring of the skypool nimiq client. The Nimiq network is a decentralized payment network that runs in the browser and is installation-free.

Personally, i believe that the Litecoin and Ethereum projects have been so far able to generate a strong economy around them, however, projects like Nimiq definitely convince me in terms of usability and simplicity approach to the user.

CONTENT

I am considering Ubuntu 16.04 as base operating system.

The playbook does the following things:

  1. Install the necessary dependencies
    ruby-dev for ruby 2.3, ruby gem package manage
    unzip to handle the release file from github
  2. Create a specific user nimiq and a program directory /opt/nimiq
  3. Download and unpack the release file from github under a version-specific directory below the program directory
  4. Create skypool client configuration file according to your demands and with your wallet address
  5. Create a systemd unit file, start the skypool client as a service and enable restart on reboot
  6. Create a status checker that uses the skypool api to check the worker’s online/offline status
  7. Create a crontab entry for the root user to run the status checker every ten minutes

REMARKS

cron

The cron entry running every 10 minutes is a tradeoff on how brittle the online/offline check delay currently is experienced by me through the skypool site. Presumably skypool does not have a real heartbeat check towards the worker but assumes that the worker is online when it receives results from it, and subsequently assumes the worker to be offline if it does not (most pools in the cryptocurrency world work like that). That means in terms of perfect time period between checks, your mileage may vary.

systemd

The service runs currently under the user nimiq, hence a non-privileged user of the system. However, the systemd daemon used is the one from root. Hence only the root user can restart the nimiq service. For this reason, the cron entry is registered through the root user. If you want to be able to use the nimiq user to restart the nimiq service, you have to run a systemd daemon based on the nimiq user. I have successfully done that for another service playbook, and I might add this information in the future, if demand is voiced.

GIST

Find below the full gist as published on github. Full gist here.

Leave a Reply

Your email address will not be published. Required fields are marked *