Add yq tool in playbook (#19)
Part of https://www.notion.so/Create-stacks-for-mainnet-1f2a6b22d4728034be4be2c51decf94e Reviewed-on: #19 Co-authored-by: Nabarun <nabarun@deepstacksoft.com> Co-committed-by: Nabarun <nabarun@deepstacksoft.com>
This commit is contained in:
parent
de553ebcd3
commit
4eeb9f751e
@ -21,6 +21,7 @@
|
|||||||
- Following tools are required in all machines:
|
- Following tools are required in all machines:
|
||||||
|
|
||||||
- [ansible](playbooks/README.md#ansible-installation)
|
- [ansible](playbooks/README.md#ansible-installation)
|
||||||
|
|
||||||
- [laconic-so](https://github.com/cerc-io/stack-orchestrator/?tab=readme-ov-file#install)
|
- [laconic-so](https://github.com/cerc-io/stack-orchestrator/?tab=readme-ov-file#install)
|
||||||
|
|
||||||
- laconicd-stack
|
- laconicd-stack
|
||||||
@ -81,7 +82,7 @@
|
|||||||
- Get the public key of your node:
|
- Get the public key of your node:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
docker run -it \
|
docker run -it \
|
||||||
-v $DATA_DIRECTORY/$MAINNET_DEPLOYMENT_DIR/data/laconicd-data:/root/.laconicd \
|
-v $DATA_DIRECTORY/$MAINNET_DEPLOYMENT_DIR/data/laconicd-data:/root/.laconicd \
|
||||||
cerc/laconicd:local bash -c "laconicd tendermint show-validator"
|
cerc/laconicd:local bash -c "laconicd tendermint show-validator"
|
||||||
```
|
```
|
||||||
@ -114,7 +115,7 @@
|
|||||||
- Get your private key from testnet deployment:
|
- Get your private key from testnet deployment:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
laconic-so deployment --dir <testnet-deployment-dir> exec laconicd "laconicd keys export <key-name> --unarmored-hex --unsafe"
|
laconic-so deployment --dir <testnet-deployment-dir> exec laconicd "laconicd keys export <key-name> --unarmored-hex --unsafe --keyring-backend test"
|
||||||
```
|
```
|
||||||
|
|
||||||
NOTE: Store this key securely as it is needed in later steps
|
NOTE: Store this key securely as it is needed in later steps
|
||||||
@ -169,7 +170,7 @@
|
|||||||
~/cerc/laconicd-stack/scripts/generate-lps-lock.sh -i "<lps-distribution-spreadsheet-url-or-csv-file-path>" -o $LPS_DISTRIBUTION_PATH
|
~/cerc/laconicd-stack/scripts/generate-lps-lock.sh -i "<lps-distribution-spreadsheet-url-or-csv-file-path>" -o $LPS_DISTRIBUTION_PATH
|
||||||
```
|
```
|
||||||
|
|
||||||
- This will generate the `distribution.json` file at `$LPS_DISTRIBUTION_PATH`
|
- This will generate the file at `$LPS_DISTRIBUTION_PATH`
|
||||||
|
|
||||||
- Copy the example variables file:
|
- Copy the example variables file:
|
||||||
|
|
||||||
@ -186,6 +187,12 @@
|
|||||||
validator_pub_key: '<public-key-of-your-node>'
|
validator_pub_key: '<public-key-of-your-node>'
|
||||||
```
|
```
|
||||||
|
|
||||||
|
- Change to the deployments directory
|
||||||
|
|
||||||
|
```bash
|
||||||
|
cd $DATA_DIRECTORY
|
||||||
|
```
|
||||||
|
|
||||||
- Run playbook to use exported state for generating mainnet genesis file with gentx:
|
- Run playbook to use exported state for generating mainnet genesis file with gentx:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
@ -265,10 +272,11 @@
|
|||||||
rm -rf $DATA_DIRECTORY/$MAINNET_DEPLOYMENT_DIR/data/laconicd-data/config/priv_validator_key.json
|
rm -rf $DATA_DIRECTORY/$MAINNET_DEPLOYMENT_DIR/data/laconicd-data/config/priv_validator_key.json
|
||||||
```
|
```
|
||||||
|
|
||||||
- Copy the genesis file to the mainnet deployment tmp directory:
|
- Copy the genesis file generated in [Generate mainnet genesis file section](#generate-mainnet-genesis-file) from machine 3 to the machine 2 mainnet deployment tmp directory:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
cp <absolute-path-to-genesis-json> $DATA_DIRECTORY/$MAINNET_DEPLOYMENT_DIR/data/laconicd-data/tmp/genesis.json
|
# Directory on machine 2 to place genesis.json file
|
||||||
|
echo $DATA_DIRECTORY/$MAINNET_DEPLOYMENT_DIR/data/laconicd-data/tmp/
|
||||||
```
|
```
|
||||||
|
|
||||||
- Command to run node:
|
- Command to run node:
|
||||||
@ -312,12 +320,20 @@
|
|||||||
laconic-so deployment --dir $DATA_DIRECTORY/$MAINNET_DEPLOYMENT_DIR exec laconicd 'laconicd query auth module-account lps_lockup'
|
laconic-so deployment --dir $DATA_DIRECTORY/$MAINNET_DEPLOYMENT_DIR exec laconicd 'laconicd query auth module-account lps_lockup'
|
||||||
```
|
```
|
||||||
|
|
||||||
- Query the `lps_lockup` and early supports accounts balances:
|
- Query the `lps_lockup` account balance:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
lockup_account_address=$(laconic-so deployment --dir $DATA_DIRECTORY/$MAINNET_DEPLOYMENT_DIR exec laconicd 'laconicd query auth module-account lps_lockup -o json | jq -r .account.value.base_account.address')
|
lockup_account_address=$(laconic-so deployment --dir $DATA_DIRECTORY/$MAINNET_DEPLOYMENT_DIR exec laconicd 'laconicd query auth module-account lps_lockup -o json | jq -r .account.value.base_account.address')
|
||||||
laconic-so deployment --dir $DATA_DIRECTORY/$MAINNET_DEPLOYMENT_DIR exec laconicd "laconicd query bank balances $lockup_account_address"
|
laconic-so deployment --dir $DATA_DIRECTORY/$MAINNET_DEPLOYMENT_DIR exec laconicd "laconicd query bank balances $lockup_account_address"
|
||||||
|
```
|
||||||
|
|
||||||
|
- Query the early supports account balance:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Set the early supports account address
|
||||||
|
export EARLY_SUPPORTS_ACC_ADDR=<account-address-controlled-by-laconic-foundation>
|
||||||
|
|
||||||
|
# Check balance
|
||||||
laconic-so deployment --dir $DATA_DIRECTORY/$MAINNET_DEPLOYMENT_DIR exec laconicd "laconicd query bank balances $EARLY_SUPPORTS_ACC_ADDR"
|
laconic-so deployment --dir $DATA_DIRECTORY/$MAINNET_DEPLOYMENT_DIR exec laconicd "laconicd query bank balances $EARLY_SUPPORTS_ACC_ADDR"
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -2,6 +2,12 @@
|
|||||||
|
|
||||||
## Prerequisites
|
## Prerequisites
|
||||||
|
|
||||||
|
- To fetch laconicd-stack:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
laconic-so fetch-stack git.vdb.to/cerc-io/laconicd-stack --git-ssh --pull
|
||||||
|
```
|
||||||
|
|
||||||
- Machine 1: Where the SAPO testnet node is already running
|
- Machine 1: Where the SAPO testnet node is already running
|
||||||
|
|
||||||
- Machine 2: Where the mainnet validator node is to be setup
|
- Machine 2: Where the mainnet validator node is to be setup
|
||||||
@ -28,12 +34,6 @@
|
|||||||
|
|
||||||
- [laconic-so](https://github.com/cerc-io/stack-orchestrator/?tab=readme-ov-file#install) is required in all machines
|
- [laconic-so](https://github.com/cerc-io/stack-orchestrator/?tab=readme-ov-file#install) is required in all machines
|
||||||
|
|
||||||
- To fetch laconicd-stack:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
laconic-so fetch-stack git.vdb.to/cerc-io/laconicd-stack --git-ssh --pull
|
|
||||||
```
|
|
||||||
|
|
||||||
## Stop SAPO testnet node
|
## Stop SAPO testnet node
|
||||||
|
|
||||||
- Run the following steps in machine where the testnet node is already running (machine 1)
|
- Run the following steps in machine where the testnet node is already running (machine 1)
|
||||||
|
@ -2,10 +2,6 @@
|
|||||||
- name: Setup and deploy the cosmos multisig app
|
- name: Setup and deploy the cosmos multisig app
|
||||||
hosts: multihosts
|
hosts: multihosts
|
||||||
|
|
||||||
# To use yq binary installed in user bin path
|
|
||||||
environment:
|
|
||||||
PATH: "{{ ansible_env.PATH }}:/home/{{ansible_user}}/bin"
|
|
||||||
|
|
||||||
vars_files:
|
vars_files:
|
||||||
- cosmos-multisig-vars.yml
|
- cosmos-multisig-vars.yml
|
||||||
vars:
|
vars:
|
||||||
@ -17,7 +13,11 @@
|
|||||||
network_json: "../../config/network.json"
|
network_json: "../../config/network.json"
|
||||||
remote_network_json: "{{data_directory}}/network.json"
|
remote_network_json: "{{data_directory}}/network.json"
|
||||||
build_args: "{{ '--force-rebuild' if (lookup('env', 'FORCE_REBUILD') | default(omit, true)) not in [ 'false', 'False', '0' ] else '' }}"
|
build_args: "{{ '--force-rebuild' if (lookup('env', 'FORCE_REBUILD') | default(omit, true)) not in [ 'false', 'False', '0' ] else '' }}"
|
||||||
|
|
||||||
tasks:
|
tasks:
|
||||||
|
- name: Include setup tasks
|
||||||
|
ansible.builtin.import_tasks: ../setup.yml
|
||||||
|
|
||||||
- name: Fail if DATA_DIRECTORY env var is not set
|
- name: Fail if DATA_DIRECTORY env var is not set
|
||||||
fail:
|
fail:
|
||||||
msg: "Environment variable DATA_DIRECTORY is not set. Please export it before running the playbook."
|
msg: "Environment variable DATA_DIRECTORY is not set. Please export it before running the playbook."
|
||||||
@ -43,7 +43,7 @@
|
|||||||
|
|
||||||
- name: Replace network section in spec_output
|
- name: Replace network section in spec_output
|
||||||
shell: >
|
shell: >
|
||||||
yq eval '(.network) = load("{{ remote_spec_template }}").network' -i {{ spec_output }}
|
{{ yq_path }} eval '(.network) = load("{{ remote_spec_template }}").network' -i {{ spec_output }}
|
||||||
|
|
||||||
- name: Check if deployment directory exists
|
- name: Check if deployment directory exists
|
||||||
stat:
|
stat:
|
||||||
|
@ -10,6 +10,9 @@
|
|||||||
spec_template: "./templates/specs/spec-template.yml.j2"
|
spec_template: "./templates/specs/spec-template.yml.j2"
|
||||||
build_args: "{{ '--force-rebuild' if (lookup('env', 'FORCE_REBUILD') | default(omit, true)) not in [ 'false', 'False', '0' ] else '' }}"
|
build_args: "{{ '--force-rebuild' if (lookup('env', 'FORCE_REBUILD') | default(omit, true)) not in [ 'false', 'False', '0' ] else '' }}"
|
||||||
tasks:
|
tasks:
|
||||||
|
- name: Include setup tasks
|
||||||
|
ansible.builtin.import_tasks: ../setup.yml
|
||||||
|
|
||||||
- name: Fail if DATA_DIRECTORY or MAINNET_DEPLOYMENT_DIR env vars are not set
|
- name: Fail if DATA_DIRECTORY or MAINNET_DEPLOYMENT_DIR env vars are not set
|
||||||
fail:
|
fail:
|
||||||
msg: >-
|
msg: >-
|
||||||
@ -32,7 +35,7 @@
|
|||||||
|
|
||||||
- name: Replace network section in spec_file
|
- name: Replace network section in spec_file
|
||||||
shell: >
|
shell: >
|
||||||
yq eval '(.network) = load("{{ spec_template }}").network' -i {{ spec_file }}
|
{{ yq_path }} eval '(.network) = load("{{ spec_template }}").network' -i {{ spec_file }}
|
||||||
|
|
||||||
- name: Create deployment from spec file
|
- name: Create deployment from spec file
|
||||||
shell: |
|
shell: |
|
||||||
|
24
playbooks/setup.yml
Normal file
24
playbooks/setup.yml
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
---
|
||||||
|
# Setup tasks for all playbooks
|
||||||
|
- name: Create tools directory in user's home
|
||||||
|
file:
|
||||||
|
path: "{{ ansible_env.HOME }}/.laconic-tools"
|
||||||
|
state: directory
|
||||||
|
mode: '0755'
|
||||||
|
|
||||||
|
- name: Check if yq exists
|
||||||
|
stat:
|
||||||
|
path: "{{ ansible_env.HOME }}/.laconic-tools/yq"
|
||||||
|
register: yq_file
|
||||||
|
|
||||||
|
- name: Download yq to user's tools directory
|
||||||
|
shell: |
|
||||||
|
curl -L https://github.com/mikefarah/yq/releases/latest/download/yq_linux_amd64 -o {{ ansible_env.HOME }}/.laconic-tools/yq
|
||||||
|
chmod +x {{ ansible_env.HOME }}/.laconic-tools/yq
|
||||||
|
when: not yq_file.stat.exists
|
||||||
|
args:
|
||||||
|
creates: "{{ ansible_env.HOME }}/.laconic-tools/yq"
|
||||||
|
|
||||||
|
- name: Set yq path variable
|
||||||
|
set_fact:
|
||||||
|
yq_path: "{{ ansible_env.HOME }}/.laconic-tools/yq"
|
@ -10,6 +10,9 @@
|
|||||||
spec_template: "./templates/specs/spec-template.yml.j2"
|
spec_template: "./templates/specs/spec-template.yml.j2"
|
||||||
build_args: "{{ '--force-rebuild' if (lookup('env', 'FORCE_REBUILD') | default(omit, true)) not in [ 'false', 'False', '0' ] else '' }}"
|
build_args: "{{ '--force-rebuild' if (lookup('env', 'FORCE_REBUILD') | default(omit, true)) not in [ 'false', 'False', '0' ] else '' }}"
|
||||||
tasks:
|
tasks:
|
||||||
|
- name: Include setup tasks
|
||||||
|
ansible.builtin.import_tasks: ../setup.yml
|
||||||
|
|
||||||
- name: Fail if DATA_DIRECTORY or MAINNET_DEPLOYMENT_DIR env vars are not set
|
- name: Fail if DATA_DIRECTORY or MAINNET_DEPLOYMENT_DIR env vars are not set
|
||||||
fail:
|
fail:
|
||||||
msg: >-
|
msg: >-
|
||||||
@ -39,7 +42,7 @@
|
|||||||
|
|
||||||
- name: Replace network section in spec_file
|
- name: Replace network section in spec_file
|
||||||
shell: >
|
shell: >
|
||||||
yq eval '(.network) = load("{{ spec_template }}").network' -i {{ spec_file }}
|
{{ yq_path }} eval '(.network) = load("{{ spec_template }}").network' -i {{ spec_file }}
|
||||||
|
|
||||||
- name: Create deployment from spec file
|
- name: Create deployment from spec file
|
||||||
shell: |
|
shell: |
|
||||||
|
Loading…
Reference in New Issue
Block a user