Add steps for multisig app usage

This commit is contained in:
Shreerang Kale 2025-06-14 12:57:53 +05:30
parent cba2a0e6e5
commit b640d9433d
10 changed files with 246 additions and 43 deletions

View File

@ -19,3 +19,7 @@
- **Run A Validator Node:** Follow steps in [run-validator.md](docs/run-validator.md) to run a mainnet validator node - **Run A Validator Node:** Follow steps in [run-validator.md](docs/run-validator.md) to run a mainnet validator node
- **Update Service Provider:** Follow steps in [update-service-provider.md](docs/update-service-provider.md) to migrate your service provider from SAPO testnet to mainnet - **Update Service Provider:** Follow steps in [update-service-provider.md](docs/update-service-provider.md) to migrate your service provider from SAPO testnet to mainnet
## Multisig App
- Usage guide is available at [multisig-usage.md](./playbooks/cosmos-multisig-app/multisig-usage.md)

View File

@ -19,6 +19,11 @@
"coinDenom": "ALNT", "coinDenom": "ALNT",
"coinMinimalDenom": "alnt", "coinMinimalDenom": "alnt",
"coinDecimals": 0 "coinDecimals": 0
},
{
"coinDenom": "LPS",
"coinMinimalDenom": "alps",
"coinDecimals": 18
} }
], ],
"feeCurrencies": [ "feeCurrencies": [
@ -39,7 +44,6 @@
"coinDecimals": 0 "coinDecimals": 0
}, },
"features": [ "features": [
"stargate", "stargate"
"ibc-transfer"
] ]
} }

View File

@ -91,6 +91,11 @@
- Copy over the `priv_validator_key.json` located at `$DATA_DIRECTORY/$MAINNET_DEPLOYMENT_DIR/data/laconicd-data/config/priv_validator_key.json` to the machine where the TMKMS service is to be setup (machine 4) - Copy over the `priv_validator_key.json` located at `$DATA_DIRECTORY/$MAINNET_DEPLOYMENT_DIR/data/laconicd-data/config/priv_validator_key.json` to the machine where the TMKMS service is to be setup (machine 4)
```bash
# Example command to transfer file from machine 2 to machine 4 (run on machine 2)
scp -C $DATA_DIRECTORY/$MAINNET_DEPLOYMENT_DIR/data/laconicd-data/config/priv_validator_key.json <user>@<machine-ip-address>:<absolute-path-to-desired-destination-directory>
```
## Setup TMKMS ## Setup TMKMS
- For integrating TMKMS with laconicd, follow steps below in the machine where the TMKMS service is to be setup (machine 4) - For integrating TMKMS with laconicd, follow steps below in the machine where the TMKMS service is to be setup (machine 4)
@ -134,20 +139,25 @@
- The compressed zst file will be generated at `<absolute-path-to-testnet-deployment>/export/testnet-state.zst` - The compressed zst file will be generated at `<absolute-path-to-testnet-deployment>/export/testnet-state.zst`
- Copy over the compressed `testnet-state.zst` file to the machine where the genesis file is to be generated (machine 3)
```bash
# Example command to transfer file from machine 1 to machine 3 (run on machine 1)
scp -C <absolute-path-to-testnet-deployment>/export/testnet-state.zst <user>@<machine-ip-address>:<absolute-path-to-desired-destination-directory>
```
## Generate mainnet genesis file ## Generate mainnet genesis file
- Run the following steps in machine where [the genesis file is to be generated (machine 3)](#build-laconicd-to-generate-genesis-file) - Run the following steps in machine where [the genesis file is to be generated (machine 3)](#build-laconicd-to-generate-genesis-file)
- Copy over compressed `testnet-state.zst` file in previous steps from machine 1 to machine 3
- Set envs: - Set envs:
```bash ```bash
# Path where exported testnet state JSON file will be created # File path where exported testnet state JSON file will be created
export EXPORTED_STATE_PATH=<absolute-path-to-be-exported-testnet-state-json> export EXPORTED_STATE_PATH=<absolute/path/to/testnet-state.json>
# Path where LPS distribution JSON file will be created # File path where LPS distribution JSON file will be created
export LPS_DISTRIBUTION_PATH=<absolute-path-to-be-generated-distribution-json> export LPS_DISTRIBUTION_PATH=<absolute/path/to/distribution.json>
export EARLY_SUPPORTS_ACC_ADDR=<account-address-controlled-by-laconic-foundation> export EARLY_SUPPORTS_ACC_ADDR=<account-address-controlled-by-laconic-foundation>
@ -328,7 +338,7 @@
``` ```
- Query the early supports account balance: - Query the early supports account balance:
```bash ```bash
# Set the early supports account address # Set the early supports account address
export EARLY_SUPPORTS_ACC_ADDR=<account-address-controlled-by-laconic-foundation> export EARLY_SUPPORTS_ACC_ADDR=<account-address-controlled-by-laconic-foundation>
@ -371,6 +381,54 @@
- Update `$DATA_DIRECTORY/$MAINNET_DEPLOYMENT_DIR/config.env` with required values - Update `$DATA_DIRECTORY/$MAINNET_DEPLOYMENT_DIR/config.env` with required values
- Start the node deployment:
```bash
laconic-so deployment --dir $DATA_DIRECTORY/$MAINNET_DEPLOYMENT_DIR start
```
## Rebuild Images
- Follow these steps to rebuild the images for TMKMS and node in case of any code changes
### TMKMS
- Run these steps in the machine where the TMKMS service is setup (machine 4)
- Stop the TMKMS deployment:
```bash
laconic-so deployment --dir $DATA_DIRECTORY/tmkms-deployment stop
```
- Run ansible playbook to rebuild the TMKMS image:
```bash
BUILD_ONLY=true ansible-playbook -i localhost, -c local ~/cerc/laconicd-stack/playbooks/tmkms/setup-tmkms.yml
```
- Start the TMKMS deployment:
```bash
ansible-playbook -i localhost, -c local ~/cerc/laconicd-stack/playbooks/tmkms/run-tmkms.yml
```
### Node
- Run these steps in the machine where the mainnet node is setup (machine 2)
- Stop the node deployment:
```bash
laconic-so deployment --dir $DATA_DIRECTORY/$MAINNET_DEPLOYMENT_DIR stop
```
- Run ansible playbook to rebuild the node image:
```bash
BUILD_ONLY=true ansible-playbook -i localhost, -c local ~/cerc/laconicd-stack/playbooks/first-validator/setup-first-validator.yml
```
- Start the node deployment: - Start the node deployment:
```bash ```bash
@ -413,6 +471,6 @@
The following files should show up: The following files should show up:
- node-addresses.yml - node-addresses.yml
- config/mainnet-genesis.json - config/mainnet-genesis.json
- config/staking-amount.json - config/staking-amount.json
- Submit a PR with the genesis file, staking amount file and node address so that it is available to other validators - Submit a PR with the genesis file, staking amount file and node address so that it is available to other validators

View File

@ -102,7 +102,12 @@
ansible-playbook -i localhost, -c local ~/cerc/laconicd-stack/playbooks/validator/setup-validator.yml ansible-playbook -i localhost, -c local ~/cerc/laconicd-stack/playbooks/validator/setup-validator.yml
``` ```
- Copy over the `priv_validator_key.json` located at `$DATA_DIRECTORY/$MAINNET_DEPLOYMENT_DIR/data/laconicd-data/config/priv_validator_key.json` to the machine from where the TMKMS service is to be setup (machine 4) - Copy over the `priv_validator_key.json` located at `$DATA_DIRECTORY/$MAINNET_DEPLOYMENT_DIR/data/laconicd-data/config/priv_validator_key.json` to the machine where the TMKMS service is to be setup (machine 4)
```bash
# Example command to transfer file from machine 2 to machine 4 (run on machine 2)
scp -C $DATA_DIRECTORY/$MAINNET_DEPLOYMENT_DIR/data/laconicd-data/config/priv_validator_key.json <user>@<machine-ip-address>:<absolute-path-to-desired-destination-directory>
```
## Setup TMKMS ## Setup TMKMS
@ -288,6 +293,54 @@
- Update `$DATA_DIRECTORY/$MAINNET_DEPLOYMENT_DIR/config.env` with required values - Update `$DATA_DIRECTORY/$MAINNET_DEPLOYMENT_DIR/config.env` with required values
- Start the node deployment:
```bash
laconic-so deployment --dir $DATA_DIRECTORY/$MAINNET_DEPLOYMENT_DIR start
```
## Rebuild Images
- Follow these steps to rebuild the images for TMKMS and node in case of any code changes
### TMKMS
- Run these steps in the machine where the TMKMS service is setup (machine 4)
- Stop the TMKMS deployment:
```bash
laconic-so deployment --dir $DATA_DIRECTORY/tmkms-deployment stop
```
- Run ansible playbook to rebuild the TMKMS image:
```bash
BUILD_ONLY=true ansible-playbook -i localhost, -c local ~/cerc/laconicd-stack/playbooks/tmkms/setup-tmkms.yml
```
- Start the TMKMS deployment:
```bash
ansible-playbook -i localhost, -c local ~/cerc/laconicd-stack/playbooks/tmkms/run-tmkms.yml
```
### Node
- Run these steps in the machine where the mainnet node is setup (machine 2)
- Stop the node deployment:
```bash
laconic-so deployment --dir $DATA_DIRECTORY/$MAINNET_DEPLOYMENT_DIR stop
```
- Run ansible playbook to rebuild the node image:
```bash
BUILD_ONLY=true ansible-playbook -i localhost, -c local ~/cerc/laconicd-stack/playbooks/validator/setup-validator.yml
```
- Start the node deployment: - Start the node deployment:
```bash ```bash

View File

@ -11,19 +11,20 @@ This playbook sets up the Cosmos Multisig application for managing multisig wall
## Configuration ## Configuration
* Fetch the stack: - Fetch the stack:
```bash ```bash
laconic-so fetch-stack git.vdb.to/cerc-io/laconicd-stack --git-ssh --pull laconic-so fetch-stack git.vdb.to/cerc-io/laconicd-stack --git-ssh --pull
``` ```
* Copy the example variables file: - Copy the example variables file:
```bash ```bash
cp ~/cerc/laconicd-stack/playbooks/cosmos-multisig-app/cosmos-multisig-vars.example.yml ~/cerc/laconicd-stack/playbooks/cosmos-multisig-app/cosmos-multisig-vars.yml cp ~/cerc/laconicd-stack/playbooks/cosmos-multisig-app/cosmos-multisig-vars.example.yml ~/cerc/laconicd-stack/playbooks/cosmos-multisig-app/cosmos-multisig-vars.yml
``` ```
* Update `~/cerc/laconicd-stack/playbooks/cosmos-multisig-app/cosmos-multisig-vars.yml` with your node configuration: - Update `~/cerc/laconicd-stack/playbooks/cosmos-multisig-app/cosmos-multisig-vars.yml` with your node configuration:
```yaml ```yaml
next_public_node_addresses: '["https://laconicd-mainnet.laconic.com"]' next_public_node_addresses: '["https://laconicd-mainnet.laconic.com"]'
node_rest_endpoint: "https://api.laconicd-mainnet.laconic.com" node_rest_endpoint: "https://api.laconicd-mainnet.laconic.com"
@ -31,65 +32,73 @@ This playbook sets up the Cosmos Multisig application for managing multisig wall
## Setup Steps ## Setup Steps
* Set common environment variables: - Set common environment variables:
```bash
# Parent directory where the deployment directory will live ```bash
export DATA_DIRECTORY=<path/to/deployments/directory> # Parent directory where the deployment directory will live
export DATA_DIRECTORY=<absolute/path/to/deployments/directory>
export MULTISIG_DEPLOYMENT_DIR=cosmos-multisig-deployment
``` export MULTISIG_DEPLOYMENT_DIR=cosmos-multisig-deployment
```
- Copy the inventory file:
* Copy the inventory file:
```bash ```bash
cp ~/cerc/laconicd-stack/playbooks/hosts.ini.example ~/cerc/laconicd-stack/playbooks/cosmos-multisig-app/hosts.ini cp ~/cerc/laconicd-stack/playbooks/hosts.ini.example ~/cerc/laconicd-stack/playbooks/cosmos-multisig-app/hosts.ini
``` ```
### Local Setup ### Local Setup
* Setup and start the multisig app: - Setup and start the multisig app:
```bash ```bash
ansible-playbook -v -i ~/cerc/laconicd-stack/playbooks/cosmos-multisig-app/hosts.ini ~/cerc/laconicd-stack/playbooks/cosmos-multisig-app/cosmos-multisig-app-start.yml --limit local ansible-playbook -v -i ~/cerc/laconicd-stack/playbooks/cosmos-multisig-app/hosts.ini ~/cerc/laconicd-stack/playbooks/cosmos-multisig-app/cosmos-multisig-app-start.yml --limit local
``` ```
* Access the app at <http://localhost:7000/laconic> - Access the app at <http://localhost:7000/laconic-mainnet>
### Remote Setup ### Remote Setup
* Create and configure hosts.ini: - Create and configure hosts.ini:
- Edit `~/cerc/laconicd-stack/playbooks/cosmos-multisig-app/hosts.ini` and update the remote host details:
* Edit `~/cerc/laconicd-stack/playbooks/cosmos-multisig-app/hosts.ini` and update the remote host details:
```ini ```ini
[remote] [remote]
# Replace with your actual remote host details # Replace with your actual remote host details
remote_host ansible_host=your.remote.host ansible_user=your_remote_user ansible_ssh_common_args='-o ForwardAgent=yes' remote_host ansible_host=your.remote.host ansible_user=your_remote_user ansible_ssh_common_args='-o ForwardAgent=yes'
``` ```
* Verify SSH connection using Ansible ping: - Verify SSH connection using Ansible ping:
```bash ```bash
ansible all -m ping -i ~/cerc/laconicd-stack/playbooks/cosmos-multisig-app/hosts.ini --limit remote_host ansible all -m ping -i ~/cerc/laconicd-stack/playbooks/cosmos-multisig-app/hosts.ini --limit remote_host
``` ```
* Run the playbook targeting the remote host: - Run the playbook targeting the remote host:
```bash ```bash
ansible-playbook -v -i ~/cerc/laconicd-stack/playbooks/cosmos-multisig-app/hosts.ini ~/cerc/laconicd-stack/playbooks/cosmos-multisig-app/cosmos-multisig-app-start.yml --limit remote_host ansible-playbook -v -i ~/cerc/laconicd-stack/playbooks/cosmos-multisig-app/hosts.ini ~/cerc/laconicd-stack/playbooks/cosmos-multisig-app/cosmos-multisig-app-start.yml --limit remote_host
``` ```
* Access the app at <http://your.remote.host:7000/laconic> - Access the app at <http://your.remote.host:7000/laconic-mainnet>
## Check Status ## Check Status
* Check app logs: - Check app logs:
```bash
laconic-so deployment --dir $DATA_DIRECTORY/$MULTISIG_DEPLOYMENT_DIR logs -f cosmos-multisig-ui ```bash
``` laconic-so deployment --dir $DATA_DIRECTORY/$MULTISIG_DEPLOYMENT_DIR logs -f cosmos-multisig-ui
```
## Update ## Update
- Set environment variables for the deployment: - Set environment variables for the deployment:
```bash ```bash
# Parent directory where the deployment directory will live # Parent directory where the deployment directory will live
export DATA_DIRECTORY=<path/to/deployments/directory> export DATA_DIRECTORY=<absolute/path/to/deployments/directory>
export MULTISIG_DEPLOYMENT_DIR=cosmos-multisig-deployment export MULTISIG_DEPLOYMENT_DIR=cosmos-multisig-deployment
``` ```
@ -104,11 +113,11 @@ This playbook sets up the Cosmos Multisig application for managing multisig wall
- Run ansible playbook to deploy again: - Run ansible playbook to deploy again:
- For local host - For local host
```bash ```bash
ansible-playbook -v -i ~/cerc/laconicd-stack/playbooks/cosmos-multisig-app/hosts.ini ~/cerc/laconicd-stack/playbooks/cosmos-multisig-app/cosmos-multisig-app-start.yml --limit local ansible-playbook -v -i ~/cerc/laconicd-stack/playbooks/cosmos-multisig-app/hosts.ini ~/cerc/laconicd-stack/playbooks/cosmos-multisig-app/cosmos-multisig-app-start.yml --limit local
``` ```
- For remote host (check that remote is configured properly in `~/cerc/laconicd-stack/playbooks/cosmos-multisig-app/hosts.ini`) - For remote host (check that remote is configured properly in `~/cerc/laconicd-stack/playbooks/cosmos-multisig-app/hosts.ini`)
```bash ```bash
@ -118,12 +127,14 @@ This playbook sets up the Cosmos Multisig application for managing multisig wall
## Clean up ## Clean up
- To stop the deployment: - To stop the deployment:
```bash ```bash
laconic-so deployment --dir $DATA_DIRECTORY/$MULTISIG_DEPLOYMENT_DIR stop laconic-so deployment --dir $DATA_DIRECTORY/$MULTISIG_DEPLOYMENT_DIR stop
``` ```
- To stop and delete all data: - To stop and delete all data:
```bash ```bash
laconic-so deployment --dir $DATA_DIRECTORY/$MULTISIG_DEPLOYMENT_DIR stop --delete-volumes laconic-so deployment --dir $DATA_DIRECTORY/$MULTISIG_DEPLOYMENT_DIR stop --delete-volumes
sudo rm -rf $DATA_DIRECTORY/$MULTISIG_DEPLOYMENT_DIR sudo rm -rf $DATA_DIRECTORY/$MULTISIG_DEPLOYMENT_DIR
``` ```

View File

@ -29,7 +29,7 @@ next_public_display_denom: "ALNT"
next_public_display_denom_exponent: 0 next_public_display_denom_exponent: 0
# JSON array of asset definitions, including denom units, base, name, display, and symbol # JSON array of asset definitions, including denom units, base, name, display, and symbol
next_public_assets: '[{"denom_units":[{"denom":"alnt","exponent":0}],"base":"alnt","name":"Laconic Token","display":"ALNT","symbol":"alnt"}]' next_public_assets: '[{"denom_units":[{"denom":"alnt","exponent":0}],"base":"alnt","name":"Laconic Token","display":"ALNT","symbol":"alnt"},{"denom_units":[{"denom":"lps","exponent":18},{"denom":"alps","exponent":0}],"base":"alps","name":"Laconic Prepaid Service","display":"LPS","symbol":"LPS"}]'
# Default gas price for transactions # Default gas price for transactions
next_public_gas_price: "0.001alnt" next_public_gas_price: "0.001alnt"

View File

@ -0,0 +1,55 @@
# Multisig Usage
## Create a Multisig
- On opening the app, a prompt will be shown to add Laconic Mainnet network to you Keplr wallet. Click on `Approve`
- Go to home and click on `I don't have a multisig`
- Add the addresses of accounts which have performed at least one tx on chain
- Set the threshold as required (if threshold is set to N out of N members then all the validators have to sign the tx)
- Click on `Submit` and `Create multisig`
## Import Accounts in Keplr
- Add the accounts in Keplr wallet for signing the transaction
- Open Keplr wallet and click on the user icon in the top right corner
- Click on `Add wallet`, then select `Import an existing wallet` and go to `Use recovery phrase or private key`
- Select the `Private key` tab and then paste the private key of the account and click on import
- Set a name for the wallet (used when connecting wallet to app for signing transaction) and click on next
- Search for `Laconic Mainnet` and select it, then click on `Save`
- Other accounts can be added in a similar manner
- Send funds to the generated multisig address using Keplr
- Open Keplr wallet and select the account from which you wish to transfer the funds to the multisig address
- Search for `Laconic Mainnet` and select the network. Select `Send` and paste the multisig address and set desired amount and click on `Next` and approve the transaction
## Send Transaction From Multisig Address
- In the multisig app, Go to `home`, paste your multisig address and click on `Use this multisig`
- You will see the multisig members and holdings for the address
- Click on `Create new transaction` and then click on `Bank Send` under `Add New Msg`
- Enter the recipient address, amount to be transfered and memo (optional)
- Click on create transaction
- Under Choose wallet to sign, click on `Connect Keplr`
- After connecting the wallet, click on `Sign transaction` and approve the transaction
- Repeat the above steps for other members of the multisig to sign the transaction
- Once the transaction is signed by required number of validators (as set in the threshold), click on `Broadcast Transaction`

View File

@ -9,6 +9,7 @@
spec_file: "{{data_directory}}/laconicd-spec.yml" spec_file: "{{data_directory}}/laconicd-spec.yml"
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 '' }}"
BUILD_ONLY: "{{ lookup('env', 'BUILD_ONLY') | default(false) | bool }}"
tasks: tasks:
- name: Include setup tasks - name: Include setup tasks
ansible.builtin.import_tasks: ../setup.yml ansible.builtin.import_tasks: ../setup.yml
@ -18,7 +19,7 @@
msg: >- msg: >-
Required environment variables are not set. Required environment variables are not set.
Please export both DATA_DIRECTORY and MAINNET_DEPLOYMENT_DIR before running the playbook. Please export both DATA_DIRECTORY and MAINNET_DEPLOYMENT_DIR before running the playbook.
when: lookup('env', 'DATA_DIRECTORY') == '' or lookup('env', 'MAINNET_DEPLOYMENT_DIR') == '' when: not BUILD_ONLY and (lookup('env', 'DATA_DIRECTORY') == '' or lookup('env', 'MAINNET_DEPLOYMENT_DIR') == '')
- name: Setup required repositories - name: Setup required repositories
shell: > shell: >
@ -30,18 +31,22 @@
laconic-so --stack ~/cerc/laconicd-stack/stack-orchestrator/stacks/mainnet-laconicd build-containers {{ build_args }} laconic-so --stack ~/cerc/laconicd-stack/stack-orchestrator/stacks/mainnet-laconicd build-containers {{ build_args }}
- name: Create deployment spec file - name: Create deployment spec file
when: not BUILD_ONLY
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 }}
- name: Replace network section in spec_file - name: Replace network section in spec_file
when: not BUILD_ONLY
shell: > shell: >
{{ yq_path }} 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
when: not BUILD_ONLY
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 }}
- name: Create config.env - name: Create config.env
when: not BUILD_ONLY
copy: copy:
dest: "{{data_directory}}/{{ mainnet_deployment_dir }}/config.env" dest: "{{data_directory}}/{{ mainnet_deployment_dir }}/config.env"
content: | content: |
@ -53,6 +58,7 @@
mode: '0777' mode: '0777'
- name: Initialize laconicd node - name: Initialize laconicd node
when: not BUILD_ONLY
shell: | shell: |
docker run -i \ docker run -i \
-v {{data_directory}}/{{ mainnet_deployment_dir }}/data/laconicd-data:/root/.laconicd \ -v {{data_directory}}/{{ mainnet_deployment_dir }}/data/laconicd-data:/root/.laconicd \
@ -62,6 +68,7 @@
cerc/laconicd:local bash -c "/scripts/setup-laconicd.sh" cerc/laconicd:local bash -c "/scripts/setup-laconicd.sh"
- name: Ensure tmp directory exists inside laconicd-data - name: Ensure tmp directory exists inside laconicd-data
when: not BUILD_ONLY
file: file:
path: "{{data_directory}}/{{ mainnet_deployment_dir }}/data/laconicd-data/tmp" path: "{{data_directory}}/{{ mainnet_deployment_dir }}/data/laconicd-data/tmp"
state: directory state: directory

View File

@ -6,13 +6,14 @@
tmkms_deployment_dir: "{{ lookup('env', 'TMKMS_DEPLOYMENT_DIR') | default('tmkms-deployment', true) }}" tmkms_deployment_dir: "{{ lookup('env', 'TMKMS_DEPLOYMENT_DIR') | default('tmkms-deployment', true) }}"
tmkms_spec_file: "{{data_directory}}/tmkms-spec.yml" tmkms_spec_file: "{{data_directory}}/tmkms-spec.yml"
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 '' }}"
BUILD_ONLY: "{{ lookup('env', 'BUILD_ONLY') | default(false) | bool }}"
tasks: tasks:
- name: Fail if DATA_DIRECTORY env var is not set - name: Fail if DATA_DIRECTORY env var is not set
fail: fail:
msg: >- msg: >-
Required environment variable DATA_DIRECTORY is not set. Required environment variable DATA_DIRECTORY is not set.
Please export DATA_DIRECTORY before running the playbook. Please export DATA_DIRECTORY before running the playbook.
when: lookup('env', 'DATA_DIRECTORY') == '' when: not BUILD_ONLY and lookup('env', 'DATA_DIRECTORY') == ''
- name: Fetch tmkms stack - name: Fetch tmkms stack
shell: | shell: |
@ -23,9 +24,11 @@
laconic-so --stack ~/cerc/tmkms-stack/stack-orchestrator/stacks/tmkms build-containers {{ build_args }} laconic-so --stack ~/cerc/tmkms-stack/stack-orchestrator/stacks/tmkms build-containers {{ build_args }}
- name: Create tmkms deployment spec file - name: Create tmkms deployment spec file
when: not BUILD_ONLY
shell: | shell: |
laconic-so --stack ~/cerc/tmkms-stack/stack-orchestrator/stacks/tmkms deploy init --output {{ tmkms_spec_file }} laconic-so --stack ~/cerc/tmkms-stack/stack-orchestrator/stacks/tmkms deploy init --output {{ tmkms_spec_file }}
- name: Create tmkms deployment from spec file - name: Create tmkms deployment from spec file
when: not BUILD_ONLY
shell: | shell: |
laconic-so --stack ~/cerc/tmkms-stack/stack-orchestrator/stacks/tmkms deploy create --spec-file {{ tmkms_spec_file }} --deployment-dir {{data_directory}}/{{ tmkms_deployment_dir }} laconic-so --stack ~/cerc/tmkms-stack/stack-orchestrator/stacks/tmkms deploy create --spec-file {{ tmkms_spec_file }} --deployment-dir {{data_directory}}/{{ tmkms_deployment_dir }}

