Skip to content

Commit e6409d8

Browse files
committed
Prepare for v1.0 release
1 parent 34fada6 commit e6409d8

File tree

199 files changed

+1019
-3878
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

199 files changed

+1019
-3878
lines changed

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1-
inventory
1+
inventory
2+
inventory_testnet

README.md

Lines changed: 63 additions & 155 deletions
Original file line numberDiff line numberDiff line change
@@ -1,186 +1,94 @@
1-
# Cosmos-based Node Ansible Setup
1+
# Cosmos-based Node Ansible Setup Plus Several Supporting Playbooks
22

3-
This repo is to set up the Cosmos-based node. It currently support:
4-
5-
- Akash
6-
- BitCanna
7-
- Chihuahua
8-
- Comdex
9-
- Cerberus
10-
- Evmos
11-
- Juno
12-
- Kava
13-
- KiChain
14-
- Osmosis
15-
- Sifchain
16-
- Terra
17-
- Umee
18-
19-
## Summary
20-
21-
You run one playbook and set up a node. For example:
22-
23-
```bash
24-
ansible-playbook -i inventory juno.yml -e "target=juno_mainnet_main"
25-
```
26-
27-
But before you rush with this easy setup, you probably want to read on so you understand the structure of this Ansible program and all the features it offers.
28-
29-
## Some Preparations
30-
31-
First, make sure that you have a production inventory file with your confidential server info. You will start by copying the sample inventory file (included in the repo). The sample file gives you a good idea on how to define the inventory.
32-
33-
```bash
34-
cp inventory.sample inventory
35-
```
36-
37-
Needless to say, you need to update the dummy values in the inventory file. For each node, you need to update the server IP, validator_name and log_name (log_name is optional if you do not install Promtail). While you are free to keep the default, you might also want to update:
38-
39-
1. ansible_user: The sample file assumes `ubuntu`, but feel free to use other user name. This user need sudo privilege.
40-
1. ansible_port: The sample file assumes `22`. But if you are like me, you will have a different ssh port other than `22` to avoid port sniffing.
41-
1. ansible_ssh_private_key_file: The sample file assumes `~/.ssh/id_rsa`, but you might have a different key location.
42-
1. user_dir: The user's home directory. In the sample inventory file this is a computed variable based on the ansible_user. It assumes that it is not a root user and its home directory is `/home/{{ansible_user}}`
43-
1. path: This is to make sure that the ansible_user can access the `go` executable. If your ansible_user is not `ubuntu`, you need to update it.
44-
1. node_exporter: Default is `true`. Change it to `false` if you do not want to install node_exporter
45-
1. promtail: Default is `true`. Change it to `false` if you do not want to install promtail
46-
1. log_monitor: Enter your monitor server IP. It is most likely a private IP address if you use a firewall around your private virtual cloud (VPC). You do not need this if you do not install promtail
47-
48-
It is beyond the scope of this guide to help you create a sudo user, alternate ssh port, create a private key, install Ansible on your machine, etc. You can do a quick online search and find the answers. In my experience, Digital Ocean have some quality guides on these topics. Stack Overflow can help you trouble-shoot if you are stuck.
49-
50-
## Basic Cluster Structure
51-
52-
The basic cluster structure is:
53-
54-
1. Name each juno node as `juno_mainnet_main`, `juno_mainnet_backup`, etc. Group all Juno nodes into `juno_mainnet` group.
55-
2. Name each juno node as `comdex_mainnet_main`, `Comdex_mainnet_test`, etc. Group all comdex nodes into `comdex_mainnet` group.
56-
3. ...
57-
58-
The structure allows you to target `vars` to each node, or a group cluster, or the whole cluster. Make sure that you are familiar with the files in the `group_vars` folder. They follow this clustered structure closely.
59-
60-
## Playbooks
3+
## Design Philosophy
614

62-
The key Ansible playbook is `<chain>.yml` files. It will set up a fresh node from scratch. For example:
5+
1. Extendable to most Tendermint-based chains
6+
1. Support both mainnet and testnet
7+
1. Stable playbooks and roles; Customisable variables
8+
1. Support essential functions (snapshot, state-sync, public RPC/API endpoints and Cosmos Exporter) through seperate playbooks
639

