Update readme for running validators on separate machine

This commit is contained in:
Shreerang Kale 2025-05-19 15:27:24 +05:30
parent 20b00afa56
commit 8166dee68c
8 changed files with 56 additions and 32 deletions

View File

@ -21,7 +21,7 @@
laconic-so deployment --dir <testnet-deployment-dir> stop
```
- Fetch the stack in machine where the testnet chain node is running:
- Fetch the stack in machine where the testnet chain node was running:
```bash
laconic-so fetch-stack git.vdb.to/cerc-io/laconicd-stack --git-ssh --pull
@ -56,15 +56,17 @@
- Copy the example variables file:
```bash
cp ~/cerc/laconicd-stack/playbooks/first-validator/first-validator-vars.example.yml ~/cerc/laconicd-stack/playbooks/first-validator/first-validator-vars.yml
cp ~/cerc/laconicd-stack/playbooks/generate-genesis/generate-genesis-vars.example.yml ~/cerc/laconicd-stack/playbooks/generate-genesis/generate-genesis-vars.yml
```
- Run playbook to use exported state for generating mainnet genesis:
```bash
ansible-playbook -i localhost, -c local ~/cerc/laconicd-stack/playbooks/first-validator/generate-genesis.yml -e "exported_state_path=$EXPORTED_STATE_PATH" -e "lps_distribution_path=$LPS_DISTRIBUTION_PATH" -e "early_supports_acc_address=$EARLY_SUPPORTS_ACC_ADDR"
ansible-playbook -i localhost, -c local ~/cerc/laconicd-stack/playbooks/generate-genesis/generate-genesis.yml -e "exported_state_path=$EXPORTED_STATE_PATH" -e "lps_distribution_path=$LPS_DISTRIBUTION_PATH" -e "early_supports_acc_address=$EARLY_SUPPORTS_ACC_ADDR"
```
- Input private key of the existing account that was exported in previous steps when prompted
- Genesis file will be generated in output directory along with a file specifying the staking amount
```bash
@ -72,31 +74,42 @@
ls -l output
```
- Copy over the generated genesis file and staking amount file to the machine where the node is to be run
- The genesis file will be used to start the node
- 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
- Copy the example variables file if not already done:
- Run these steps in a separate machine where the mainnet node is to be run
- Fetch the stack:
```bash
cp ~/cerc/laconicd-stack/playbooks/first-validator/first-validator-vars.example.yml ~/cerc/laconicd-stack/playbooks/first-validator/first-validator-vars.yml
laconic-so fetch-stack git.vdb.to/cerc-io/laconicd-stack --git-ssh --pull
```
- Update `~/cerc/laconicd-stack/playbooks/first-validator/first-validator-vars.yml` with required values:
This command clones the entire repository into the `~/cerc` folder
- Copy the example variables file:
```bash
# Path to the generated mainnet genesis file
# Use the absolute path of generated output directory in the previous steps
genesis_file: "<absolute-path-to-generated-output-dir>/genesis.json"
cp ~/cerc/laconicd-stack/playbooks/validator/validator-vars.example.yml ~/cerc/laconicd-stack/playbooks/validator/validator-vars.yml
```
# Path to staking-amount.json generated in previous steps
staking_amount_file: "<absolute-path-to-generated-output-dir>/staking-amount.json"
- Update `~/cerc/laconicd-stack/playbooks/validator/validator-vars.yml` with required values:
```bash
# Set custom moniker for the node
cerc_moniker: "LaconicMainnetNode"
cerc_moniker: "<your-moniker>"
# Set desired key name
key_name: "laconic-validator"
# Set path to genesis file
genesis_file: "<path-to-generated-genesis-file>"
```
- Keep rest of the values empty
- Export the data directory and mainnet deployment directory as environment variables:
```bash
@ -108,14 +121,12 @@
export MAINNET_DEPLOYMENT_DIR=
```
- Run ansible playbook to submit the gentx and run the node:
- Run ansible playbook to set up and start your validator node:
```bash
ansible-playbook -i localhost, -c local ~/cerc/laconicd-stack/playbooks/first-validator/run-first-validator.yml
ansible-playbook -i localhost, -c local ~/cerc/laconicd-stack/playbooks/validator/run-validator.yml
```
- Input private key of the existing account that was exported in previous steps when prompted
- Check logs to ensure that node is running:
```bash
@ -154,7 +165,7 @@
- Copy the genesis file to [config](./config) folder:
```bash
cp $DATA_DIRECTORY/$MAINNET_DEPLOYMENT_DIR/data/laconicd-data/config/genesis.json ~/cerc/laconicd-stack/config/mainnet-genesis.json
cp <absolute-path-to-generated-output-dir>/genesis.json ~/cerc/laconicd-stack/config/mainnet-genesis.json
```
- Copy the staking amount file to [config](./config) folder:

View File

@ -41,6 +41,9 @@
# Set custom moniker for the node
cerc_moniker: "<your-moniker>"
genesis_file: "~/cerc/laconicd-stack/config/mainnet-genesis.json"
staking_amount_file: "~/cerc/laconicd-stack/config/staking-amount.json"
# Set persistent peers (comma-separated list of node IDs and addresses)
# You can find the list of available peers in https://git.vdb.to/cerc-io/laconicd-stack/src/branch/main/node-addresses.yml
cerc_peers: "<node-id>@<node-host>:26656,<node-id>@<node-host>:26656"
@ -71,6 +74,8 @@
## Create Validator
- Run these steps in a machine different from the one where the node is running
- Export required env vars:
```bash
@ -79,6 +84,9 @@
export DATA_DIRECTORY=<data-directory>
export MAINNET_DEPLOYMENT_DIR=<mainnet-deployment-dir>
# Set the public IP address of the machine where your node is running
export NODE_URL="tcp://PUBLIC_IP_ADDRESS:26657"
```
- Run ansible playbook to create validator on running chain:
@ -98,6 +106,8 @@
## Register Your Node
- Run these steps in a machine where the node is running
- Get your node's address:
```bash

