Git Product home page Git Product logo

node-ansible's Introduction

Node Ansible

Ansible playbooks to setup Matic validator node.

Requirements

Make sure you are using python3.x with Ansible. To check: ansible --version

Setup

Note: If your ssh public key (~/.ssh/id_rsa.pub) is already on the remote machines, skip this step.

Copy pem private key file as .workspace/private.pem to enable ssh through ansible. If you don't have pem file, just make sure you can reach remote machines from your own machine using ssh (ssh <username>@ip).

Inventory

Ansible manages hosts using inventory.yml file.

Setup inventory

Add nodes ip's in inventory.yml as example

Example:

#add your instance ips here in palce of xx..
xxx.xxx.xx.xx # <----- Add IP for sentry/validator node

Note: By default the user to login is setup as ubuntu in group_vars/all file. If you have a specific user to be logged in with please change the username in this file.

To check if nodes are reachable, run following commands:

# to check if nodes are reachable
ansible all -m ping

Networks

There are two networks available:

  • mainnet (Mainnet v1)
  • mumbai (Mumbai testnet)

While running Ansible playbook, network node_type heimdall_version bor_version needs to be set. These Values can be passed in --extra-var

Sentry node setup

To show list of hosts where the playbook will run (notice --list-hosts at the end):

ansible-playbook playbooks/network.yml --extra-var="bor_version=v0.3.0 heimdall_version=v0.3.0 network=mainnet node_type=sentry" --list-hosts

To run actual playbook on sentry nodes:

ansible-playbook playbooks/network.yml --extra-var="bor_version=v0.3.0 heimdall_version=v0.3.0 network=mainnet node_type=sentry"

Validator node setup (with sentry)

To show list of hosts where the playbook will run (notice --list-hosts at the end):

ansible-playbook playbooks/network.yml --extra-var="bor_version=v0.3.0 heimdall_version=v0.3.0 network=mainnet node_type=validator" --list-hosts

To run actual playbook on validator node:

ansible-playbook playbooks/network.yml --extra-var="bor_version=v0.3.0 heimdall_version=v0.3.0 network=mainnet node_type=validator"

To setup a validator wallet/keys

ansible-playboook -i $inventory playbooks/validator-setup.yml

Archive node setup

To show list of hosts where the playbook will run (notice --list-hosts at the end):

ansible-playbook playbooks/network.yml --extra-var="bor_version=v0.3.0 heimdall_version=v0.3.0 network=mainnet node_type=archive" --list-hosts

To run actual playbook on archive node:

ansible-playbook playbooks/network.yml --extra-var="bor_version=v0.3.0 heimdall_version=v0.3.0 network=mainnet node_type=archive"

Check sync status

To check the sync status you can run the follwing command on your node

$ curl http://localhost:26657/status

You can also use the following playbook

ansible-playbook -i $inventory playbooks/heimdall/get-sync-status.yml

The key called catching_up will show your sync status, if it's not catching up it means that you are fully synced!

Start The Bor service after the above command shows as false that mean heimdall is in sync

Command to Start Bor Service

sudo service bor start

Management commands

To clean deployed setup (warning: this will delete all blockchain data)

ansible-playbook -l <group-name> playbooks/clean.yml

To show Heimdall account

ansible-playbook -l <group-name> playbooks/heimdall/heimdall-show-account.yml

To increase ulimit

ansible-playbook -l <group-name> playbooks/ulimit.yml

To setup prometheus exporters

ansible-playbook -l <group-name> playbooks/setup-exporters.yml

This will install node and process exporter on machines for prometheus monitoring. Both exporters will be available at default ports.

To reboot machine

ansible-playbook -l <group-name> playbooks/reboot.yml

Stand-alone build

To setup Heimdall

ansible-playbook playbooks/heimdall/heimdall.yml --extra-var="heimdall_version=v0.3.0 network=mainnet node_type=sentry"

To show list of hosts where the playbook will run:

ansible-playbook playbooks/heimdall/heimdall.yml --extra-var="heimdall_version=v0.3.0 network=mainnet node_type=sentry" --list-hosts

To setup Bor

ansible-playbook playbooks/bor/bor.yml --extra-var="bor_version=v0.3.0 network=mainnet node_type=sentry"

To show list of hosts where the playbook will run:

ansible-playbook playbooks/bor/bor.yml --extra-var="bor_version=v0.3.0 network=mainnet node_type=sentry" --list-hosts

Adhoc queries

Ping

Just to see if machines are reachable:

ansible all -m ping

ping is a module name. You can any module and arguments here.

Run shell command

Following command will fetch and print all disk space stats from all hosts.

ansible all -m shell -a "df -h"

Snapshots and Backups

You can run the following playbook to start a snapshot on your host for bor

ansible-playbook -i $inventory playbooks/bor/snapshot-create -e "chaindata=$path target=$target_save_dir"
ansible-playbook -i $inventory playbooks/heimdall/snapshot-create -e "data=$path target=$target_save_dir"

You can run the following command on to take a backup of your validator. This playbook assumes you know path of bor and heimdall config directories

ansible-playbook -i $inventory playbooks/validator-backup.yml -e "destination=$WHERE_YOU_WANT_TO_SAVE_LOCALLY bor_path=PATH_TO_YOUR_BOR_INSTALL heimdall_path=PATH_TO_YOUR_HEIMDALL_PATH"

node-ansible's People

Contributors

