Data farm monitoring & management tool for Sia
JavaScript HTML CSS

README.md

Sia Cluster 0.9.2

http://aspectron.com/#SiaCluster

dependencies Status license:mit

Sia Cluster is a solution for monitoring multiple Sia hosts (siad instances). It is useful if you are running siad across multiple computers and want to monitor their status from a single location.

Sia Cluster Screen Shot

Sia Cluster features include:

  • Pegging of storage cost to USD based on average market price of Sia Coin.
  • Monitoring average market price of Sia Coin.
  • Monitoring average price of storage on Sia network.
  • Remote configuration of siad operating parameters.
  • Monitoring of storage utilization and various siad metrics.
  • Monitoring computer metrics such as memory and network bandwidth utilization.

Browser Compatibility:

  • Chrome: Ok
  • FireFox:Ok
  • Android Chrome: Ok
  • Mobile Safari: Layout Problems
  • Safari: Layout Problems
  • Microsoft Edge: Very Slow

Sia Cluster is comprised of 2 projects

  • Sia Cluster - Server (this repository)
  • Sia Node - siad interface RPC relay

Sia Node must be deployed on all remote computers running Sia Host (siad) and configured to connect to Sia Cluster. Connectivity between Sia Cluster and Sia Node can be initiated in either direction (Sia Cluster to Sia Node or Sia Node to Sia Cluster).

Sia Cluster is developed on top of IRIS, as such, configuration, application deployment, RPC links and other conponents are configurable as described in IRIS documentation

Please refer to IRIS Project Configuration for general information on management of configuration files.

Setup

NOTE: Sia Cluster requires a local instance of siad running, so you must deploy the latest siad on the same system you will be running Sia Cluster. (local instance is needed for network statistics).

Download

Download binaries from GitHub located here: https://github.com/aspectron/sia-cluster/releases

NOTE: sia-cluster-bundle contains both Sia Cluster and Sia Node in a single archive.

Setup Sia Cluster (Must be done before Sia Node)

Sia Cluster requires MongoDB:

  • Windows: Setup will prompt to install MongoDB / Linux: sudo apt-get install mongodb

Setup Sia Cluster

  • Download & Extract sia-cluster-bundle-vX-platform.zip
  • Windows: run sia-cluster-vX-platform/bin/setup.bat / Linux: run sia-cluster-vX-platform/bin/setup

Setup will print auth which you will need to write down as it will be needed for the Sia Node setup.

Once complete, you can start Sia Cluster:

  • Windows: bin/sia-cluster.bat or bin/sia-cluster-service.bat / Linux: bin/sia-cluster or bin/sia-cluster-service

sia-cluster-service script runs Sia Cluster as a service (persistent+logging)

Once running, please review User Interface features.

Setup Sia Node

  • Windows: run sia-node-vX-platform/bin/setup.bat / Linux: run sia-node-vX-platform/bin/setup

You will need to specify:

  • auth - created by Sia Cluster setup
  • address/ip - of Sia Cluster server (default is 127.0.0.1; if not sure, hit ENTER)
  • path - to Sia data folder (containing host, consensus etc.); If running Sia-UI, setup script will attempt to locate this folder automatically in your APPDATA. If running siad, this should be the folder where siad resides.

Once complete, you can start Sia Node:

  • Windows: bin/sia-node.bat or bin/sia-node-service.bat / Linux: bin/sia-node or bin/sia-node-service

Migration

Both applications can be updated to the latest version on GitHub via Git using git pull. However, if you need to migrate your settings the files you need to copy are:

  • config/sia-cluster.local.conf
  • config/settings.local.json
  • config/sia-node.local.conf