View File

@ -2,7 +2,7 @@
- name: Generate Mainnet Genesis File
hosts: localhost
vars_files:
- first-validator-vars.yml
- generate-genesis-vars.yml
vars:
data_directory: "{{ lookup('env', 'DATA_DIRECTORY') }}"
mainnet_deployment_dir: "{{ lookup('env', 'MAINNET_DEPLOYMENT_DIR') }}"
@ -104,3 +104,12 @@
-e "CERC_MONIKER={{ cerc_moniker }}" \
-e "CERC_CHAIN_ID={{ cerc_chain_id }}" \
cerc/laconicd:local bash -c "/scripts/create-and-collect-gentx.sh"
- name: Update genesis file in output
shell: |
cp {{data_directory}}/{{ mainnet_deployment_dir }}/data/laconicd-data/config/genesis.json output/genesis.json
- name: Clear tmp directory
file:
path: "{{data_directory}}/{{ mainnet_deployment_dir }}/data/laconicd-data/tmp"
state: absent

View File

@ -20,8 +20,8 @@
fail:
msg: >-
Required key files are not defined.
Please set genesis_file and staking_amount_file in validator-vars.yml.
when: not genesis_file or not staking_amount_file
Please set genesis_file in validator-vars.yml.
when: not genesis_file
- name: Fetch laconicd stack
shell: laconic-so fetch-stack git.vdb.to/cerc-io/laconicd-stack --git-ssh --pull
@ -64,12 +64,6 @@
state: directory
mode: '0755'
- name: Copy staking amount file to laconicd-data tmp directory
copy:
src: "{{ staking_amount_file }}"
dest: "{{data_directory}}/{{ mainnet_deployment_dir }}/data/laconicd-data/tmp/staking-amount.json"
mode: '0644'
- name: Copy genesis file to laconicd-data tmp directory
copy:
src: "{{ genesis_file }}"

View File

@ -1,7 +1,7 @@
cerc_chain_id: "laconic-mainnet"
min_gas_price: 0.001
cerc_loglevel: "info"
genesis_file: "~/cerc/laconicd-stack/config/mainnet-genesis.json"
staking_amount_file: "~/cerc/laconicd-stack/config/staking-amount.json"
cerc_moniker: ""
genesis_file: ""
staking_amount_file: ""
cerc_peers: ""

View File

@ -72,5 +72,5 @@ laconicd genesis validate
chmod 777 $genesis_file_path
# Update the input genesis file
cp $genesis_file_path $input_genesis_file
# Clear tmp directory
rm -rf $NODE_HOME/tmp