64-
```bash
65-
ansible-playbook -i inventory akash.yml -e "target=akash_mainnet_main"
66-
ansible-playbook -i inventory bitcanna.yml -e "target=bitcanna_mainnet_main"
67-
ansible-playbook -i inventory chihuahua.yml -e "target=chihuahua_mainnet_main"
68-
ansible-playbook -i inventory comdex.yml -e "target=comdex_mainnet_main"
69-
ansible-playbook -i inventory cerberus.yml -e "target=cerberus_mainnet_main"
70-
ansible-playbook -i inventory evmos.yml -e "target=evmos_mainnet_main"
71-
ansible-playbook -i inventory juno.yml -e "target=juno_mainnet_main"
72-
ansible-playbook -i inventory kava.yml -e "target=kava_mainnet_main"
73-
ansible-playbook -i inventory kichain.yml -e "target=kichain_mainnet_main"
74-
ansible-playbook -i inventory osmosis.yml -e "target=osmosis_mainnet_main"
75-
ansible-playbook -i inventory sifchain.yml -e "target=sifchain_betanet_main"
76-
ansible-playbook -i inventory terra.yml -e "target=terra_mainnet_main"
77-
ansible-playbook -i inventory umee.yml -e "target=umee_mainnet_main"
78-
```
79-
80-
If you prefer to install the node manually, you can run a 'prepare' playbook to set up a server for a cosmos-based chain without installing the node itself.
81-
82-
Playbooks are:
83-
84-
| Playbook | Description |
85-
| -------------------- | ------------------------------------------------------------------------------------------- |
86-
| `prepare.yml ` | Prepare the server with node_exporter, promtail, go, cosmovisor, and firewall rules |
87-
| `auto_compound.yml ` | Copy an auto-compound shell script (more details below) |
88-
| `bitcanna.yml` | Set up Bitcanna node. It includes the general `prepare` task and `bitcanna` specific task |
89-
| `chihuahua.yml` | Set up Chihuahua node. It includes the general `prepare` task and `chihuahua` specific task |
90-
| `comdex.yml` | Set up Comdex node. It includes the general `prepare` task and `comdex` specific task |
91-
| `Cerberus.yml` | Set up Cerberus node. It includes the general `prepare` task and `cerberus` specific task |
92-
| `evmos.yml` | Set up Comdex node. It includes the general `prepare` task and `evmos` specific task |
93-
| `juno.yml` | Set up Juno node. It includes the general `prepare` task and `juno` specific task |
94-
| `kava.yml` | Set up Kava node. It includes the general `prepare` task and `kava` specific task |
95-
| `kichain.yml` | Set up KiChain node. It includes the general `prepare` task and `kichain` specific task |
96-
| `osmosis.yml` | Set up Osmosis node. It includes the general `prepare` task and `osmosis` specific task |
97-
| `sifchain.yml` | Set up Sifchain node. It includes the general `prepare` task and `sifchain` specific task |
98-
| `terra.yml` | Set up Terra node. It includes the general `prepare` task and `terra` specific task |
99-
| `umee.yml` | Set up Umee node. It includes the general `prepare` task and `umee` specific task |
100-
101-
## Auto Compound
102-
103-
The playbook will copy an auto-compound script to the user home directory.
104-
105-
| Playbook | Description |
106-
| ----------------------------------- | ------------------------------------------------------------ |
107-
| `auto_compound.yml` | Use this playbook when auto-compounding with own validator |
108-
| `auto_compound_for_delegation.yml ` | Use this playbook when auto-compounding with other validator |
109-
110-
```bash
111-
ansible-playbook -i inventory auto_compound.yml -e "target=chihuahua_main"
112-
ansible-playbook -i inventory auto_compound_for_delegation.yml -e "target=chihuahua_main"
113-
```
10+
## TL/DR
11411

115-
You can run the script on the node with the following:
12+
You run one playbook and set up a node.
11613

11714
```bash
118-
./auto_compound.sh <KEY> <PASSWORD>
119-
./auto_compound_for_delegation.sh <KEY> <PASSWORD>
15+
ansible-playbook main.yml -e "target=juno_main"
12016
```
12117

