Git Product home page Git Product logo

ansible's Introduction

ansible

This is a set of playbooks we use to bootstrap everything.

Things to consider

This Ansible set of playbooks assumes you're using zsh as your shell and adds all aliases to ~/.zshrc, so consider updating it if you use another shell.

Prerequisites:

  1. Obviously you need Ansible itself installed.

  2. You need to install a node_exporter role by running ansible-galaxy install cloudalchemy.node_exporter and install its requirements in case you would want to install node_exporter there.

  3. You need to create hosts.txt with all of your hosts, here's an example:

[validators]
validator-1      ansible_host=192.168.1.1

[testnets]
validator-2      ansible_host=192.168.1.2

[fullnodes:children]
validators
testnets

[chain_1]
validator-1
validator-2

[fullnodes:vars]
ansible_user=<your hostname>
ansible_ssh_private_key_file=<your SSH keyfile>

Specifically, you need to group all your hosts by chain (put all of the hosts on one chain under a group), and all hosts should be under fullnodes groups (either directly or indirectly). We personally use validators and testnets groups for mainnet and testnet validators, and monitoring for fullnodes used not for validators.

  1. You need to specify the variables for each chain which will be later used for bootstrapping a node, such as github repository path, binary version, where to put a binary, minimal gas prices, seeds, peers, genesis path etc. Check out the files in group_vars/ for reference.

You should put the variables into the following files:

  • group_vars/all for variables needed for all servers
  • group_vars/fullnodes for variables needed for fullnodes
  • group_vars/<chain-name> for variables for fullnodes for specific chain
  • host_vars/<host-name> for variables for specific host (like ansible_become_pass)
  1. You now may run playbooks to bootstrap it. Each playbook accepts -e "hosts=<hosts to run at>" argument, otherwise it'll run on all hosts.

Bootstrapping a server

  1. Install node_exporter, enables and starts it:
ansible-playbook playbooks/server/01-node-exporter.yml --extra-vars "hosts=validator-1"
  1. Install zsh, antigen, powerlevel10k and sets it all up:
ansible-playbook playbooks/server/02-zsh.yml --extra-vars "hosts=validator-1"

Bootstrapping a full node

This is a set of playbooks to bootstrap a single fullnode on any cosmos-sdk based chain.

  1. Install Golang binary (needed to compile a fullnode binary from source):
ansible-playbook playbooks/fullnode/01-golang.yml --extra-vars "hosts=validator-1"
  1. Fetch and install latest fullnode binary:
ansible-playbook playbooks/fullnode/02-install-fullnode-binary.yml --extra-vars "hosts=validator-1"
  1. Init a fullnode and set up its config.
ansible-playbook playbooks/fullnode/03-setup-fullnode.yml --extra-vars "hosts=validator-1"
  1. Download Cosmovisor, set up its folder layout and setup a systemd service for it:
ansible-playbook playbooks/fullnode/04-install-cosmovisor.yml --extra-vars "hosts=validator-1"
  1. Set up statesync:
ansible-playbook playbooks/fullnode/05-statesync.yml --extra-vars "hosts=validator-1"
  1. Download, build and install tendermint-exporter:
ansible-playbook playbooks/fullnode/06-tendermint-exporter.yml --extra-vars "hosts=validator-1"
  1. Restarts the full node or starts it if it was stopped.
ansible-playbook playbooks/fullnode/07-start-node.yml --extra-vars "hosts=validator-1"
  1. Get node status (useful to see the info from multiple servers)
ansible-playbook playbooks/fullnode/08-node-status.yml --extra-vars "hosts=fullnodes"
  1. Prepare for a chain upgrade using Cosmovisor

Need to specify upgrade_name (can be taken from the proposal) and upgrade_version (can be taken from the instructions or Github). This will fetch the required binary, build it, create a folder layout for the upgrade, put the binary there and print its version.

ansible-playbook playbooks/fullnode/09-prepare-cosmovisor-upgrade.yml --extra-vars "hosts=validator-1 upgrade_name=v2 upgrade_version=v2.0.0"

ansible's People

Contributors

freak12techno avatar femkecl avatar creamers158 avatar

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.