Update multisig playbook to setup deployment on remote machine #15
@ -18,25 +18,25 @@
|
|||||||
{
|
{
|
||||||
"coinDenom": "ALNT",
|
"coinDenom": "ALNT",
|
||||||
"coinMinimalDenom": "alnt",
|
"coinMinimalDenom": "alnt",
|
||||||
"coinDecimals": 18
|
"coinDecimals": 0
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"feeCurrencies": [
|
"feeCurrencies": [
|
||||||
{
|
{
|
||||||
"coinDenom": "ALNT",
|
"coinDenom": "ALNT",
|
||||||
"coinMinimalDenom": "alnt",
|
"coinMinimalDenom": "alnt",
|
||||||
"coinDecimals": 18,
|
"coinDecimals": 0,
|
||||||
"gasPriceStep": {
|
"gasPriceStep": {
|
||||||
"low": 0.01,
|
"low": 0.001,
|
||||||
"average": 0.01,
|
"average": 0.001,
|
||||||
"high": 0.02
|
"high": 0.002
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"stakeCurrency": {
|
"stakeCurrency": {
|
||||||
"coinDenom": "ALNT",
|
"coinDenom": "ALNT",
|
||||||
"coinMinimalDenom": "alnt",
|
"coinMinimalDenom": "alnt",
|
||||||
"coinDecimals": 18
|
"coinDecimals": 0
|
||||||
},
|
},
|
||||||
"features": [
|
"features": [
|
||||||
"stargate",
|
"stargate",
|
||||||
|
@ -416,7 +416,7 @@
|
|||||||
use_host_network: "host"
|
use_host_network: "host"
|
||||||
|
|
||||||
# Set local host URL for dgraph server
|
# Set local host URL for dgraph server
|
||||||
dgraph_domain: "http://localhost:8080"
|
dgraph_domain: "http://localhost:8090"
|
||||||
```
|
```
|
||||||
|
|
||||||
- Set envs:
|
- Set envs:
|
||||||
|
@ -4,10 +4,11 @@ This playbook sets up the Cosmos Multisig application for managing multisig wall
|
|||||||
|
|
||||||
## Prerequisites
|
## Prerequisites
|
||||||
|
|
||||||
|
- [Mainnet node RPC and REST API endpoints](../../docs/run-first-validator.md)
|
||||||
- [ansible](../README.md#ansible-installation)
|
- [ansible](../README.md#ansible-installation)
|
||||||
|
- 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)
|
- [laconic-so](https://github.com/cerc-io/stack-orchestrator/?tab=readme-ov-file#install)
|
||||||
- [Running Laconic validator node](../../docs/run-validator.md)
|
- [yq](https://github.com/mikefarah/yq?tab=readme-ov-file#wget)
|
||||||
- Keplr wallet extension installed in browser
|
|
||||||
|
|
||||||
## Configuration
|
## Configuration
|
||||||
|
|
||||||
@ -23,35 +24,61 @@ 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
|
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
|
```yaml
|
||||||
# TODO: Update with example domains mapped to ports
|
# TODO: Update with example domains mapped to ports
|
||||||
next_public_node_addresses:
|
next_public_node_addresses: '["https://laconicd-mainnet.laconic.com"]'
|
||||||
node_rest_endpoint:
|
node_rest_endpoint: "https://api.laconicd-mainnet.laconic.com"
|
||||||
```
|
```
|
||||||
|
|
||||||
## Setup Steps
|
## Setup Steps
|
||||||
|
|
||||||
* Set environment variables:
|
* Set common environment variables:
|
||||||
```bash
|
```bash
|
||||||
export CWD=$(pwd)
|
# Parent directory where the deployment directory will live
|
||||||
export DATA_DIRECTORY=$CWD
|
export DATA_DIRECTORY=<path/to/deployments/directory>
|
||||||
export MULTISIG_DEPLOYMENT_DIR=cosmos-multisig-deployment
|
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:
|
* Setup and start the multisig app:
|
||||||
```bash
|
```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 <http://localhost:7000/laconic>
|
* Access the app at <http://localhost:7000/laconic>
|
||||||
|
|
||||||
|
### 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 <http://your.remote.host:7000/laconic>
|
||||||
|
|
||||||
## Check Status
|
## Check Status
|
||||||
|
|
||||||
* Check app logs:
|
* Check app logs:
|
||||||
```bash
|
```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
|
## Clean up
|
||||||
|
@ -1,6 +1,11 @@
|
|||||||
---
|
---
|
||||||
- name: Setup and deploy the cosmos multisig app
|
- name: Setup and deploy the cosmos multisig app
|
||||||
hosts: localhost
|
hosts: multihosts
|
||||||
|
|
||||||
|
# To use yq binary installed in user bin path
|
||||||
|
environment:
|
||||||
|
PATH: "{{ ansible_env.PATH }}:/home/{{ansible_user}}/bin"
|
||||||
|
|
||||||
vars_files:
|
vars_files:
|
||||||
- cosmos-multisig-vars.yml
|
- cosmos-multisig-vars.yml
|
||||||
vars:
|
vars:
|
||||||
@ -8,8 +13,10 @@
|
|||||||
multisig_deployment_dir: "{{ lookup('env', 'MULTISIG_DEPLOYMENT_DIR') }}"
|
multisig_deployment_dir: "{{ lookup('env', 'MULTISIG_DEPLOYMENT_DIR') }}"
|
||||||
spec_output: "{{data_directory}}/cosmos-multisig-ui-spec.yml"
|
spec_output: "{{data_directory}}/cosmos-multisig-ui-spec.yml"
|
||||||
spec_template: "./templates/specs/cosmos-multisig-app-spec-template.yml.j2"
|
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"
|
network_json: "../../config/network.json"
|
||||||
temp_network_json: "{{data_directory}}/temp_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:
|
tasks:
|
||||||
- name: Fail if DATA_DIRECTORY env var is not set
|
- name: Fail if DATA_DIRECTORY env var is not set
|
||||||
fail:
|
fail:
|
||||||
@ -22,19 +29,31 @@
|
|||||||
|
|
||||||
- name: Build container image
|
- name: Build container image
|
||||||
shell: |
|
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
|
- name: Create deployment spec file
|
||||||
shell: |
|
shell: |
|
||||||
laconic-so --stack ~/cerc/cosmos-multisig-ui/stack-orchestrator/stacks/cosmos-multisig-ui deploy init --output {{ spec_output }}
|
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
|
- name: Replace network section in spec_output
|
||||||
shell: >
|
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
|
- name: Create deployment from spec file
|
||||||
shell: |
|
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 }}
|
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
|
- name: Create config.env in deployment dir
|
||||||
copy:
|
copy:
|
||||||
@ -59,26 +78,38 @@
|
|||||||
CHAIN_CONFIG_PATH="{{data_directory}}/{{ multisig_deployment_dir }}/config/cosmos-multisig-ui/network.json"
|
CHAIN_CONFIG_PATH="{{data_directory}}/{{ multisig_deployment_dir }}/config/cosmos-multisig-ui/network.json"
|
||||||
mode: '0644'
|
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
|
- name: Update network.json with environment endpoints
|
||||||
shell: |
|
shell: |
|
||||||
RPC_VALUE=$(echo '{{ next_public_node_addresses }}' | jq -r '.[0]')
|
RPC_VALUE=$(echo '{{ next_public_node_addresses }}' | jq -r '.[0]')
|
||||||
echo "Using RPC value: $RPC_VALUE"
|
echo "Using RPC value: $RPC_VALUE"
|
||||||
|
|
||||||
jq --arg rpc "$RPC_VALUE" --arg rest "{{ node_rest_endpoint }}" \
|
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:
|
args:
|
||||||
executable: /bin/bash
|
executable: /bin/bash
|
||||||
|
|
||||||
- name: Copy modified network JSON to deployment config directory
|
- name: Copy modified network JSON to deployment config directory
|
||||||
copy:
|
copy:
|
||||||
src: "{{ temp_network_json }}"
|
src: "{{ remote_network_json }}"
|
||||||
dest: "{{data_directory}}/{{ multisig_deployment_dir }}/config/cosmos-multisig-ui/network.json"
|
dest: "{{data_directory}}/{{ multisig_deployment_dir }}/config/cosmos-multisig-ui/network.json"
|
||||||
|
remote_src: true
|
||||||
mode: '0644'
|
mode: '0644'
|
||||||
|
|
||||||
- name: Clean up temporary network.json
|
- name: Clean up temporary files
|
||||||
file:
|
file:
|
||||||
path: "{{ temp_network_json }}"
|
path: "{{ item }}"
|
||||||
state: absent
|
state: absent
|
||||||
|
with_items:
|
||||||
|
- "{{ remote_spec_template }}"
|
||||||
|
- "{{ remote_network_json }}"
|
||||||
|
|
||||||
- name: Start the deployment
|
- name: Start the deployment
|
||||||
shell: |
|
shell: |
|
||||||
|
@ -3,13 +3,13 @@ next_public_registry_name: "laconic"
|
|||||||
next_public_logo: ""
|
next_public_logo: ""
|
||||||
next_public_chain_id: "laconic-mainnet"
|
next_public_chain_id: "laconic-mainnet"
|
||||||
next_public_chain_display_name: "Laconic Mainnet"
|
next_public_chain_display_name: "Laconic Mainnet"
|
||||||
next_public_node_addresses: ""
|
next_public_node_addresses: '[]'
|
||||||
node_rest_endpoint: ""
|
node_rest_endpoint: ""
|
||||||
next_public_denom: "alnt"
|
next_public_denom: "alnt"
|
||||||
next_public_display_denom: "ALNT"
|
next_public_display_denom: "ALNT"
|
||||||
next_public_display_denom_exponent: 18
|
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_assets: '[{"denom_units":[{"denom":"alnt","exponent":0}],"base":"alnt","name":"Laconic Token","display":"ALNT","symbol":"alnt"}]'
|
||||||
next_public_gas_price: "0.01alnt"
|
next_public_gas_price: "0.001alnt"
|
||||||
next_public_address_prefix: "laconic"
|
next_public_address_prefix: "laconic"
|
||||||
next_public_is_http_enabled: false
|
next_public_is_http_enabled: false
|
||||||
use_host_network: ""
|
use_host_network: ""
|
||||||
|
@ -3,4 +3,4 @@ network:
|
|||||||
cosmos-multisig-ui:
|
cosmos-multisig-ui:
|
||||||
- 7000:7000
|
- 7000:7000
|
||||||
alpha:
|
alpha:
|
||||||
- 8080:8080
|
- 8090:8080
|
||||||
|
10
playbooks/hosts.ini.example
Normal file
10
playbooks/hosts.ini.example
Normal file
@ -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
|
Loading…
Reference in New Issue
Block a user