Skip to content

Commit

Permalink
Merge pull request #7 from Alethio/v2.4.17
Browse files Browse the repository at this point in the history
V2.4.17
  • Loading branch information
baxy authored Feb 17, 2019
2 parents d232f17 + 96cf0ba commit 75dad65
Show file tree
Hide file tree
Showing 6 changed files with 98 additions and 99 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
# Changelog
All notable changes to this project will be documented in this file.

## [2.4.17] - 2019-02-17
- Fixed server reconnection bug
- Updated Readme file

## [2.4.16] - 2019-02-14
- Fixed web3 WebSocketProvider connection issue

Expand Down
103 changes: 47 additions & 56 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,24 +3,28 @@
> EthStats - Network Monitor - CLI Client
>
>
> The client application connects to your Ethereum node through RPC and extract data that will be sent to the `EthStats - Network Monitor - Server` for analytics purposes.
> The application connects to your Ethereum node through RPC and extract data that will be sent to the `EthStats - Network Monitor - Server` for analytics purposes.
# Live deployments
See active nodes or add your own on the following running deployments of the EthStats Network Monitor

[Mainnet](https://net.ethstats.io/)
[Görli Testnet](https://net.goerli.ethstats.io/)
- Mainnet - [net.ethstats.io](https://net.ethstats.io/)
- Görli Testnet - [net.goerli.ethstats.io](https://net.goerli.ethstats.io/)

# Supported Ethereum nodes
Geth, Parity, Pantheon, basically any Ethereum node that has RPC enabled.

# Contents
- [Getting Started](#getting-started)
- [Prerequisites](#prerequisites)
- [Install](#install)
- [Update](#update)
- [Running](#running)
- [CLI](#cli)
- [Daemon](#daemon)
- [With PM2](#with-pm2)
- [In Docker](#in-docker)
- [Register node](#register-node)
- [Config file](#config-file)
- [CLI Options](#cli-options)
- [Daemon](#daemon)
- [Docker](#docker)
- [Troubleshooting](https://github.com/Alethio/ethstats-cli/blob/master/TROUBLESHOOTING.md)
- [Changelog](https://github.com/Alethio/ethstats-cli/blob/master/CHANGELOG.md)
- [License](https://github.com/Alethio/ethstats-cli/blob/master/LICENSE)
Expand All @@ -37,18 +41,6 @@ Please make sure you have the following installed and running properly
- [Geth](https://geth.ethereum.org/install/) or [Parity](https://wiki.parity.io/Setup) running in one of the supported configurations **synced on the Ethereum main/foundation chain**
- JSON-RPC http or websockets or ipc APIs enabled and accessible on the Ethereum node of choice (Geth/Parity)

## Supported node configurations
Geth
- fast (`--syncmode "fast"`)
- full (`--syncmode "full"`)
- light (`--syncmode "light"`)
> tested 1.8.1,
Parity
- fast (`--pruning fast`)
- archive (`--pruning archive`)
- with no ancient blocks (`--no-ancient-blocks`)
> tested 1.7.11, 1.8.6, 1.8.7, 1.9.0, 1.9.1, 1.9.2, 1.10.0,

## Install

Expand Down Expand Up @@ -81,25 +73,42 @@ yarn global upgrade ethstats-cli
```

## Running
On the first run the app will start in interactive mode and you will be asked a series of questions to setup your node.
Either follow the on screen instructions or see [CLI options](#cli-options) for a non-interactive mode.

The app is configured by default to connect to an Ethereum node on the local machine (http://localhost:8545).
To connect to a node running on another host see `--client-url` under [CLI options](#cli-options).

After the setup is done, your node will be visible on [net.ethstats.io](https://net.ethstats.io/)
To run the app use the following command:
```sh
$ ethstats-cli
```
The app is configured by default to connect to the Ethereum node on your local host (http://localhost:8545).
To connect to a node running on a different host see `--client-url` under [CLI Options](#cli-options).

IMPORTANT: To be able to extract all statistics from the Ethereum node we recommend running the app on the same host. The usage information about the node like cpu and memory load cannot be extracted if on a different host.

### CLI
## Register node

To run the app in interactive mode you can use the following command:
On the first run of the app the first thing it does is to register the Ethereum node in our platform. For this you will be asked about the network the node is running on, email address and node name.

It is possible to register the node also in non interactive mode without asking the necessary infos by specifying the `--register` option like in the example bellow:
```sh
$ ethstats-cli
$ ethstats-cli --register --account-email your@email.com --node-name your_node_name
```

#### CLI options:
For more details on these options please see [CLI Options](#cli-options).

If the node is already registered and you still specify the `--register` option, it will be avoided. A new registration is possible if the [config file](#config-file) is deleted.

## Config file
After the node was successfully registered, a config file is created in the following location:
```sh
~/.config/configstore/ethstats-cli.json
```

It persists the node name, the secret key received on successfully registration and the values of the following CLI options:
- `--configurator-url`
- `--server-url`
- `--client-url`
- `--client-ipc-path`
- `--network`

# CLI Options:

```sh
--help, -h Show help
Expand All @@ -109,6 +118,7 @@ $ ethstats-cli

--server-url Server URL (Must include protocol and port if any)
--net, -n Specify Ethereum network your node is running on (Default: mainnet)
Available networks: mainnet|goerli
If --server-url is specified, this option is ignored

--client-url Client URL (Must include protocol and port if any; Default: http://localhost:8545)
Expand All @@ -124,28 +134,15 @@ $ ethstats-cli
--node-name Name of the node. If node is already registered, a unique 5 char hash will be appended
```
Running the app in non-interactive mode for the first time, you'll need to specify the `--register` option together with `--account-email` and `--node-name`.
Like this no questions will be asked. All other CLI options have default values.
Example:
```sh
$ ethstats-cli --register --account-email your@email.com --node-name your_node_name
```
If the app is already registered and you still specify the registration CLI option like in the example command above, they will be avoided.
If the node was successfully registered, a configuration file is created to persist the values of the CLI options previously specified.
Every CLI option that passes a value, once specified, it's value is stored in this configuration file, so the next time the app is started there's no need to specify does CLI options again.
### Daemon
# Daemon
To keep the app running at all times, you can run it as a daemon using the following command:
```sh
$ ethstats-daemon
```
#### Daemon options:
## Daemon options:
```sh
start Start daemon
Expand All @@ -158,7 +155,7 @@ $ ethstats-daemon
If any CLI options are specified after the Daemon option, they will be forwarded to the forked process.
The Daemon mode is implemented programmatically through the PM2 API. The API does not support the "startup" feature. To handle start on boot, check out the [PM2](#with-pm2) instructions.
### With PM2
## PM2
For more control you can use directly [PM2](http://pm2.keymetrics.io). Here is a JSON format process file that we recommend:
Expand All @@ -178,9 +175,9 @@ For more control you can use directly [PM2](http://pm2.keymetrics.io). Here is a
To handle daemon start at boot time, please visit [PM2-Startup](http://pm2.keymetrics.io/docs/usage/startup/).
### In Docker
# Docker
#### Installing and running
## Installing and running
The following commands assume that the Ethereum node is either running locally or in docker with `--net host`.
For other options you should check out [CLI options](#cli-options).
Expand Down Expand Up @@ -211,13 +208,7 @@ node:latest \
/bin/sh -c "yarn global add ethstats-cli && ethstats-cli --register --account-email your@email.com --node-name your_node_name"
```
The docker commands are run with `-d`, that means `ethstats-cli` is started in non-interactive mode.
To run in interactive mode change `-d` to `-it` and remove the `--register` option along with `--account-email` and `--node-name`.
If you already had a configuration file, the settings from that file will be used and the command line ignored. Delete the files in `/opt/ethstats-cli` to add a node with different settings.
#### Updating
## Updating
If you started from `alethio/ehtstats-cli` docker image:
Expand All @@ -228,7 +219,7 @@ docker stop ethstats-cli && docker rm ethstats-cli
then run it again.
If you started from `node/latest` docker image, just stop and remove the `ethstats-cli`:
If you started from `node:latest` docker image, just stop and remove the `ethstats-cli` container:
```sh
docker stop ethstats-cli && docker rm ethstats-cli
Expand Down
1 change: 1 addition & 0 deletions lib/Cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ export default class CLI {
--server-url Server URL (Must include protocol and port if any)
--net, -n Specify Ethereum network your node is running on (Default: mainnet)
Available networks: mainnet|goerli
If --server-url is specified, this option is ignored
--client-url Client URL (Must include protocol and port if any; Default: http://localhost:8545)
Expand Down
9 changes: 6 additions & 3 deletions lib/Server.js
Original file line number Diff line number Diff line change
Expand Up @@ -105,9 +105,9 @@ export default class Server {

this.socket = new PrimusSocket(`${this.url}`, {
reconnect: {
min: 1 + (Math.floor(Math.random() * 10)), // Random between 1 and 10 seconds
min: (1 + (Math.floor(Math.random() * 10))) * 1000, // Random between 1 and 10 seconds
factor: 1,
retries: 300 // Retries for 25 hours
retries: 8640
}
});

Expand Down Expand Up @@ -225,7 +225,10 @@ export default class Server {
}

destroy() {
this.socket.destroy();
if (this.socket) {
this.socket.destroy();
}

clearInterval(this.pingIntervalId);
clearInterval(this.checkLastBlockInterval);
}
Expand Down
Loading

0 comments on commit 75dad65

Please sign in to comment.