122-
Alternatively, you can add a cronjob. For example, this following cronjob will run the auto-compound script daily at midnight. In this case, make sure that your server is super secure, as you will expose your key password in the crontab. Adopt this strategy at your own risk.
18+
## Node deployment (Validator, Backup and Relayer)
12319

124-
```bash
125-
0 0 * * * /bin/bash /home/<USER>/auto_compound.sh <KEY> <PASSWORD>
126-
0 0 * * * /bin/bash /home/<USER>/auto_compound_for_delegation.sh <KEY> <PASSWORD>
127-
```
20+
For every network where we run a validator on mainnet, we run 3 nodes (Validator, Backup and Relayer). The details of our 3-node infrastructure are documented [here](https://polkachu.com/blogs/holy-trinity-a-system-approach-to-tendermint-based-chain-validation).
12821

129-
## Node Snapshot
22+
Take a look at the `inventory.sample` file. You will see an example `juno` group with 3 different hosts: `juno_main`, `juno_backup`, and `juno_relayer`. Each host will have the following variables:
13023

131-
We also offer node snapshot service for the validator community. We run snapshot script on any networks where we run a backup node. You need to have awscli installed and configured.
24+
1. `ansible_host`: Required. The IP address of the server.
25+
1. `type`: Required. It can be `main`, `backup` and `realyer` (also `test` if you are adventurous). Each is opinionated in its configuration settings.
26+
1. `prepare`: Optional. If unset, it is default to true. If `false`, it will skip setups of firewall, go, cosmovisor, node exporter, promtail, etc. The reason for the `false` option is because we run many backup/relayer nodes on the same server with setup done already.
13227

133-
| Playbook | Description |
134-
| -------------- | -------------------------------------------- |
135-
| `snapshot.yml` | Copy the snapshot shell script to the server |
28+
Besides the above host variables, you will also specify the following `all` variables in the inventory file:
13629

137-
```bash
138-
ansible-playbook -i inventory snapshot.yml -e "target=chihuahua_main_backup"
139-
```
30+
1. `ansible_user`: The sample file assumes `ubuntu`, but feel free to use other user name. This user need sudo privilege.
31+
1. `ansible_port`: The sample file assumes `22`. But if you are like me, you will have a different ssh port other than `22` to avoid port sniffing.
32+
1. `ansible_ssh_private_key_file`: The sample file assumes `~/.ssh/id_rsa`, but you might have a different key location.
33+
1. `var_file`: It tells the program where to look for the variable file. This is useless for the mainnet, because the var file will automatically be inferred by the network name. However, it is essentially for testnets.
34+
1. `user_dir`: The user's home directory. In the sample inventory file this is a computed variable based on the ansible_user. It assumes that it is not a root user and its home directory is `/home/{{ansible_user}}`.
35+
1. `path`: This is to make sure that the ansible_user can access the `go` executable.
36+
1. `node_exporter`: Default is `true`. Change it to `false` if you do not want to install node_exporter
37+
1. `promtail`: Default is `true`. Change it to `false` if you do not want to install promtail
38+
1. `log_monitor`: Enter your monitor server IP if you install promtail.
39+
1. `node_name`: This is your node name for the config.toml file.
40+
1. `log_name`: This is the server name for the promtail service.
14041

141-
You can run the script on the node with the following:
42+
One you understand the setup, please first copy it to your own inventory file so you can customize it to suit your needs:
14243

14344
```bash
144-
./snapshot.sh
45+
cp inventory.sample inventory
14546
```
14647

147-
Alternatively, you can add a cronjob. For example, this following cronjob will run the snapshot script at the midnight
48+
When you are ready install a node, you run:
14849

14950
```bash
150-
0 0 * * * /bin/bash /home/<USER>/snapshot.sh
51+
ansible-playbook main.yml -e "target=HOST_NAME"
15152
```
15253

153-
## Relayers
54+
## Playbooks
15455

155-
We offer some simple scripts to upload hermes config files to our Juno and Osmosis relayers hubs. It is designed for our internal consumptions only. We installed our relayer software (Hermes) manually. However, because we update our config files rather frequently, we have decided to automate this specific task. The Ansible script is probably not helpful to you, but you might like to adapt our Hermes config file itself. For this reason, we have decided to include the playbooks here.
56+
Playbooks are:
15657

157-
```bash
158-
ansible-playbook -i inventory relayer_juno.yml -e "target=relayer_juno"
159-
ansible-playbook -i inventory relayer_osmosis.yml -e "target=relayer_osmosis"
160-
```
58+
| Playbook | Description |
59+
| ------------------------------- | ----------------------------------------------------------------------------------- |
60+
| `main.yml` | The main playbook to set up a node |
61+
| `prepare.yml ` | Prepare the server with node_exporter, promtail, go, cosmovisor, and firewall rules |
62+
| `support_cosmos_exporter.yml ` | Set up Cosmos Exporter configuration (assuming Cosmos Exporter already installed) |
63+
| `support_public_endpoints.yml ` | Set up Nginx reverse proxy for public PRC/ API |
64+
| `support_snapshot.yml ` | Install snapshot script and a cron job |
65+
| `support_state_sync.yml ` | Install state-sync script |
66+
| `system_update.yml ` | Update a server and restart if needed |
67+
| `relayer_juno.yml ` | Set up Polkachu's Hermes config for Juno Hub |
68+
| `relayer_osmosis.yml ` | Set up Polkachu's Hermes config for Osmosis Hub |
16169

162-
## Horcrux
70+
# Pay attention
16371

164-
Our friend [coffeecoaster](https://github.com/coffeeroaster) has contributed this Horcrux playbook. Horcrux is a multi-party-computation (MPC) signing service for Tendermint nodes. Its github repo is [here](https://github.com/strangelove-ventures/horcrux). It is assumed that you already have a node with all the necessary toolings (Go, Comsovisor, jq, .profile setup, etc). If you install a tendermint node with one of our Ansible playbook, you have these toolings already.
72+
Some anomaly in the injective app file. Clean up the end in the app toml file
16573

166-
```bash
167-
ansible-playbook -i inventory horcrux.yml -e "target=juno_mainnet_main"
168-
```
74+
Some anomaly in the axelar config or app file. Forgot which one it is
16975

170-
In case you do not have all the necessary toolings, then we recommend you run `prepare` playbook first.
76+
Some anomaly in fetch becasue statesync is not supported
17177

172-
```bash
173-
ansible-playbook -i inventory prepare.yml -e "target=juno_mainnet_main"
174-
ansible-playbook -i inventory horcrux.yml -e "target=juno_mainnet_main"
175-
```
78+
Kill polkadex 4, 5
17679

177-
## Additional Info
80+
This repo is to set up the Cosmos-based node. It currently support:
17881

179-
1. Polkachu Operation Summary table: https://polkachu.com/summary_table
180-
1. Snapshot service: https://polkachu.com/tendermint_snapshots
181-
1. State-Sync service: https://polkachu.com/state_sync
182-
1. PRC: https://polkachu.com/public_rpc
183-
1. [General](docs/general.md)
184-
1. [Polkachu's Mainnet Setup](docs/mainnet.md)
185-
1. [Polkachu's Testnet Setup](docs/testnets.md)
186-
1. [Validator Server Migration Best Practice](docs/validator_server_migration_best_practice.md)
82+
- Akash
83+
- BitCanna
84+
- Chihuahua
85+
- Comdex
86+
- Cerberus
87+
- Evmos
88+
- Juno
89+
- Kava
90+
- KiChain
91+
- Osmosis
92+
- Sifchain
93+
- Terra
94+
- Umee

ansible.cfg

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
[defaults]
2+
inventory=inventory

asset_mantle.yml

Lines changed: 0 additions & 15 deletions
This file was deleted.

auto_compound.yml

Lines changed: 0 additions & 6 deletions
This file was deleted.

auto_compound_for_delegation.yml

Lines changed: 0 additions & 6 deletions
This file was deleted.

bitcanna.yml

Lines changed: 0 additions & 15 deletions
This file was deleted.

cerberus.yml

Lines changed: 0 additions & 15 deletions
This file was deleted.

certik.yml

Lines changed: 0 additions & 15 deletions
This file was deleted.

chihuahua.yml

Lines changed: 0 additions & 15 deletions
This file was deleted.

0 commit comments

Comments
 (0)