Skip to content

Backend service which runs along with Lisk and tracks the network status

License

Notifications You must be signed in to change notification settings

lisk-builders/lisk-network-reporter

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

79 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Lisk Network Reporter

This is the backend service which runs along with Lisk and tracks the network status, fetches information through api and connects through WebSockets to lisk-network-stats to feed information.

Master branch from and after 1.0.0 version of lisk core.
Legacy branch - before 1.0.0

Prerequisite

  • lisk up and running
  • node
  • npm

Installation

git clone https://github.com/karek314/lisk-network-reporter/ && cd lisk-network-reporter && bash build.sh

Configuration

nano app.json

And modify

[
  {
    "name"              : "lisk-network-reporter",
    "script"            : "app.js",
    "log_date_format"   : "YYYY-MM-DD HH:mm Z",
    "merge_logs"        : false,
    "watch"             : false,
    "max_restarts"      : 10,
    "exec_interpreter"  : "node",
    "exec_mode"         : "fork_mode",
    "env":
    {
      "NODE_ENV"        : "production",
      "RPC_HOST"        : "localhost",
      "RPC_PORT"        : "8000", <- 8000 for mainnet, 7000 testnet
      "LISTENING_PORT"  : "8000", <- 8000 for mainnet, 7000 testnet
      "INSTANCE_NAME"   : "", <- add your lisk address here or a custom name if you do voluntary work
      "CONTACT_DETAILS" : "", <- contact details, email or nick on lisk.chat to contact in case any failure
      "NETWORK_MODE"    : "main",
      "WS_SERVER"       : "ws://report.liskstats.net:3000",
      "WS_SECRET"       : "Go to https://lisk.chat and ask around",
      "FORGING"         : "no", <- set yes if your node is actively forging
      "VERBOSITY"       : 0
    }
  }
]

Run

Starting

pm2 start app.json --watch

Checking logs

pm2 logs lisk-network-reporter

Stopping

pm2 stop lisk-network-reporter

Generating a startup script

Before generating a startup script, make sure your Lisk node has also a startup mechanism on reboot (with crontab for example).

Now, let pm2 detect available init system, generate configuration and enable startup system:

pm2 startup

Now follow the instruction. For example on ubuntu 14.04 LTE (with systemd as default init system) :

[PM2] Init System found: systemd
[PM2] To setup the Startup Script, copy/paste the following command:
sudo env PATH=$PATH:/usr/bin /usr/local/lib/node_modules/pm2/bin/pm2 startup systemd -u [user] --hp /home/[user]

Copy-paste the last command. Now, if you didn't before, run the application with pm2 start app.json --watch and then:

pm2 save

This last command will save the process list and execute them on reboot.

If you want to remove the init script, execute:

pm2 unstartup [initsystem]

For more information: Official PM2 Startup Script page

Docker

You can run this container via docker by executing:

docker run -d -e RPC_HOST='your lisk node ip or hostname' -e INSTANCE_NAME='your lisk address' -e WS_SECRET="the liskstats secret" -e CONTACT_DETAILS="your contact details" -v /etc/localtime:/etc/localtime:ro docker-lisk-network-reporter:latest

Confurable ENV variables:

NODE_ENV RPC_HOST RPC_PORT LISTENING_PORT INSTANCE_NAME CONTACT_DETAILS NETWORK_MODE WS_SECRET IS_FORGING VERBOSITY

Credits

  1. To cuberdo and his eth-net-intelligence-api. It's foundation used for lisk-network-reporter.
  2. 5an1ty for creating support for Docker.
  3. hirishh for pm2 auto startup guide.

About

Backend service which runs along with Lisk and tracks the network status

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 93.9%
  • Shell 6.1%