Also, please make a note that applications are identified via UUID which is located in uuid file in the root of the application folder. If you want to migrate Sia Node from one computer to another and perserve its id (so that Sia Cluster doesn't treat it as a new node, then you must copy uuid file as well)

Dependencies

Follogin instructions are applicable only if you are installing Sia Cluster manually. If you installed using a setup file, you do not need to install dependencies other than MongoDB.

Sia Cluster runs on top of NodeJs and requires a local instance of MongoDb.

Once NodeJs is installed, you need to install Bower npm module. If you do not do this, some Sia Cluster NPM modules will fail to install. You can do this by running:

npm install bower -g

Linux

For linux, we recommend NodeJs installation instructions located here:

Full installation script:

cd ~
wget https://nodejs.org/dist/v6.2.2/node-v6.2.2-linux-x64.tar.xz
tar xf node-v6.2.2-linux-x64.tar.xz
ln -s node-v6.2.2-linux-x64 node
echo -e "\n\nPATH=\"\$HOME/node/bin:\$PATH\"\n\n" >> ~/.profile
source ~/.profile
sudo apt-get install git mongodb build-essential -y
npm install bower -g
git clone https://github.com/aspectron/sia-cluster
cd sia-cluster
npm install
node sia-cluster

Windows

For windows, download and install:

After MongoDb installation you must create C:\data\db folder. (Alternatively you can run mongod --dbpath xxx to specify an alternate location). Once installed, you must run MongoDb executable that is typically located at "C:\Program Files\MongoDB\Server\3.0\bin\mongod.exe".

Following this, you can proceed with installation of Sia Cluster. Run the following from command line:

npm install bower -g
mkdir sia
cd sia
git clone https://github.com/aspectron/sia-cluster
cd sia-cluster
npm install
node sia-cluster

Usage

Sia Cluster is a server application meant to run together with Sia Node.

Once running, you can access user interface at http://localhost:5566

To deploy Sia Cluster as a daemon on ubuntu using Upstart service, you can use following instructions: https://github.com/aspectron/iris-app#deploying-as-ubuntu-upstart-service

You can also place it behind NGINX if your system is already running NGINX or you would like to bind it to a specific domain name: https://github.com/aspectron/iris-app#using-nginx-as-a-proxy

Basic Auth

To prevent anyone from reaching user interface of Sia Cluster, you can enable "basic auth", which will cause browser to ask for username and password before displaying any web content.

To enable basic auth, add the following directive in your sia-cluster.local.conf:

    basicAuth : {
        user : "<username>",
        pass : "<plain-text-password>"
    }

User Access

To gain access to the user interface, you need to create a local user. To do this, add the following configuration object to config/sia-cluster.local.conf:

    users : {
        "<username>": { 
            pass: "<sha256-hex-of-your-password>" 
        }
    },

To generate a password, you can use simple hex output of sha256. This can be easily done here: http://www.xorbin.com/tools/sha256-hash-calculator or in NodeJs:

console.log(require("crypto").createHash("sha256").update("<password>").digest("hex"));

User login to Sia Cluster implements geometric back-off algorithm, which means that each time incorrect login is made from a specific IP, the amount of seconds user has to wait doubles.

Configuring inbound RPC

You need to create and set a unique rpc.auth hex string that will match all of your Sia Node deployments. You can optionally change port on which RPC is listening (as long as it matches Sia Node configuration).

Example of RPC server configuration located in config/sia-cluster.local.conf:

    rpc : {
        node : {
            port : 58481,
            auth : "1299ece0213565353df003a3491081ed5016a10d81c06e5f319f17717a965d28"
        }
    },

Example of Sia Node RPC client configuration located in config/sia-node.local.conf:

    rpc : {
        address : "<sia-cluster-ip>:<sia-cluster-rpc-port>",
        auth : "<hex-string-matching-auth-configured-on-sia-cluster>"
    }

Configuring outbound RPC

If your instance of Sia Cluster is running on a computer behind NAT or firewall but your Sia Node instances are running on the public network, you can configure an RPC channel to connect from Sia Cluster to Sia Node (instead of Sia Node connecting to Sia Cluster).

To do this, add the following configuration option to your config/sia-cluster.local.conf file:

    rpc : {
        dpts : {
            address : '<sia-node-ip>:<sia-node-port>',
            auth : "<hex-string-matching-auth-configured-on-sia-node>"
        }
    },

Example of Sia Node RPC client configuration located in config/sia-node.local.conf:

    rpc : {
        port : <sia-node-rpc-port>,
        auth : "<hex-string-matching-auth-configured-on-sia-cluster>"
    }

SSL Certificates

By default Sia Cluster is not configured to serve user interface via HTTPS, hence SSL certificates are not needed.

SSL certificates are only included in Sia Cluster project to allow linking nodes to server via IRIS RPC. These certificates are fake and are only required because IRIS RPC uses JSON over TLS.

You do not need to install your own certificates. Instead, you only need to configure auth parameter across Sia Cluster and all Sia Node instances to a matching private string. auth is a pre-shared key and connecting parties will reject connection if it does not match.

For additional information you can refer to IRIS RPC Documentation and IRIS SSL Configuration.

User Interface

Sia Coin (SC) Value Editors

Sia Coin value editors accept value format the same way siac does. The smallest unit of siacoins is the hasting. One siacoin is 10^24 hastings (H). Other supported units are:

  • pS (pico, 10^-12 SC)
  • nS (nano, 10^-9 SC)
  • uS (micro, 10^-6 SC)
  • mS (milli, 10^-3 SC)
  • SC
  • KS (kilo, 10^3 SC)
  • MS (mega, 10^6 SC)
  • GS (giga, 10^9 SC)
  • TS (tera, 10^12 SC)

If you do not include a suffix, the system interprets value as SC.

Metric vs Binary

Please not that some values are presented in metric (SI units) such as GB, TB, while others are presented in binary units such as GiB, TiB.

When editing storage size values, you can specify corresponding units as well as expressions. 1/3GiB will result in 357913941 Bytes

USD Pegging & Tracking Average Network Price

Sia Cluster provides ability to automatically control storage pricing. Pricing can be controlled via USD Pegging, by tracking USD/SC value of Sia Coin on major markets or by monitoring Average Host Price and then offsetting it if desired.

Following parameters for price tracking are available in the Sia Cluster panel:

  • Track Price - Enable / Disable price tracking on nodes
  • Track Method - USD Peg, Average or Weighted
  • Target USD/TB/MO - For USD Pegging: Target USD value per TB per Month
  • Price Factor (Avg.) - For Average or Weighted Host Price: Multiplier for average or weighted host price to set local cluster price (for example: 0.9 will result in 90% of the average or weighted price)
  • Min Price - Minimum price (floor - price won't drop below this value)
  • Max Price - Maximum price (ceiling - price won't go above this value)
  • Storage Price Update - Time interval for price updates in minutes

Dashboard

Sia Cluster UI was originally designed to be a dashboard view. Main Settings menu has a UI tab. In this dialog, you can adjust sizes of the font and panels. Sizes of these elements are stored in the URL (hash). As such, once UI is configured to your liking, you can bookmark the URL and later invoke it to restore your configuration. This is especially useful if you have extra monitors or have some form of monitoring OCD.

Data Updates

Sia Node polls siad as well as gathers system stats once a minute and sends the data over to Sia Cluster. Certain actions on Sia Cluster cause immediate update. In general, if you are interfacing with siad using the Sia UI or siac console interface (or any other connecting applications), changes to internal settings will reflect in Sia Cluster UI within a minute.

Network panel contains general information about the Sia network. This information is being polled from explore.sia.tech block explorer.

Logs

If needed, you can examine SIAD log files by going to node Settings dialog Advanced tab. Logs larger than 2 MiB will get truncated at the beginning.

Security

If you intend on using Sia Cluster over the open Internet, you need to take security percautions:

  • For various reasons, your process may endup running as root (if you need HTTP to listen on port below 2000 or use default systemd or upstart configuration). To avoid running Sia Cluster with root priveleges (but still be able to listen to port 80), you can create secureUnderUser : 'username' directive in the sia-cluster.local.conf file. If Sia Cluster process starts as root, it will open all necessary ports and then switch it's priviledge to that of the user specified in this directive.
  • Enable SSL (HTTPS) by setting ssl : true and redirectToSSL : true in config files.
  • Enable basicAuth (example is given in sia-cluster.local.conf-example file) to obscure the application.
  • Generate your own SSL certificates and copy them as certificates/sia-cluster.local.key and certificates/sia-cluster.local.crt
  • If you have a Cloud Flare account, you can place Sia Cluster behind Cloud Flare to use their automatically generated SSL certificates.
  • You can also place the entire setup behind NGINX proxy and use NGINX configuration. This is especially useful if you need to serve Sia Cluster over port 443 while having other services on the same server. NGINX proxy setup instruction are available here
  • When unlocking wallets remotely, it is best if you use "local passphrase" as opposed to entering the encryption key of the wallet itself (which is also your wallet seed). This prevents transmission of the seed over communication channels. No matter how secure your setup is, if the machine on which Sia Cluster is running is compromised, software can be modified to listen in on all communication exchange and subsequently your seed can be stolen.
  • Always backup all the seeds from all computers!

Changelog

0.9.2

  • Now releasing standalone setup zip files which include all dependencies (except MongoDB) as well as provide auto configuration of Sia Cluster and Sia Node
  • Allowing for smaller panel sizes
  • Introduced custom host.externalsettings.storageused to easily see used storage (if total vs. remaining is in TB, then you can't see amount used in MB because of scale formatting in UI)
  • Changing the way peers are accounted for, using hostdb.all for "Peers Seen" and hostdb.active for "Peers Hosting".