Skip to content

dashpay/dash-network-deploy

Repository files navigation

Dash Network Deployment Tool

Latest Release Build Status Release Date standard-readme compliant

Introduction

This tool assists in deploying and managing Dash networks.

There are two regular available networks: testnet and mainnet. After deployment your DashCore instances will join those networks.

regtest and devnet-* networks are for testing purposes. Devnets are like regular Dash networks (mainnet and testnet) but easier to bootstrap and with unique names. This supports maintaining multiple in parallel.

This is work in progress and in its initial state only meant to be used by Dash Core developers to assist in Dash Platform development.

Installation

  1. Install Docker

  2. Download tool:

    Using wget:

    wget -P /usr/local/bin https://raw.github.com/dashpay/dash-network-deploy/master/bin/dash-network && \
    chmod +x /usr/local/bin/dash-network

    Using curl:

    curl -fsSL -o /usr/local/bin/dash-network https://raw.github.com/dashpay/dash-network-deploy/master/bin/dash-network && \
    chmod +x /usr/local/bin/dash-network

Configuration

Networks definition

You can use the generate command to generate configs for your network:

dash-network generate <network_name> <masternodes_amd_count> <masternodes_arm_count> <hp_masternodes_amd_count> <hp_masternodes_arm_count>

Terraform configuration is defined in the *.tfvars files. See variables.tf for all available options.

Ansible configuration is stored in the *.yml file. The group_vars/all file contains the majority of playbook options. The rest are defined in ansible roles.

Configure your credentials in the .env file.

Using git

Please don't forget to include the following in your .gitignore:

.env
*.inventory
*.ovpn

Deployment

To deploy a Dash Network, use the deploy command with a particular network name:

dash-network deploy <network_name>

You may pass the --only-infrastructure or --only-provisioning option to target either infrastructure or software provisioning workflows.

To destroy an available Dash Network, use the destroy command:

dash-network destroy -t=<target> <network_name>

You can use the -t flag to choose which logical network components you want to destroy. It takes one of three values:

  • all (infrastructure with software)
  • network (L2+L1)
  • platform (L2 only)

Destroying only the network with -t=network allows you to redeploy the network in almost the same state by passing the -p option to the deploy command to skip infrastructure provisioning.

Destroying only the L2 platform components with -t=platform means you must comment out everything except roles which target masternodes and seed nodes in the deploy.yml playbook, and run the deployment again with the -p option.

List network services

dash-network list <network_name>

Testing

To test the network, run the test command with with particular network name:

dash-network test <network_name>

You may pass the --type option to run only particular tests (smoke, e2e). It is possible to specify several types using a comma delimiter.

Debugging

There are two commands that can be useful for debugging:

  • Show service logs: dash-network logs <network_name> <host> [docker logs options] <service_name>
    • See Docker log options for details
    • Example: dash-network logs devnet-example node-1 --since 3h dashd
  • Execute Dash Core RPC command: dash-network dash-cli <network_name> <hostname> <rpc_command>

Deploy Dash Platform

In order to deploy platform services, use the ansible variable:

```yaml
evo_services: true
```

Connect to private Dash Network services

You can use the OpenVPN config generated during deployment (<network_name>.ovpn) to connect to private services.

Manual installation

  1. Clone git repository:

    git clone https://github.com/dashpay/dash-network-deploy.git
  2. Install Ansible (v2.11.4+) and Terraform (v1.4.4+) per instructions provided on the official websites:

  3. Ensure Python dependencies are installed locally

    pip install -U netaddr jmespath ansible-lint boto3 botocore
  4. Install pre-requisite Ansible roles

    ansible-galaxy install -r ansible/requirements.yml
  5. Install AWS Command Line Interface

  6. Install Node.JS and dependencies:

    npm install
  7. Install OpenVPN:

    On Linux:

    apt-get install openvpn

    On Mac:

    brew install openvpn

New AWS account setup

If you are running this tool for the first time in a new AWS account, some initial setup needs to be done one time:

note: Please ensure you have the correct REGION and PROFILE setup in your AWS CLI configuration (aws configure) or use the --region and --profile flags with the AWS commands below.

  1. Create Terraform state S3 bucket manually:
aws s3 mb s3://bucket-name-here
  1. Create Terraform state dynamodb lock table manually
aws dynamodb create-table \
  --attribute-definitions AttributeName=LockID,AttributeType=S \
  --table-name tf-lock-table-test \
  --key-schema AttributeName=LockID,KeyType=HASH \
  --billing-mode PROVISIONED \
  --provisioned-throughput ReadCapacityUnits=2,WriteCapacityUnits=2 \
  --table-class STANDARD
  1. Route53 domain creation / delegation
aws route53 create-hosted-zone --name networks.domain.tld --caller-reference 1234567

Please note the values of these, as they will be needed in the network config files.