Update playbooks, script and readme to send create-validator tx from separate machine
This commit is contained in:
parent
9bb5aa0bef
commit
48497e1fab
@ -62,7 +62,7 @@
|
|||||||
|
|
||||||
NOTE: This public key is required in next step to generate the genesis file
|
NOTE: This public key is required in next step to generate the genesis file
|
||||||
|
|
||||||
## Generate mainnet genesis file
|
## Generate Mainnet Genesis File
|
||||||
|
|
||||||
- Get your private key from testnet deployment:
|
- Get your private key from testnet deployment:
|
||||||
|
|
||||||
@ -148,7 +148,7 @@
|
|||||||
|
|
||||||
- Once the node is running we will publish the genesis file, staking amount file and node address so that it is available to other validators
|
- Once the node is running we will publish the genesis file, staking amount file and node address so that it is available to other validators
|
||||||
|
|
||||||
## Run node
|
## Run Node
|
||||||
|
|
||||||
- Run these steps in a machine where the mainnet node is setup
|
- Run these steps in a machine where the mainnet node is setup
|
||||||
|
|
||||||
@ -214,7 +214,7 @@
|
|||||||
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"
|
||||||
```
|
```
|
||||||
|
|
||||||
## Publish required artifacts
|
## Publish Required Artifacts
|
||||||
|
|
||||||
- Copy the genesis file to [config](./config) folder:
|
- Copy the genesis file to [config](./config) folder:
|
||||||
|
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
- [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)
|
||||||
|
|
||||||
## Run node
|
## Run Node
|
||||||
|
|
||||||
- Get your private key from testnet deployment:
|
- Get your private key from testnet deployment:
|
||||||
|
|
||||||
@ -72,10 +72,45 @@
|
|||||||
laconic-so deployment --dir $DATA_DIRECTORY/$MAINNET_DEPLOYMENT_DIR logs laconicd -f
|
laconic-so deployment --dir $DATA_DIRECTORY/$MAINNET_DEPLOYMENT_DIR logs laconicd -f
|
||||||
```
|
```
|
||||||
|
|
||||||
|
- Get the public key of your node:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
laconic-so deployment --dir $DATA_DIRECTORY/$MAINNET_DEPLOYMENT_DIR exec laconicd "laconicd tendermint show-validator"
|
||||||
|
```
|
||||||
|
|
||||||
|
NOTE: This public key is required in next step to create validator
|
||||||
|
|
||||||
## Create Validator
|
## Create Validator
|
||||||
|
|
||||||
- Run these steps in a machine different from the one where the node is running
|
- Run these steps in a machine different from the one where the node is running
|
||||||
|
|
||||||
|
- Fetch the stack:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
laconic-so fetch-stack git.vdb.to/cerc-io/laconicd-stack --git-ssh --pull
|
||||||
|
```
|
||||||
|
|
||||||
|
This command clones the entire repository into the `~/cerc` folder, which includes the genesis file published by the first validator.
|
||||||
|
|
||||||
|
- Copy the example variables file:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
cp ~/cerc/laconicd-stack/playbooks/validator/validator-vars.example.yml ~/cerc/laconicd-stack/playbooks/validator/validator-vars.yml
|
||||||
|
```
|
||||||
|
|
||||||
|
- Update `~/cerc/laconicd-stack/playbooks/validator/validator-vars.yml` with required values:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Same moniker as set above
|
||||||
|
cerc_moniker: "<your-moniker>"
|
||||||
|
|
||||||
|
# Set path to staking amount file
|
||||||
|
staking_amount_file: "<path-to-staking-amount-file>"
|
||||||
|
|
||||||
|
# Use the public key exported in previous step (make sure to wrap it with single quotes [''])
|
||||||
|
validator_pub_key: '<public-key-of-your-node>'
|
||||||
|
```
|
||||||
|
|
||||||
- Export required env vars:
|
- Export required env vars:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
|
@ -2,4 +2,4 @@
|
|||||||
cerc_moniker: ""
|
cerc_moniker: ""
|
||||||
cerc_chain_id: "laconic-mainnet"
|
cerc_chain_id: "laconic-mainnet"
|
||||||
key_name: "laconic-validator"
|
key_name: "laconic-validator"
|
||||||
validator_pub_key: ""
|
validator_pub_key: ''
|
||||||
|
@ -1,9 +1,11 @@
|
|||||||
---
|
---
|
||||||
- name: Create validator on running chain
|
- name: Create validator on running chain
|
||||||
hosts: localhost
|
hosts: localhost
|
||||||
|
vars_files:
|
||||||
|
- validator-vars.yml
|
||||||
vars:
|
vars:
|
||||||
data_directory: "{{ lookup('env', 'DATA_DIRECTORY') }}"
|
data_directory: "{{ lookup('env', 'DATA_DIRECTORY') }}"
|
||||||
deployment_dir: "{{ lookup('env', 'MAINNET_DEPLOYMENT_DIR') }}"
|
mainnet_deployment_dir: "{{ lookup('env', 'MAINNET_DEPLOYMENT_DIR') }}"
|
||||||
spec_file: "{{data_directory}}/laconicd-validator-spec.yml"
|
spec_file: "{{data_directory}}/laconicd-validator-spec.yml"
|
||||||
key_name: "{{ lookup('env', 'KEY_NAME') }}"
|
key_name: "{{ lookup('env', 'KEY_NAME') }}"
|
||||||
node_url: "{{ lookup('env', 'NODE_URL') }}"
|
node_url: "{{ lookup('env', 'NODE_URL') }}"
|
||||||
@ -19,8 +21,8 @@
|
|||||||
fail:
|
fail:
|
||||||
msg: >-
|
msg: >-
|
||||||
Required key files are not defined.
|
Required key files are not defined.
|
||||||
Please set genesis_file and staking_amount_file in validator-vars.yml.
|
Please set staking_amount_file in validator-vars.yml.
|
||||||
when: not genesis_file or not staking_amount_file
|
when: not staking_amount_file
|
||||||
|
|
||||||
- name: Fetch laconicd stack
|
- name: Fetch laconicd stack
|
||||||
shell: laconic-so fetch-stack git.vdb.to/cerc-io/laconicd-stack --git-ssh --pull
|
shell: laconic-so fetch-stack git.vdb.to/cerc-io/laconicd-stack --git-ssh --pull
|
||||||
@ -48,7 +50,6 @@
|
|||||||
content: |
|
content: |
|
||||||
CERC_MONIKER: "{{ cerc_moniker }}"
|
CERC_MONIKER: "{{ cerc_moniker }}"
|
||||||
CERC_CHAIN_ID: "{{ cerc_chain_id }}"
|
CERC_CHAIN_ID: "{{ cerc_chain_id }}"
|
||||||
CERC_PEERS: "{{ cerc_peers }}"
|
|
||||||
MIN_GAS_PRICE: "{{ min_gas_price }}"
|
MIN_GAS_PRICE: "{{ min_gas_price }}"
|
||||||
CERC_LOGLEVEL: "{{ cerc_loglevel }}"
|
CERC_LOGLEVEL: "{{ cerc_loglevel }}"
|
||||||
mode: '0777'
|
mode: '0777'
|
||||||
@ -80,8 +81,33 @@
|
|||||||
|
|
||||||
- name: Import private key in laconicd
|
- name: Import private key in laconicd
|
||||||
shell: |
|
shell: |
|
||||||
laconic-so deployment --dir {{ data_directory }}/{{ deployment_dir }} exec laconicd "laconicd keys import-hex {{ key_name }} {{ private_key_input.user_input }} --keyring-backend test"
|
docker run -i \
|
||||||
|
-v {{ data_directory }}/{{ mainnet_deployment_dir }}/data/laconicd-data:/root/.laconicd \
|
||||||
|
--network=host \
|
||||||
|
cerc/laconicd:local \
|
||||||
|
laconicd keys import-hex {{ key_name }} {{ private_key_input.user_input }} --keyring-backend test \
|
||||||
|
|
||||||
|
- name: Get the key information
|
||||||
|
shell: |
|
||||||
|
docker run -i \
|
||||||
|
-v {{ data_directory }}/{{ mainnet_deployment_dir }}/data/laconicd-data:/root/.laconicd \
|
||||||
|
--network=host \
|
||||||
|
cerc/laconicd:local \
|
||||||
|
laconicd keys show {{ key_name }} --keyring-backend test
|
||||||
|
register: key_info
|
||||||
|
|
||||||
- name: Run create-validator script
|
- name: Run create-validator script
|
||||||
shell: |
|
shell: |
|
||||||
laconic-so deployment --dir {{ data_directory }}/{{ deployment_dir }} exec laconicd "KEY_NAME={{ key_name }} NODE_URL={{ node_url }} /scripts/create-validator.sh"
|
docker run -i \
|
||||||
|
-v {{ data_directory }}/{{ mainnet_deployment_dir }}/data/laconicd-data:/root/.laconicd \
|
||||||
|
-v {{ data_directory }}/{{ mainnet_deployment_dir }}/data/laconicd-data/tmp/staking-amount.json:/scripts/staking-amount.json \
|
||||||
|
-v ~/cerc/laconicd-stack/stack-orchestrator/config/mainnet-laconicd/create-validator.sh:/scripts/create-validator.sh \
|
||||||
|
-e "KEY_NAME={{ key_name }}" \
|
||||||
|
-e "NODE_URL={{ node_url }}" \
|
||||||
|
-e "CERC_MONIKER={{ cerc_moniker }}" \
|
||||||
|
-e "CERC_CHAIN_ID={{ cerc_chain_id }}" \
|
||||||
|
-e "MIN_GAS_PRICE={{ min_gas_price }}" \
|
||||||
|
-e "VALIDATOR_PUB_KEY={{ validator_pub_key | to_json }}" \
|
||||||
|
--network=host \
|
||||||
|
cerc/laconicd:local \
|
||||||
|
sh -c "/scripts/create-validator.sh"
|
||||||
|
@ -38,17 +38,20 @@
|
|||||||
- name: Create deployment spec file
|
- name: Create deployment spec file
|
||||||
shell: |
|
shell: |
|
||||||
laconic-so --stack ~/cerc/laconicd-stack/stack-orchestrator/stacks/mainnet-laconicd deploy init --output {{ spec_file }}
|
laconic-so --stack ~/cerc/laconicd-stack/stack-orchestrator/stacks/mainnet-laconicd deploy init --output {{ spec_file }}
|
||||||
when: is_setup
|
|
||||||
|
|
||||||
- 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 eval '(.network) = load("{{ spec_template }}").network' -i {{ spec_file }}
|
||||||
when: is_setup
|
|
||||||
|
- name: Check if deployment directory already exists
|
||||||
|
stat:
|
||||||
|
path: "{{data_directory}}/{{ mainnet_deployment_dir }}"
|
||||||
|
register: deployment_dir
|
||||||
|
|
||||||
- name: Create deployment from spec file
|
- name: Create deployment from spec file
|
||||||
shell: |
|
shell: |
|
||||||
laconic-so --stack ~/cerc/laconicd-stack/stack-orchestrator/stacks/mainnet-laconicd deploy create --spec-file {{ spec_file }} --deployment-dir {{data_directory}}/{{ mainnet_deployment_dir }}
|
laconic-so --stack ~/cerc/laconicd-stack/stack-orchestrator/stacks/mainnet-laconicd deploy create --spec-file {{ spec_file }} --deployment-dir {{data_directory}}/{{ mainnet_deployment_dir }}
|
||||||
when: is_setup
|
when: not deployment_dir.stat.exists
|
||||||
|
|
||||||
- name: Create config.env
|
- name: Create config.env
|
||||||
copy:
|
copy:
|
||||||
|
@ -5,4 +5,5 @@ is_setup: false
|
|||||||
cerc_moniker: ""
|
cerc_moniker: ""
|
||||||
genesis_file: ""
|
genesis_file: ""
|
||||||
staking_amount_file: ""
|
staking_amount_file: ""
|
||||||
|
validator_pub_key: ''
|
||||||
cerc_peers: ""
|
cerc_peers: ""
|
||||||
|
@ -12,7 +12,7 @@ if [ ! -f "$staking_amount_file" ]; then
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [-z "$KEY_NAME" ]; then
|
if [ -z "$KEY_NAME" ]; then
|
||||||
echo "KEY_NAME environment variable not set, exiting..."
|
echo "KEY_NAME environment variable not set, exiting..."
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
@ -27,6 +27,11 @@ if [ -z "$NODE_URL" ]; then
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if [ -z "$VALIDATOR_PUB_KEY" ]; then
|
||||||
|
echo "VALIDATOR_PUB_KEY environment variable not set, exiting..."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
# Set staking amount
|
# Set staking amount
|
||||||
stake_amount=$(jq -r '.common_staking_amount' "$staking_amount_file")
|
stake_amount=$(jq -r '.common_staking_amount' "$staking_amount_file")
|
||||||
|
|
||||||
@ -34,7 +39,7 @@ stake_amount=$(jq -r '.common_staking_amount' "$staking_amount_file")
|
|||||||
validator_json="$NODE_HOME/tmp/validator.json"
|
validator_json="$NODE_HOME/tmp/validator.json"
|
||||||
cat > "$validator_json" << EOF
|
cat > "$validator_json" << EOF
|
||||||
{
|
{
|
||||||
"pubkey": $(laconicd tendermint show-validator),
|
"pubkey": $VALIDATOR_PUB_KEY,
|
||||||
"amount": "${stake_amount}${DENOM}",
|
"amount": "${stake_amount}${DENOM}",
|
||||||
"moniker": "${CERC_MONIKER}",
|
"moniker": "${CERC_MONIKER}",
|
||||||
"commission-rate": "0.0",
|
"commission-rate": "0.0",
|
||||||
|
Loading…
Reference in New Issue
Block a user