View File

@ -9,6 +9,7 @@
spec_file: "{{data_directory}}/laconicd-validator-spec.yml" spec_file: "{{data_directory}}/laconicd-validator-spec.yml"
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 '' }}"
BUILD_ONLY: "{{ lookup('env', 'BUILD_ONLY') | default(false) | bool }}"
tasks: tasks:
- name: Include setup tasks - name: Include setup tasks
ansible.builtin.import_tasks: ../setup.yml ansible.builtin.import_tasks: ../setup.yml
@ -18,14 +19,14 @@
msg: >- msg: >-
Required environment variables are not set. Required environment variables are not set.
Please export both DATA_DIRECTORY and MAINNET_DEPLOYMENT_DIR before running the playbook. Please export both DATA_DIRECTORY and MAINNET_DEPLOYMENT_DIR before running the playbook.
when: lookup('env', 'DATA_DIRECTORY') == '' or lookup('env', 'MAINNET_DEPLOYMENT_DIR') == '' when: not BUILD_ONLY and (lookup('env', 'DATA_DIRECTORY') == '' or lookup('env', 'MAINNET_DEPLOYMENT_DIR') == '')
- name: Fail if required key files are not defined - name: Fail if required key files are not defined
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 genesis_file and staking_amount_file in validator-vars.yml.
when: not genesis_file or not staking_amount_file when: not BUILD_ONLY and (not genesis_file or not staking_amount_file)
- name: Setup required repositories - name: Setup required repositories
shell: > shell: >
@ -37,18 +38,22 @@
laconic-so --stack ~/cerc/laconicd-stack/stack-orchestrator/stacks/mainnet-laconicd build-containers {{ build_args }} laconic-so --stack ~/cerc/laconicd-stack/stack-orchestrator/stacks/mainnet-laconicd build-containers {{ build_args }}
- name: Create deployment spec file - name: Create deployment spec file
when: not BUILD_ONLY
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 }}
- name: Replace network section in spec_file - name: Replace network section in spec_file
when: not BUILD_ONLY
shell: > shell: >
{{ yq_path }} 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
when: not BUILD_ONLY
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 }}
- name: Create config.env - name: Create config.env
when: not BUILD_ONLY
copy: copy:
dest: "{{data_directory}}/{{ mainnet_deployment_dir }}/config.env" dest: "{{data_directory}}/{{ mainnet_deployment_dir }}/config.env"
content: | content: |
@ -61,18 +66,21 @@
mode: '0777' mode: '0777'
- name: Ensure tmp directory exists inside laconicd-data - name: Ensure tmp directory exists inside laconicd-data
when: not BUILD_ONLY
file: file:
path: "{{data_directory}}/{{ mainnet_deployment_dir }}/data/laconicd-data/tmp" path: "{{data_directory}}/{{ mainnet_deployment_dir }}/data/laconicd-data/tmp"
state: directory state: directory
mode: '0755' mode: '0755'
- name: Copy genesis file to laconicd-data tmp directory - name: Copy genesis file to laconicd-data tmp directory
when: not BUILD_ONLY
copy: copy:
src: "{{ genesis_file }}" src: "{{ genesis_file }}"
dest: "{{data_directory}}/{{ mainnet_deployment_dir }}/data/laconicd-data/tmp/genesis.json" dest: "{{data_directory}}/{{ mainnet_deployment_dir }}/data/laconicd-data/tmp/genesis.json"
mode: '0644' mode: '0644'
- name: Initialize laconicd node - name: Initialize laconicd node
when: not BUILD_ONLY
shell: | shell: |
docker run -i \ docker run -i \
-v {{data_directory}}/{{ mainnet_deployment_dir }}/data/laconicd-data:/root/.laconicd \ -v {{data_directory}}/{{ mainnet_deployment_dir }}/data/laconicd-data:/root/.laconicd \