Ansible playbooks to setup Matic validator node.
Make sure you are using python3.x with Ansible. To check: ansible --version
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
Remove "GO" packet on sentry machine
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
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"
Make sure to start/stop/restart service via root
Stop heimdall services :
systemctl stop heimdalld
Edit /var/lib/heimdall/config/config
external_address="tcp://<YOUR_SENTRY_NODE>:26656"
Download newest heimdall snapshot : https://snapshot.polygon.technology/
tar -xzvf heimdall-snapshot-*.gz -C ~/.heimdalld/data/
cd /var/lib/heimdall/
chown -R heimdall:nogroup data/
systemctl enable --now heimdalld
systemctl restart heimdalld
To check the sync status you can run the follwing command on your node
$ curl http://localhost:26657/status
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
Edit /var/lib/bor/config.toml
jsonrpc > host = "0.0.0.0"
Download the newest bor snapshot : https://snapshot.polygon.technology/
tar -xzvf bor-fullnode-snapshot-*.gz -C ~/.bor/data/bor/chaindata
cd /var/lib/bor/
chown -R bor:nogroup data/
Command to Start Bor Service - Make sure to run as Root
service bor start
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/show-heimdall-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
To setup Heimdall
ansible-playbook playbooks/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.yml --extra-var="heimdall_version=v0.3.0 network=mainnet node_type=sentry" --list-hosts
To setup Bor
ansible-playbook playbooks/heimdall.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/heimdall.yml --extra-var="bor_version=v0.3.0 network=mainnet node_type=sentry" --list-hosts
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"
FIREWALL Configuration
Open ports 22, 80, 443, 8545, 26656 and 30303 to world (0.0.0.0/0) on sentry node firewall.
External Links
https://wiki.polygon.technology/docs/develop/network-details/full-node-deployment
https://wiki.polygon.technology/docs/develop/network-details/snapshot-instructions-heimdall-bor