Add playbook to run mainnet validator node

This commit is contained in:
Shreerang Kale 2025-05-13 18:02:23 +05:30
parent afd2082f6e
commit f181e67045
3 changed files with 104 additions and 0 deletions

View File

@ -0,0 +1,8 @@
cerc_moniker: "TestnetNode"
cerc_chain_id: "laconic_9000-1"
cerc_peers:
min_gas_price: 0.001
cerc_loglevel: "info"
genesis_file:
node_key_file:
priv_validator_key_file:

View File

@ -0,0 +1,87 @@
---
- name: Run mainnet validator node
hosts: localhost
vars_files:
- run-validator-vars.yml
vars:
data_directory: "{{ lookup('env', 'DATA_DIRECTORY') }}"
mainnet_deployment_dir: "{{ lookup('env', 'MAINNET_DEPLOYMENT_DIR') }}"
spec_file: "{{data_directory}}/mainnet-laconicd-spec.yml"
spec_template: "./templates/specs/mainnet-laconicd-spec-template.yml.j2"
tasks:
- name: Fail if DATA_DIRECTORY or MAINNET_DEPLOYMENT_DIR env vars are not set
fail:
msg: >-
Required environment variables are not set.
Please export both DATA_DIRECTORY and MAINNET_DEPLOYMENT_DIR before running the playbook.
when: lookup('env', 'DATA_DIRECTORY') == '' or lookup('env', 'MAINNET_DEPLOYMENT_DIR') == ''
- name: Fail if required key files are not defined
fail:
msg: >-
Required key files are not defined.
Please set genesis_file, node_key_file, and priv_validator_key_file in run-validator-vars.yml.
when: not genesis_file or not node_key_file or not priv_validator_key_file
- name: Fetch laconicd stack
shell: laconic-so fetch-stack git.vdb.to/cerc-io/laconicd-stack --git-ssh --pull
- name: Setup required repositories
shell: >
laconic-so --stack ~/cerc/laconicd-stack/stack-orchestrator/stacks/mainnet-laconicd
setup-repositories --git-ssh --pull
- name: Build container images
shell: |
laconic-so --stack ~/cerc/laconicd-stack/stack-orchestrator/stacks/mainnet-laconicd build-containers
- name: Create deployment spec file
shell: |
laconic-so --stack ~/cerc/laconicd-stack/stack-orchestrator/stacks/mainnet-laconicd deploy init --output {{ spec_file }}
- name: Replace network section in spec_file
shell: >
yq eval '(.network) = load("{{ spec_template }}").network' -i {{ spec_file }}
- name: Create deployment from spec file
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 }}
- name: Create config.env
copy:
dest: "{{data_directory}}/{{ mainnet_deployment_dir }}/config.env"
content: |
CERC_MONIKER: {{ cerc_moniker }}
CERC_CHAIN_ID: {{ cerc_chain_id }}
CERC_PEERS: {{ cerc_peers}}
MIN_GAS_PRICE: {{ min_gas_price }}
CERC_LOGLEVEL: {{ cerc_loglevel }}
mode: '0777'
- name: Ensure tmp directory exists inside laconicd-data
file:
path: "{{data_directory}}/{{ mainnet_deployment_dir }}/data/laconicd-data/tmp"
state: directory
mode: '0755'
- name: Copy genesis file to laconicd-data tmp directory
copy:
src: "{{ genesis_file }}"
dest: "{{data_directory}}/{{ mainnet_deployment_dir }}/data/laconicd-data/tmp/genesis.json"
mode: '0644'
- name: Copy node key file to laconicd-data tmp directory
copy:
src: "{{ node_key_file }}"
dest: "{{data_directory}}/{{ mainnet_deployment_dir }}/data/laconicd-data/tmp/node_key.json"
mode: '0644'
- name: Copy priv validator key file to laconicd-data tmp directory
copy:
src: "{{ priv_validator_key_file }}"
dest: "{{data_directory}}/{{ mainnet_deployment_dir }}/data/laconicd-data/tmp/priv_validator_key.json"
mode: '0644'
- name: Run validator node
shell: |
laconic-so deployment --dir {{data_directory}}/{{ mainnet_deployment_dir }} start

View File

@ -0,0 +1,9 @@
network:
ports:
laconicd:
- '6060:6060'
- '26657:26657'
- '26656:26656'
- '9473:9473'
- '9090:9090'
- '1317:1317'