vedran

command module
v0.2.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 26, 2020 License: Apache-2.0 Imports: 1 Imported by: 0

README

Vedran

Polkadot chain load balancer.

Architecture

Vedran loadbalancer is used in conjunction with Vedran daemon. Suppose the node owner wants to register to loadbalancer, than it is required to install and run Vedran daemon. Daemon executes the registration process and starts providing all relevant information (ping, metrics) to the Vedran loadbalancer. Please check Vedran daemon repo for more details on the daemon itself.

Image of vedran architecture

Demo

Requirements

Run demo with docker-compose up

After all components have been started and node has sent first valid metrics report (after 30 seconds), you can invoke RPC methods on localhost:4000

This demo starts three separate dockerized components:

Get vedran package

  1. Install Golang 1.13 or greater
  2. Run the command below
go get github.com/NodeFactoryIo/vedran
  1. Run vedran from your Go bin directory. For linux systems it will likely be:
~/go/bin/vedran

Note that if you need to do this, you probably want to add your Go bin directory to your $PATH to make things easier!

Starting loadbalancer

First download latest prebuilt binaries from releases.

Load balancer is started by invoking start command.

For example ./vedran-linux-amd64 start --auth-secret=supersecret.

You can always run vedran with --help flag for list of all commands vedran --help or for list of all options for specific command vedran start --help.

Load balancer will expose Polkadot RPC API on port 4000 by default (can be changed using flag --server-port)

Start command will start application on 2 ports that need to be exposed to public:

    • RPC entrypoint to nodes and API for nodes to register to load balancer (default: 4000)
    • http tunnel server for creating tunnels between the node and load balancer so node operators don't to have expose nodes to public network (default: 5223)
Required flags

--auth-secret authentication secret used for generating tokens

Most important flags

--server-port - port on which RPC API is exposed - DEFAULT [4000]

--public-ip - public IP address of loadbalancer - DEFAULT uses multiple services to find out public IP

--tunnel-port - port on which tunnel server is listening for connect requests - DEFAULT [5223]

--tunnel-port-range - range of ports that will be used for creating tunnels - DEFAULT [20000:30000]

Other flags

--name - public name for load balancer - DEFAULT autogenerated name is used

--capacity - maximum number of nodes allowed to connect - DEFAULT [-1] unlimited capacity

--whitelist - Comma separated list of node id-s, if provided only these nodes will be allowed to connect. This flag can't be used together with --whitelist-file flag, only one option for setting whitelisted nodes can be used - DEFAULT no nodes whitelisted

--whitelist-file - Path to file with node id-s in each line that should be whitelisted. This flag can't be used together with --whitelist flag, only one option for setting whitelisted nodes can be used - DEFAULT no file used

--fee - value between 0-1 representing fee percentage that loadbalancer will take - DEFAULT [0.1]

--selection - type of selection that is used for selecting nodes on new request, valid values are round-robin and random - DEFAULT [round-robin]

--log-level - log level (debug, info, warn, error) - DEFAULT [error]

--log-file - path to file in which logs will be saved - DEFAULT [stdout]

Vedran loadbalancer API

POST api/v1/nodes

Register node to loadbalancer. Body should contain details about node:

{
  "id": "",
  "config_hash": "",
  "node_url": "",
  "payout_address": ""
}

Returns token used for invoking rest of API.


POST api/v1/nodes/pings

Ping loadbalancer from node. Auth token should be in header as X-Auth-Header.


PUT api/v1/nodes/metrics

Send metrics for node. Auth token should be in header as X-Auth-Header. Body should contain metrics as:

{
  "peer_count": "",
  "best_block_height": "",
  "finalized_block_height": "",
  "ready_transaction_count": ""
}

License

This project is licensed under Apache 2.0:

Documentation

The Go Gopher

There is no documentation for this package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL