Update multisig playbook to setup deployment on remote machine
This commit is contained in:
parent
edee217050
commit
f7d1a8d6ed
@ -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",
|
||||
|
@ -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:
|
||||
|
@ -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=<path/to/deployments/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 <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 app logs:
|
||||
|
@ -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: |
|
||||
|
@ -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: ""
|
||||
|
@ -3,4 +3,4 @@ network:
|
||||
cosmos-multisig-ui:
|
||||
- 7000:7000
|
||||
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