Skip to content

Commit 0dbfc52

Browse files
committed
code refactor, add kava support, set user as variable instead of hard-coding to ubuntu
1 parent f7b31d5 commit 0dbfc52

File tree

27 files changed

+295
-312
lines changed

27 files changed

+295
-312
lines changed

README.md

Lines changed: 27 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,15 @@ This repo is to set up the Cosmos-based node. It currently support:
44

55
- Juno (mainnet and testnet)
66
- Sifchain (betanet and testnet)
7+
- Kava (mainnet)
78
- Evmos (testnet)
89

910
## Summary
1011

1112
You run one playbook and set up a node. For example:
1213

1314
```bash
14-
ansible-playbook -i inventory juno_full_setup.yml -e "target=juno_testnet"
15+
ansible-playbook -i inventory juno.yml -e "target=juno_testnet"
1516
```
1617

1718
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.
@@ -24,12 +25,15 @@ First, make sure that you have a production inventory file with your confidentia
2425
cp inventory.sample inventory
2526
```
2627

27-
Needless to say, you need to update the dummy values in the inventory file. For each node, you need to update the server IP. While you are free to keep the default, you might also want to update:
28+
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:
2829

29-
1. ansible_user: The sample file assumes `ubuntu`.
30+
1. ansible_user: The sample file assumes `ubuntu`, but feel free to use other user name. This user need sudo privilege.
3031
2. 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.
3132
3. ansible_ssh_private_key_file: The sample file assumes `~/.ssh/id_rsa`, but you might have a different key location.
32-
4. 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).
33+
4. 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.
34+
5. node_exporter: Default is `true`. Change it to `false` if you do not want to install node_exporter
35+
6. promtail: Default is `true`. Change it to `false` if you do not want to install promtail
36+
7. 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
3337

3438
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.
3539

@@ -43,14 +47,30 @@ The basic cluster structure is:
4347

4448
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.
4549

46-
## Main Playbook
50+
## Playbooks
4751

48-
The key Ansible playbook is `xxxxx_full_setup.yml` files. It will set up a fresh node from scratch. For example:
52+
The key Ansible playbook is `<chain>.yml` files. It will set up a fresh node from scratch. For example:
4953

5054
```bash
51-
ansible-playbook -i inventory sifchain_full_setup.yml -e "target=sifchain_betanet"
55+
ansible-playbook -i inventory sifchain.yml -e "target=sifchain_betanet"
5256
```
5357

58+
Playbooks are:
59+
60+
| Playbook | Description |
61+
| -------------- | ------------------------------------------------------------------------------------ |
62+
| `prepare.yml ` | Prepare the server with node_exporter, promtail, go, cosmovisor, and firewall rules |
63+
| `juno.yml` | Set up Juno node. It include the general `prepare` task and `juno` specific task |
64+
| `sifchain.yml` | Set up Juno node. It include the general `prepare` task and `sifchain` specific task |
65+
| `kava.yml` | Set up Juno node. It include the general `prepare` task and `kava` specific task |
66+
67+
## Additional Info
68+
69+
When you install a node that has upgrades in the past, you can either sync from Block 1, or use a snapshot to time travel. We strongly recommend snapshots, which will save you time of syncing and debugging. Here are a list of trusted snapshot providers. Do your own research and make sure that you can trust the snapshot providers
70+
71+
- Various chains: https://www.chainlayer.io/quicksync/
72+
- Sifchain: see https://github.com/Sifchain/sifchain-validators/blob/master/docs/setup/standalone/manual.md
73+
5474
## Some Useful Commands
5575

5676
block height

group_vars/all.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
1+
# node_exporter
12
node_exporter_version: '1.2.2'
23
node_exporter_checksum: '344bd4c0bbd66ff78f14486ec48b89c248139cdd485e992583ea30e89e0e5390'
4+
5+
# promtail
36
promtail_version: '2.4.1'
47
promtail_checksum: 978391a174e71cfef444ab9dc012f95d5d7eae0d682eaf1da2ea18f793452031
8+
9+
# go
510
go_version: '1.17.1'

group_vars/evmos_testnet.yml

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
validator_name: polkachu-evmos-testnet
2-
log_name: evmos_testnet
31
network: evmos
42
folder: '.evmosd'
53
daemon: evmosd
@@ -9,16 +7,4 @@ genesis: 'https://raw.githubusercontent.com/CosmosContracts/testnets/main/uni/ge
97
repo: https://github.com/CosmosContracts/juno
108
minimum_has_price: '0.025ujunox'
119
12-
seed: 'c36cec90ded95d162b85f8ecd00ecd7c8849ca75@arsiamons.seed.evmos.org:26656,3787335176bbb91bf14a67724ebe0f0940ca5afb@evmos-seed.artifact-staking.io:26656,faa31510d9280e74e7f2e767a62023bd5c896c27@evmos-testnet.mercury-nodes.net:29447'
13-
# evmosd tx staking create-validator \
14-
# --amount=1000000000000aphoton \
15-
# --pubkey=$(evmosd tendermint show-validator) \
16-
# --moniker="polkachu-evomos-testnet" \
17-
# --chain-id= evmos_9000-2 \
18-
# --commission-rate="0.10" \
19-
# --commission-max-rate="0.20" \
20-
# --commission-max-change-rate="0.01" \
21-
# --min-self-delegation="1000000" \
22-
# --gas="auto" \
23-
# --gas-prices="0.025aphoton" \
24-
# --from=polkachu
10+
seeds: 'c36cec90ded95d162b85f8ecd00ecd7c8849ca75@arsiamons.seed.evmos.org:26656,3787335176bbb91bf14a67724ebe0f0940ca5afb@evmos-seed.artifact-staking.io:26656,faa31510d9280e74e7f2e767a62023bd5c896c27@evmos-testnet.mercury-nodes.net:29447'

group_vars/juno_mainnet.yml

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,9 @@
1-
validator_name: polkachu-juno-mainnet
2-
log_name: juno_mainnet
31
network: juno
42
folder: '.juno'
53
daemon: junod
64
chain_id: juno-1
75
node_version: v1.0.0
8-
genesis: 'https://raw.githubusercontent.com/CosmosContracts/mainnet/main/juno-1/genesis.json'
96
repo: https://github.com/CosmosContracts/juno
10-
minimum_has_price: '0.025ujuno'
7+
genesis: 'https://raw.githubusercontent.com/CosmosContracts/mainnet/main/juno-1/genesis.json'
118
9+
minimum_has_price: '0.025ujuno'

group_vars/juno_testnet.yml

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,9 @@
1-
validator_name: polkachu-juno-testnet
2-
log_name: juno_testnet
31
network: juno
42
folder: '.juno'
53
daemon: junod
64
chain_id: uni
75
node_version: v1.0.0
8-
genesis: 'https://raw.githubusercontent.com/CosmosContracts/testnets/main/uni/genesis.json'
96
repo: https://github.com/CosmosContracts/juno
10-
minimum_has_price: '0.025ujunox'
7+
genesis: 'https://raw.githubusercontent.com/CosmosContracts/testnets/main/uni/genesis.json'
118
9+
minimum_gas_price: '0.025ujunox'

group_vars/kava_mainnet.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
network: kava
2+
folder: '.kvd'
3+
daemon: kvd
4+
chain_id: kava-8
5+
node_version: v0.15.1
6+
repo: https://github.com/kava-labs/kava
7+
genesis: 'https://kava-genesis-files.s3.amazonaws.com/kava-8-genesis-migrated-from-block-1878508.json'
8+
9+
minimum_gas_price: '0.001ukava'
10+
seeds: '[email protected]:26656'

group_vars/sifchain_betanet.yml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
1-
validator_name: polkachu-sifchain-betanet
2-
log_name: sifchain_betanet
31
network: sifnoded
2+
folder: '.sifnoded'
43
daemon: sifnoded
54
chain_id: sifchain-1
65
node_version: master
7-
genesis: 'https://raw.githubusercontent.com/Sifchain/networks/master/betanet/sifchain-1/genesis.json.gz'
86
repo: https://github.com/Sifchain/sifnode.git
7+
genesis: 'https://raw.githubusercontent.com/Sifchain/networks/master/betanet/sifchain-1/genesis.json.gz'
98

group_vars/sifchain_testnet.yml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
1-
validator_name: polkachu-sifchain-testnet
2-
log_name: sifchain_testnet
3-
4-
chain_type: testnet
1+
network: sifnoded
2+
folder: '.sifnoded'
3+
daemon: sifnoded
54
chain_id: sifchain-testnet-1
65
node_version: testnet-0.9.0
6+
repo: https://github.com/Sifchain/sifnode.git
7+
genesis: 'https://raw.githubusercontent.com/Sifchain/networks/master/testnet/sifchain-testnet-1/genesis.json.gz'
78

inventory.sample

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,20 @@
11
[sifchain_betanet]
2-
10.0.0.1
2+
10.0.0.1 validator_name=polkachu-sifchain-betanet log_name=sifchain_betanet
33

44
[sifchain_testnet]
5-
10.0.0.2
5+
10.0.0.2 validator_name=polkachu-sifchain-testnet log_name=sifchain_testnet
66

77
[juno_testnet]
8-
10.0.0.2
8+
10.0.0.2 validator_name=polkachu-juno-testnet log_name=juno_testnet
99

1010
[juno_mainnet]
11-
10.0.0.3
11+
10.0.0.3 validator_name=polkachu-juno-mainnet log_name=juno_mainnet
1212

1313
[evmos_testnet]
14-
10.0.0.4
14+
10.0.0.4 validator_name=polkachu-evmos-testnet log_name=evmos_testnet
15+
16+
[kava_mainnet]
17+
10.0.0.5 validator_name=polkachu-kava-mainnet log_name=kava_mainnet
1518

1619
[sifchain:children]
1720
sifchain_betanet
@@ -24,9 +27,14 @@ juno_testnet
2427
[evmos:children]
2528
evmos_testnet
2629

30+
[kava:children]
31+
kava_mainnet
32+
2733
[all:vars]
2834
ansible_user=ubuntu
2935
ansible_port=22
3036
ansible_ssh_private_key_file="~/.ssh/id_rsa"
31-
log_monitor=10.0.0.100
32-
path="/sbin:/usr/sbin:/bin:/usr/bin:/usr/local/bin:/usr/local/go/bin:/home/ubuntu/go/bin"
37+
path="/sbin:/usr/sbin:/bin:/usr/bin:/usr/local/bin:/usr/local/go/bin:/home/ubuntu/go/bin"
38+
node_exporter=true
39+
promtail=true
40+
log_monitor=10.0.0.100

juno_full_setup.yml renamed to juno.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,10 @@
66
roles:
77
- prepare
88

9-
- name: Install Juno
9+
- name: Install node
1010
hosts: '{{ target }}'
1111
gather_facts: false
1212
roles:
13-
- juno
13+
- standard_node_installation
14+
- initialize_juno
15+
- launch_node

0 commit comments

Comments
 (0)