0xkrishna avatar 0xsharma avatar bimlas avatar brixial avatar delroybosco avatar djpolygon avatar jdkanani avatar leon-africa avatar mrostamii avatar novy4 avatar piyushbagani avatar praetoriansentry avatar samlaf avatar sreevalsanmr avatar ssandeep avatar temaniarpit27 avatar tomasmik avatar vcastellm avatar voron avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

node-ansible's Issues

can not torch bootnodes

--bootnodes "enode://0cb82b395094ee4a2915e9714894627de9ed8498fb881cec6db7c65e8b9a5bd7f2f25cc84e71e89d0947e51c76e85d0847de848c7782b13c0255247a6758178c@44.232.55.71:30303,enode://88116f4295f5a31538ae409e4d44ad40d22e44ee9342869e7d68bdec55b0f83c1530355ce8b41fbec0928a7d75a5745d528450d30aec92066ab6ba1ee351d710@159.203.9.164:30303"

Cannot create symbolic link

Hi,

Getting always when install bor via ansible on last step that it cannot create symlink.
Any workaround for this?

TASK [install-bor : Creating symlink for bootnode] ******************************************************************************
fatal: []: FAILED! => {"changed": false, "gid": 0, "group": "root", "mode": "0755", "msg": "refusing to convert from file to symlink for /usr/bin/bootnode", "owner": "root", "path": "/usr/bin/bootnode", "size": 15287976, "state": "file", "uid": 0}

ExtraData:   type: string   description: "Extra data on the execution (Ethereum 1) network."   example: "0xcf8e0d4e9587369b2301d0790347320302cc0943d5a1884560367e8208d920f2"   pattern: "^0x[a-fA-F0-9]{0,64}$" LogsBloom:   type: string   example: "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"   pattern: "^0x[a-fA-F0-9]{512}$"

Build for is failing for ansible

TASK [install-bor : Build Bor] *****************************************************************************************************************************************************************************
fatal: [192.168.1.27]: FAILED! => {"changed": true, "cmd": ["make", "bor-all"], "delta": "0:00:00.002995", "end": "2021-06-20 16:11:23.502078", "msg": "non-zero return code", "rc": 2, "start": "2021-06-20 16:11:23.499083", "stderr": "make: *** No rule to make target 'bor-all'. Stop.", "stderr_lines": ["make: *** No rule to make target 'bor-all'. Stop."], "stdout": "", "stdout_lines": []}

PLAY RECAP *************************************************************************************************************************************************************************************************
192.168.1.27 : ok=17 changed=5 unreachable=0 failed=1 skipped=0 rescued=0 ignored=0

refusing to convert from file to symlink

Getting the following issue during bor install:

TASK [install-bor : Creating symlink for bootnode] ********************************************************************************************************************************************************
fatal: [18.208.153.17]: FAILED! => {"changed": false, "gid": 0, "group": "root", "mode": "0755", "msg": "refusing to convert from file to symlink for /usr/bin/bootnode", "owner": "root", "path": "/usr/bin/bootnode", "size": 21654472, "state": "file", "uid": 0}

installing on ubuntu host, using this https://github.com/shibaswaparmy/node-ansible

HOME dir

hey, is there any way for setting the HOME directory other than system's HOME env var?

this is painful

this must be most retarded devops structure i have ever seen. what is the deal with hardcoded paths on precompiled .deb packages?
you want people to suffer?

Is rabbitmq a required dependency?

I have deployed Heimdall and Bor by the given scripts. But I found the RabbitMQ service referenced by no one.

So my question is: Is rabbitmq a required dependency?

Documentation seems to be outdated.

Following the README.md and trying to run the Ansible playbooks on a new host, results in the follow error:

  1. Edit inventory.yml and add IP to validator and sentry.
  2. Confirm that hosts are reachable:
ansible sentry -m ping

SUCCESS
ansible validator -m ping

SUCCESS
  1. Run the playbook to install sentry and validator
ansible-playbook -l validator playbooks/network.yml --extra-var="bor_branch=v0.2.1 heimdall_branch=v0.2.0-mainnet-1d8aca37 network_version=mainnet-v1 node_type=sentry/validator"

...

TASK [install-heimdall : Creating symlink for bridge] *************************************************
changed: [xxx]

TASK [Build Bor] **************************************************************************************

TASK [install-bor : Cloning the Bor] ******************************************************************
changed: [xxx]

TASK [install-bor : Build Bor] ************************************************************************
fatal: [xxx]: FAILED! => {"changed": true, "cmd": ["make", "bor-all"], "delta": "0:00:00.002954", "end": "2021-05-02 23:41:02.410952", "msg": "non-zero return code", "rc": 2, "start": "2021-05-02 23:41:02.407998", "stderr": "make: *** No rule to make target 'bor-all'.  Stop.", "stderr_lines": ["make: *** No rule to make target 'bor-all'.  Stop."], "stdout": "", "stdout_lines": []}

Ansible version

ansible --version

ansible 2.10.3
  config file = /Users/nonsense/code/src/github.com/maticnetwork/node-ansible/ansible.cfg
  configured module search path = ['/Users/nonsense/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/local/Cellar/ansible/2.10.3_1/libexec/lib/python3.9/site-packages/ansible
  executable location = /usr/local/bin/ansible
  python version = 3.9.0 (default, Dec  6 2020, 18:02:34) [Clang 12.0.0 (clang-1200.0.32.27)]

Failed to start bor.

I followed the exact documentation and installed the server with ansible playbook. But bor can not start.

journalctl -u bor.service -f
systemd[1]: Stopped bor.
systemd[1]: bor.service: Start request repeated too quickly.
systemd[1]: bor.service: Failed with result 'exit-code'.
systemd[1]: Failed to start bor.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.