logo

Crytonodes

Kite module for crypto-nodes deployment

#Overview

There are two possible ways to deploy cryptonodes:

  • Using Packer

  • Inside the K8s cluster

    Requirements

For Packer-based installation:

  • Packer

  • Terraform

  • Kite

    Supported currencies:

    1. ETH and ERC20 tokens - Geth or Parity.
    2. BTC - Bitcoind.
    3. BCH - Bitcoin ABC.
    4. LTC - Litecoind.
    5. Dash - Dashd.
    6. Ripple - Rippled

For K8s based installation:

#Prepare

Go through first steps, described in administration.md

  • Installation
  • Create a base platform repository
    • Install the Kite DevOps tool
    • Create your Infrastructure as Code base repository
    • Change configuration for cloud provider
    • Generate an environment(e.g. development/test/production)
    • Add a module to your environment

Do not apply Terraform configuration from the environment

#Usage

Fill in the configurations of your nodes deployment

$> $EDITOR config/environments/<env>/vars.kite-opex.yml

Find this block in the file and fill it in with the correct options

# THIS CONFIGURATION IS USED BOTH FOR PACKER AND K8S CRYPTONODES DEPLOYMENT
cryptonodes:
  ethereum:
    enabled:         true      # Set to false if you don't want it to be deployed
    client:          "geth"    # Available options: geth, parity.
    network:         "rinkeby" # Available options: rinkeby, kovan, mainnet.
    disk_size:       "30"
    hostname:        "eth.helioscloud.com"
    rpcport:         "8545"
    port:            "30303"
    whitelisted_ips: ["0.0.0.0/0"]

  ripple:
    ...

For Packer based installation:

You need to build images for cryptonodes you want to deploy (ethereum bitcoind bitcoincash litecoind dashd rippled wcg):

$> bundle exec rake "cryptonodes:build[image]" # This will build the exact image you specify
$> bundle exec rake "cryptonodes:build:all"    # This will build all images enabled in config/environments/stage/vars.kite-opex.yml

All images will be stored in gcp, you do not need to build an image if you have one already.

After build finishes, put image (smth like geth-1524260905) to config/environments/<env>/vars.kite-opex.yml:

variables:
  terraform:
    ethereum_image: geth-1524260905

Make sure you disabled cryptonodes you do not want to deploy (enabled: false)

Now you can deploy cryptonodes:

kite terraform init
kite terraform apply

RPC API Cheatsheet

Configuration for each cryptonode you can find in:

$> cat cryptonodes/images/(cryptonode).json                     # Configuration for cryptonode image
$> cat cryptonodes/resources/(cryptonode)/(cryptonode).conf     # Configuration for cryptonode image
$> cat cryptonodes/resources/(cryptonode)/(cryptonode).service  # Configuration for cryptonode image
$> cat cryptonodes/resources/scripts/install-(cryptonode).sh    # Bash script that packer uses to build cryptonode image

After successfull deployment, crypto node synchronization will start and take a while. Please be patient.

You can find more information about your deployment using gcloud or Google Cloud Platform UI.

$> gcloud compute instances list
NAME            ZONE            MACHINE_TYPE  PREEMPTIBLE  INTERNAL_IP  EXTERNAL_IP      STATUS
image-xxxx      xxxxxx-xxxxx-x  xx-xxxxxxxx-x              10.xxx.x.x   35.xxx.xxx.xxx   RUNNING

You can also see your deployed cryptonodes using

$> kite t show

Among other created resources you'll see deployed cryptonodes on virtual machines

If you want to tear down a cryptonode you can do:

$> kite t destroy (cryptonode VM) # you can find the exact VM by doing `kite t show`

For a Kubernetes-based installation:

Apply the infrastructure configuration:

bin/opex infra install all

This will create K8s cluster and install all the required dependencies for us to deploy cryptonodes. After the command has finished successfully, verify cryptonodes configuration in the files:

$> $EDITOR config/environments/<env>/bitcoind.yml
$> $EDITOR config/environments/<env>/parity.yml

If the configuration is correct, deploy the cryptonodes using the command:

bin/opex deps install bitcoind
bin/opex deps install parity

This type of installation allows RPC requests only inside the local Kubernetes network. So in order to configure Peatio for deployed cryptonodes pass the following URLs:

Bitcoind url: http://user:password@bitcoind.*KITE_ENV*-backend:18332
Parity url: http://parity.*KITE_ENV*-backend:8545