From f7d1a8d6ed3a1edd4b4ebe5be99289b22504b88e Mon Sep 17 00:00:00 2001 From: Nabarun Date: Wed, 11 Jun 2025 07:35:42 +0530 Subject: [PATCH 1/2] Update multisig playbook to setup deployment on remote machine --- config/network.json | 12 +++--- docs/demo.md | 2 +- playbooks/cosmos-multisig-app/README.md | 42 +++++++++++++++---- .../cosmos-multisig-app-start.yml | 39 +++++++++++++---- .../cosmos-multisig-vars.example.yml | 6 +-- .../cosmos-multisig-app-spec-template.yml.j2 | 2 +- playbooks/hosts.ini.example | 10 +++++ 7 files changed, 87 insertions(+), 26 deletions(-) create mode 100644 playbooks/hosts.ini.example diff --git a/config/network.json b/config/network.json index 2c68cdc..ce66559 100644 --- a/config/network.json +++ b/config/network.json @@ -18,25 +18,25 @@ { "coinDenom": "ALNT", "coinMinimalDenom": "alnt", - "coinDecimals": 18 + "coinDecimals": 0 } ], "feeCurrencies": [ { "coinDenom": "ALNT", "coinMinimalDenom": "alnt", - "coinDecimals": 18, + "coinDecimals": 0, "gasPriceStep": { - "low": 0.01, - "average": 0.01, - "high": 0.02 + "low": 0.001, + "average": 0.001, + "high": 0.002 } } ], "stakeCurrency": { "coinDenom": "ALNT", "coinMinimalDenom": "alnt", - "coinDecimals": 18 + "coinDecimals": 0 }, "features": [ "stargate", diff --git a/docs/demo.md b/docs/demo.md index 6c74d67..2a09fd6 100644 --- a/docs/demo.md +++ b/docs/demo.md @@ -416,7 +416,7 @@ use_host_network: "host" # Set local host URL for dgraph server - dgraph_domain: "http://localhost:8080" + dgraph_domain: "http://localhost:8090" ``` - Set envs: diff --git a/playbooks/cosmos-multisig-app/README.md b/playbooks/cosmos-multisig-app/README.md index 47a73a7..3b4aafe 100644 --- a/playbooks/cosmos-multisig-app/README.md +++ b/playbooks/cosmos-multisig-app/README.md @@ -23,30 +23,56 @@ This playbook sets up the Cosmos Multisig application for managing multisig wall 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 `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 # TODO: Update with example domains mapped to ports - next_public_node_addresses: - node_rest_endpoint: + next_public_node_addresses: '["https://laconicd-mainnet.laconic.com"]' + node_rest_endpoint: "https://api.laconicd-mainnet.laconic.com" ``` ## Setup Steps -* Set environment variables: +* Set common environment variables: ```bash - export CWD=$(pwd) - export DATA_DIRECTORY=$CWD + # Parent directory where the deployment directory will live + export DATA_DIRECTORY= export MULTISIG_DEPLOYMENT_DIR=cosmos-multisig-deployment - export NETWORK_JSON_PATH=~/cerc/laconicd-stack/config/network.json ``` +### Local Setup + * Setup and start the multisig app: ```bash - ansible-playbook -v -i localhost, -c local ~/cerc/laconicd-stack/playbooks/cosmos-multisig-app/cosmos-multisig-app-start.yml + ansible-playbook -v -i hosts.ini ~/cerc/laconicd-stack/playbooks/cosmos-multisig-app/cosmos-multisig-app-start.yml --limit local ``` * Access the app at +### Remote Setup + +* Create and configure hosts.ini: + * Copy the example file: + ```bash + cp ~/cerc/laconicd-stack/playbooks/hosts.ini.example ~/cerc/laconicd-stack/playbooks/cosmos-multisig-app/hosts.ini + ``` + * Edit `~/cerc/laconicd-stack/playbooks/cosmos-multisig-app/hosts.ini` and update the remote host details: + ```ini + [remote] + # 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' + ``` + * Verify SSH connection using Ansible ping: + ```bash + ansible all -m ping -i ~/cerc/laconicd-stack/playbooks/cosmos-multisig-app/hosts.ini --limit remote_host + ``` + +* Run the playbook targeting the remote host: + ```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 + ``` + +* Access the app at + ## Check Status * Check app logs: diff --git a/playbooks/cosmos-multisig-app/cosmos-multisig-app-start.yml b/playbooks/cosmos-multisig-app/cosmos-multisig-app-start.yml index 9e734ab..013a042 100644 --- a/playbooks/cosmos-multisig-app/cosmos-multisig-app-start.yml +++ b/playbooks/cosmos-multisig-app/cosmos-multisig-app-start.yml @@ -1,6 +1,6 @@ --- - name: Setup and deploy the cosmos multisig app - hosts: localhost + hosts: multihosts vars_files: - cosmos-multisig-vars.yml vars: @@ -8,8 +8,9 @@ multisig_deployment_dir: "{{ lookup('env', 'MULTISIG_DEPLOYMENT_DIR') }}" spec_output: "{{data_directory}}/cosmos-multisig-ui-spec.yml" spec_template: "./templates/specs/cosmos-multisig-app-spec-template.yml.j2" + remote_spec_template: "{{data_directory}}/cosmos-multisig-app-spec-template.yml.j2" network_json: "../../config/network.json" - temp_network_json: "{{data_directory}}/temp_network.json" + remote_network_json: "{{data_directory}}/network.json" tasks: - name: Fail if DATA_DIRECTORY env var is not set fail: @@ -28,13 +29,25 @@ shell: | laconic-so --stack ~/cerc/cosmos-multisig-ui/stack-orchestrator/stacks/cosmos-multisig-ui deploy init --output {{ spec_output }} + - name: Copy spec template to remote server + copy: + src: "{{ spec_template }}" + dest: "{{ remote_spec_template }}" + mode: '0644' + - name: Replace network section in spec_output shell: > - yq eval '(.network) = load("{{ spec_template }}").network' -i {{ spec_output }} + yq eval '(.network) = load("{{ remote_spec_template }}").network' -i {{ spec_output }} + + - name: Check if deployment directory exists + stat: + path: "{{data_directory}}/{{ multisig_deployment_dir }}" + register: deployment_dir_stat - name: Create deployment from spec file shell: | laconic-so --stack ~/cerc/cosmos-multisig-ui/stack-orchestrator/stacks/cosmos-multisig-ui/ deploy create --spec-file {{ spec_output }} --deployment-dir {{data_directory}}/{{ multisig_deployment_dir }} + when: not deployment_dir_stat.stat.exists - name: Create config.env in deployment dir copy: @@ -59,26 +72,38 @@ CHAIN_CONFIG_PATH="{{data_directory}}/{{ multisig_deployment_dir }}/config/cosmos-multisig-ui/network.json" mode: '0644' + - name: Copy network.json to remote server + copy: + src: "{{ network_json }}" + dest: "{{ remote_network_json }}" + mode: '0644' + - name: Update network.json with environment endpoints shell: | RPC_VALUE=$(echo '{{ next_public_node_addresses }}' | jq -r '.[0]') echo "Using RPC value: $RPC_VALUE" jq --arg rpc "$RPC_VALUE" --arg rest "{{ node_rest_endpoint }}" \ - '.rpc = $rpc | .rest = $rest' "{{ network_json }}" > "{{ temp_network_json }}" + --arg chainId "{{ next_public_chain_id }}" --arg chainName "{{ next_public_chain_display_name }}" \ + '.rpc = $rpc | .rest = $rest | .chainId = $chainId | .chainName = $chainName' "{{ remote_network_json }}" > "{{ remote_network_json }}.tmp" && \ + mv "{{ remote_network_json }}.tmp" "{{ remote_network_json }}" args: executable: /bin/bash - name: Copy modified network JSON to deployment config directory copy: - src: "{{ temp_network_json }}" + src: "{{ remote_network_json }}" dest: "{{data_directory}}/{{ multisig_deployment_dir }}/config/cosmos-multisig-ui/network.json" + remote_src: true mode: '0644' - - name: Clean up temporary network.json + - name: Clean up temporary files file: - path: "{{ temp_network_json }}" + path: "{{ item }}" state: absent + with_items: + - "{{ remote_spec_template }}" + - "{{ remote_network_json }}" - name: Start the deployment shell: | diff --git a/playbooks/cosmos-multisig-app/cosmos-multisig-vars.example.yml b/playbooks/cosmos-multisig-app/cosmos-multisig-vars.example.yml index 3529142..81d72e8 100644 --- a/playbooks/cosmos-multisig-app/cosmos-multisig-vars.example.yml +++ b/playbooks/cosmos-multisig-app/cosmos-multisig-vars.example.yml @@ -3,13 +3,13 @@ next_public_registry_name: "laconic" next_public_logo: "" next_public_chain_id: "laconic-mainnet" next_public_chain_display_name: "Laconic Mainnet" -next_public_node_addresses: "" +next_public_node_addresses: '[]' node_rest_endpoint: "" next_public_denom: "alnt" next_public_display_denom: "ALNT" next_public_display_denom_exponent: 18 -next_public_assets: '[{"denom_units":[{"denom":"alnt","exponent":0},{"denom":"alnt","exponent":6}],"base":"alnt","name":"Laconic Token","display":"ALNT","symbol":"alnt"}]' -next_public_gas_price: "0.01alnt" +next_public_assets: '[{"denom_units":[{"denom":"alnt","exponent":0},{"denom":"lnt","exponent":18}],"base":"alnt","name":"Laconic Token","display":"ALNT","symbol":"alnt"}]' +next_public_gas_price: "0.001alnt" next_public_address_prefix: "laconic" next_public_is_http_enabled: false use_host_network: "" diff --git a/playbooks/cosmos-multisig-app/templates/specs/cosmos-multisig-app-spec-template.yml.j2 b/playbooks/cosmos-multisig-app/templates/specs/cosmos-multisig-app-spec-template.yml.j2 index 7fcbac8..15619ef 100644 --- a/playbooks/cosmos-multisig-app/templates/specs/cosmos-multisig-app-spec-template.yml.j2 +++ b/playbooks/cosmos-multisig-app/templates/specs/cosmos-multisig-app-spec-template.yml.j2 @@ -3,4 +3,4 @@ network: cosmos-multisig-ui: - 7000:7000 alpha: - - 8080:8080 + - 8090:8080 diff --git a/playbooks/hosts.ini.example b/playbooks/hosts.ini.example new file mode 100644 index 0000000..e1d7ce2 --- /dev/null +++ b/playbooks/hosts.ini.example @@ -0,0 +1,10 @@ +[local] +localhost ansible_connection=local + +[remote] +# Replace these values 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' + +[multihosts:children] +local +remote \ No newline at end of file -- 2.45.2 From 1512139426e24673fbb8eb285644259081c6d735 Mon Sep 17 00:00:00 2001 From: Nabarun Date: Wed, 11 Jun 2025 19:48:48 +0530 Subject: [PATCH 2/2] Set user bin path for yq tool in remote machine setup --- playbooks/cosmos-multisig-app/README.md | 9 +++++---- .../cosmos-multisig-app/cosmos-multisig-app-start.yml | 8 +++++++- .../cosmos-multisig-app/cosmos-multisig-vars.example.yml | 2 +- 3 files changed, 13 insertions(+), 6 deletions(-) diff --git a/playbooks/cosmos-multisig-app/README.md b/playbooks/cosmos-multisig-app/README.md index 3b4aafe..ad3c19b 100644 --- a/playbooks/cosmos-multisig-app/README.md +++ b/playbooks/cosmos-multisig-app/README.md @@ -4,10 +4,11 @@ This playbook sets up the Cosmos Multisig application for managing multisig wall ## Prerequisites +- [Mainnet node RPC and REST API endpoints](../../docs/run-first-validator.md) - [ansible](../README.md#ansible-installation) -- [laconic-so](https://github.com/cerc-io/stack-orchestrator/?tab=readme-ov-file#install) -- [Running Laconic validator node](../../docs/run-validator.md) -- Keplr wallet extension installed in browser +- If running playbook to setup deployment on remote machine, the following need to be installed in remote: + - [laconic-so](https://github.com/cerc-io/stack-orchestrator/?tab=readme-ov-file#install) + - [yq](https://github.com/mikefarah/yq?tab=readme-ov-file#wget) ## Configuration @@ -77,7 +78,7 @@ This playbook sets up the Cosmos Multisig application for managing multisig wall * Check app logs: ```bash - laconic-so deployment --dir $DATA_DIRECTORY/$MULTISIG_DEPLOYMENT_DIR logs -f + laconic-so deployment --dir $DATA_DIRECTORY/$MULTISIG_DEPLOYMENT_DIR logs -f cosmos-multisig-ui ``` ## Clean up diff --git a/playbooks/cosmos-multisig-app/cosmos-multisig-app-start.yml b/playbooks/cosmos-multisig-app/cosmos-multisig-app-start.yml index 013a042..9a81bf6 100644 --- a/playbooks/cosmos-multisig-app/cosmos-multisig-app-start.yml +++ b/playbooks/cosmos-multisig-app/cosmos-multisig-app-start.yml @@ -1,6 +1,11 @@ --- - name: Setup and deploy the cosmos multisig app hosts: multihosts + + # To use yq binary installed in user bin path + environment: + PATH: "{{ ansible_env.PATH }}:/home/{{ansible_user}}/bin" + vars_files: - cosmos-multisig-vars.yml vars: @@ -11,6 +16,7 @@ remote_spec_template: "{{data_directory}}/cosmos-multisig-app-spec-template.yml.j2" network_json: "../../config/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 '' }}" tasks: - name: Fail if DATA_DIRECTORY env var is not set fail: @@ -23,7 +29,7 @@ - name: Build container image shell: | - laconic-so --stack ~/cerc/cosmos-multisig-ui/stack-orchestrator/stacks/cosmos-multisig-ui build-containers + laconic-so --stack ~/cerc/cosmos-multisig-ui/stack-orchestrator/stacks/cosmos-multisig-ui build-containers {{ build_args }} - name: Create deployment spec file shell: | diff --git a/playbooks/cosmos-multisig-app/cosmos-multisig-vars.example.yml b/playbooks/cosmos-multisig-app/cosmos-multisig-vars.example.yml index 81d72e8..4467c24 100644 --- a/playbooks/cosmos-multisig-app/cosmos-multisig-vars.example.yml +++ b/playbooks/cosmos-multisig-app/cosmos-multisig-vars.example.yml @@ -8,7 +8,7 @@ node_rest_endpoint: "" next_public_denom: "alnt" next_public_display_denom: "ALNT" next_public_display_denom_exponent: 18 -next_public_assets: '[{"denom_units":[{"denom":"alnt","exponent":0},{"denom":"lnt","exponent":18}],"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"}]' next_public_gas_price: "0.001alnt" next_public_address_prefix: "laconic" next_public_is_http_enabled: false -- 2.45.2