Skip to content

Latest commit

 

History

History
217 lines (152 loc) · 5.61 KB

File metadata and controls

217 lines (152 loc) · 5.61 KB

Running Observer Node using Ansible

The current version of Ansible scripts doesn't support a case when an Observer Node is connected to another organization's Public Sentries via Seed nodes (Option 1 from running-node-manual/on.md). If this is your case, please follow the manual steps described in running-node-manual/on.md.

Ansible scripts can still be used to connect an ON to VN/Sentries within your organization, or to connect an ON to another organization's public nodes with known public IPs (Option 2 and 3 from running-node-manual/on.md).

Prerequisites

Make sure you have all prerequisites set up

Configure DCL network parameters (local machine)

1. Set network chain ID

[deployment/ansible/inventory/hosts.yml]

all:
  vars:
    chain_id: <chain-id>
  ...

Every network must have a unique chain ID (e.g. test-net, main-net etc.)

Example for Testnet 2.0 (clickable)
all:
  vars:
    chain_id: testnet-2.0
  ...
Example for Mainnet (clickable)
all:
  vars:
    chain_id: main-net
  ...

2. Put genesis.json file under specific directory

  • Get or download genesis.json file of a network your node will be joining and put it under the following path:

    deployment/persistent_chains/<chain-id>/genesis.json
    

    where <chain-id> is the chain ID of a network spefied in the previous step.

    Example for Testnet 2.0 (clickable)

    For testnet-2.0 the genesis file is already in place. So you don't need to do anything!

    deployment/persistent_chains/testnet-2.0/genesis.json
    
    Example for Mainnet (clickable)

    For main-net the genesis file is already in place. So you don't need to do anything!

    deployment/persistent_chains/main-net/genesis.json
    

Configure node type specific parameters (local machine)

1. Specify target instance address in the inventory file

[deployment/ansible/inventory/hosts.yml]

all:
    ...
    children:
      ...
      observers:
        hosts:
        <observer node IP address or hostname>
      ...

2. Set persistent peers string in observer configuration

[deployment/ansible/roles/configure/vars/observer.yml]

...
config:
  p2p:
    persistent_peers: "<node1-ID>@<node1-IP>:26656,..."
...
  • If an Observer node needs to be connected to my organization nodes:
    • If your VN doesn't use any Private Sentry nodes, then persistent_peers must point to the Validator node with private IP.
    • Otherwise, persistent_peers must point to the Private Sentry nodes with private IPs.
    • Use the following command to get node-ID of a node: ./dcld tendermint show-validator.
  • If an Observer node is connected to another organization's public nodes:
    • persistent_peers must point to another organization nodes with public IPs that this organization shared with you.

3. (Optional) If you are joining a long-running network, enable statesync or use one of the options in running-node-in-existing-network.md

[deployment/ansible/roles/configure/vars/observer.yml]

config:
...
  statesync:
    enable: true
    rpc_servers: "http(s):<node1-IP>:26657, ..."
    trust_height: <trust-height>
    trust_hash: "<trust-hash>"
...
Example for Testnet 2.0 (clickable)
config:
  statesync:
    enable: true
    rpc_servers: "https://on.test-net.dcl.csa-iot.org:26657,https://on.test-net.dcl.csa-iot.org:26657"
Example for Mainnet (clickable)
config:
  statesync:
    enable: true
    rpc_servers: "https://on.dcl.csa-iot.org:26657,https://on.dcl.csa-iot.org:26657"

NOTE: You should provide at least 2 addresses for rpc_servers. It can be 2 identical addresses

You can use the following command to obtain <trust-height> and <trust-hash> of your network

curl -s http(s)://<host>:<port>/commit | jq "{height: .result.signed_header.header.height, hash: .result.signed_header.commit.block_id.hash}"
Example for Testnet 2.0 (clickable)
curl -s https://on.test-net.dcl.csa-iot.org:26657/commit | jq "{height: .result.signed_header.header.height, hash: .result.signed_header.commit.block_id.hash}"
Example for Mainnet (clickable)
curl -s https://on.dcl.csa-iot.org:26657/commit | jq "{height: .result.signed_header.header.height, hash: .result.signed_header.commit.block_id.hash}"
  • <host> - RPC endpoint host of the network being joined
  • <port> - RPC endpoint port of the network being joined

NOTE: State sync is not attempted if the node has any local state (LastBlockHeight > 0)

Run ansible (local machine)

1. Verify that all the configuration parameters from the previous section are correct

2. Run ansible

ansible-playbook -i ./deployment/ansible/inventory  -u <target-host-ssh-user> ./deployment/ansible/deploy.yml
  • <target-host-ssh-username> - target host ssh user
  • Ansible provisioning can take several minutes depending on number of nodes being provisioned

Deployment Verification (target machine)

1. Switch to cosmovisor user

sudo su -s /bin/bash cosmovisor

2. Query status

dcld status