The playbook configures a server to be a Commercio Network full node and installs a script that detects whether the node is losing blocks. If the node loses blocks, a message will be forwarded to a slack channel of your choice.
WARNING: The playbook can use only for mainnet. Don't use it for testnet or devnet or localnet.
The prerequisites to use this playbook are:
- Have a server on which to install the node
- Have python3 installed (version >= 3.5)
- To check the version:
python3 -V
- To check the version:
- Have ansible installed (version >= core 2.9)
- To check the version:
ansible --version
- To check the version:
- Have
gantsign.golanginstalled for ansible- To install it:
ansible-galaxy install gantsign.golang
- To install it:
To use the playbook you need to proceed as follows:
-
Create and add the
hosts.inifile to the root directory of this repo. Example hosts file. Parameters:ansible_host: IP of the machinemoniker: name of the nodeexternal_drive: optional parameter to specify if the node database is to be installed on an external disk. Use this parameter to specify the path to that diskcomm_user: name of the user that will be created and used by the node servicesync_type: This parameter decides how database synchronization occurs. You can have 5 values:pull: synchronization occurs by doing anrsyncfrom the new node to the node from which it synchronizes.push: synchronization occurs by doing anrsyncfrom the node from which you synchronize to the new node.dump: synchronization occurs by dumping the dump to disk and unpacking it.statesync: synchronization occurs via statesync.none: synchronization occurs normally.
You can change the behavior of the playbook based on the variables indicated in the
allfile located in themain/group_varspath. Below is the table of their meaning:Variable name Usage bin_versionVersion of the Commercionetworkd binary to use chain_idBlockchain chain-id genesisGenesis file URL comm_repoPath and name of where the Commercio.network binary repository is downloaded home_folderHome where the .commercionetworkfolder is installedgo_pathPath of installed go cosmovisor_versionVersion of Cosmovisor to install sync_nodeNode IP to sync from in case of sync_type=pushorpullsync_node_home_folderNode home folder to sync from in case of sync_type=pushorpulltrust_rpc1First RPC to sync from in case of sync_type=statesynctrust_rpc2Second RPC to sync from in case of sync_type=statesyncslack_hookWebhook where to send reports about a node losing blocks. No script will be installed if a webhook isn't set -
Proceed to run the
mainplaybook:
ansible-playbook -i hosts.ini main/commercio.ymlRun the playbook from the root folder of this repo.
If you don't choose to install the script via the playbook you can install it manually, here's how:
- Copy the script from
main/post_install/tasks/test_height.shon the server - Replace the
{{ slack_hook }}variable in the file with your own slack webhook - Add the script to a crontab using the
crontab -ecommand. We suggest running the script every 5 minutes
There may be errors when launching the playbook. These are the most common:
-
During the
install_binary : Run 'make' on targetstep there may be a possible failure in compiling the binary due to theTestProcessTestSuitetest not passing. The playbook will ignore the error and continue execution. The binary still compiles and will work fine. -
During the
setup_configuration : Download genesis filestep, a possible failure in the genesis download may occur. This error is caused by Github not responding to the request correctly. In this case the playbook will stop. This error rarely occurs and it will be enough to restart the playbook to complete the configuration.