Skip to content

Commit

Permalink
deploy the first hermes playbook
Browse files Browse the repository at this point in the history
  • Loading branch information
PolkachuIntern committed Sep 14, 2022
1 parent 48504c3 commit 78abdde
Show file tree
Hide file tree
Showing 12 changed files with 252 additions and 0 deletions.
3 changes: 3 additions & 0 deletions group_vars/all.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,6 @@ hermes_version: '1.0.0'

# rly
rly_version: '2.0.0'

# Relay Memo
memo: 'Relayed by Polkachu'
2 changes: 2 additions & 0 deletions group_vars/injective.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
rest_port: 3004
telemetry_port: 4004
8 changes: 8 additions & 0 deletions main_hermes_config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
- name: Main
hosts: 'relayer'
gather_facts: false
vars_files:
- 'group_vars/{{ target }}.yml'
roles:
- hermes_config
33 changes: 33 additions & 0 deletions roles/hermes_config/tasks/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
---
- name: Copy hermes config script
template:
src: 'configs/{{ target }}.toml.j2'
dest: '/home/{{ ansible_user }}/.hermes/{{ target }}.toml'
owner: '{{ ansible_user }}'
group: '{{ ansible_user }}'
mode: '0644'

- name: create hermes systemd unit
become: true
template:
src: 'hermes.service.j2'
dest: '/etc/systemd/system/hermes_{{ target }}.service'
owner: root
group: root
mode: '600'

- name: Open hermes telemetry port
become: true
ufw:
rule: allow
proto: tcp
port: '{{ telemetry_port }}'

- name: start hermes service
become: true
systemd:
name: 'hermes_{{ target }}'
state: restarted
daemon_reload: yes
enabled: yes
changed_when: false
45 changes: 45 additions & 0 deletions roles/hermes_config/templates/configs/injective.toml.j2
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
{% include 'fragments/header.toml.j2' %}


{% include 'fragments/injective.toml.j2' %}

[chains.packet_filter]
policy = 'allow'
list = [
['transfer', 'channel-8'], # Osmosis
['transfer', 'channel-76'], # Chihuahua
['transfer', 'channel-83'], # Evmos
['transfer', 'channel-1'], # Cosmos
]

{% include 'fragments/osmosis.toml.j2' %}

[chains.packet_filter]
policy = 'allow'
list = [
['transfer', 'channel-122'], # Injective
]

{% include 'fragments/chihuahua.toml.j2' %}

[chains.packet_filter]
policy = 'allow'
list = [
['transfer', 'channel-12'], # Injective
]

{% include 'fragments/cosmos.toml.j2' %}

[chains.packet_filter]
policy = 'allow'
list = [
['transfer', 'channel-220'], # Injective
]

{% include 'fragments/evmos.toml.j2' %}

[chains.packet_filter]
policy = 'allow'
list = [
['transfer', 'channel-10'], # Injective
]
22 changes: 22 additions & 0 deletions roles/hermes_config/templates/fragments/chihuahua.toml.j2
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
[[chains]]
id = 'chihuahua-1'
rpc_addr = 'http://{{ relayer2_ip }}:12957'
grpc_addr = 'http://{{ relayer2_ip }}:12990'
websocket_addr = 'ws://{{ relayer2_ip }}:12957/websocket'

rpc_timeout = '20s'
account_prefix = 'chihuahua'
key_name = 'relayer'
address_type = { derivation = 'cosmos' }
store_prefix = 'ibc'
default_gas = 100000
max_gas = 3500000
gas_price = { price = 0.05, denom = 'uhuahua' }
gas_multiplier = 1.2
max_msg_num = 30
max_tx_size = 1800000
clock_drift = '10s'
max_block_time = '10s'
trusting_period = '7days'
memo_prefix = '{{ memo }}'
trust_threshold = { numerator = '1', denominator = '3' }
22 changes: 22 additions & 0 deletions roles/hermes_config/templates/fragments/cosmos.toml.j2
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
[[chains]]
id = 'cosmoshub-4'
rpc_addr = 'http://{{ relayer3_ip }}:14957'
grpc_addr = 'http://{{ relayer3_ip }}:14990'
websocket_addr = 'ws://{{ relayer3_ip }}:14957/websocket'

rpc_timeout = '20s'
account_prefix = 'cosmos'
key_name = 'relayer'
address_type = { derivation = 'cosmos' }
store_prefix = 'ibc'
default_gas = 150000
max_gas = 3500000
gas_price = { price = 0.0025, denom = 'uatom' }
gas_multiplier = 1.2
max_msg_num = 30
max_tx_size = 1800000
clock_drift = '10s'
max_block_time = '10s'
trusting_period = '7days'
memo_prefix = '{{ memo }}'
trust_threshold = { numerator = '1', denominator = '3' }
22 changes: 22 additions & 0 deletions roles/hermes_config/templates/fragments/evmos.toml.j2
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
[[chains]]
id = 'evmos_9001-2'
rpc_addr = 'http://{{ relayer3_ip }}:13457'
grpc_addr = 'http://{{ relayer3_ip }}:13490'
websocket_addr = 'ws://{{ relayer3_ip }}:13457/websocket'

rpc_timeout = '20s'
account_prefix = 'evmos'
key_name = 'relayer'
store_prefix = 'ibc'
address_type = { derivation = 'ethermint', proto_type = { pk_type = '/ethermint.crypto.v1.ethsecp256k1.PubKey' } }
default_gas = 1000000
max_gas = 4000000
gas_price = { price = 20000000000, denom = 'aevmos' }
gas_multiplier = 1.2
max_msg_num = 15
max_tx_size = 180000
clock_drift = '15s'
max_block_time = '10s'
trusting_period = '7days'
memo_prefix = '{{ memo }}'
trust_threshold = { numerator = '1', denominator = '3'}
39 changes: 39 additions & 0 deletions roles/hermes_config/templates/fragments/header.toml.j2
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# The global section has parameters that apply globally to the relayer operation.
[global]
log_level = 'info'

# Specify the mode to be used by the relayer. [Required]
[mode]

# Specify the client mode.
[mode.clients]
enabled = false
refresh = true
misbehaviour = false

# Specify the connections mode.
[mode.connections]
enabled = false

# Specify the channels mode.
[mode.channels]
enabled = false

# Specify the packets mode.
[mode.packets]
enabled = true
clear_interval = 200
clear_on_start = true
tx_confirmation = true

# The REST section defines parameters for Hermes' built-in RESTful API.
# https://hermes.informal.systems/rest.html
[rest]
enabled = true
host = '0.0.0.0'
port = {{ rest_port }}

[telemetry]
enabled = true
host = '0.0.0.0'
port = {{ telemetry_port }}
22 changes: 22 additions & 0 deletions roles/hermes_config/templates/fragments/injective.toml.j2
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
[[chains]]
id = 'injective-1'
rpc_addr = 'http://{{ relayer4_ip }}:14357'
grpc_addr = 'http://{{ relayer4_ip }}:14390'
websocket_addr = 'ws://{{ relayer4_ip }}:14357/websocket'

rpc_timeout = '20s'
account_prefix = 'inj'
key_name = 'relayer'
address_type = { derivation = 'ethermint', proto_type = { pk_type = '/injective.crypto.v1beta1.ethsecp256k1.PubKey' } }
store_prefix = 'ibc'
default_gas = 100000
max_gas = 5000000
gas_price = { price = 500000000, denom = 'inj' }
gas_multiplier = 1.2
max_msg_num = 30
max_tx_size = 1800000
clock_drift = '15s'
max_block_time = '10s'
trusting_period = '7days'
memo_prefix = '{{ memo }}'
trust_threshold = { numerator = '1', denominator = '3' }
22 changes: 22 additions & 0 deletions roles/hermes_config/templates/fragments/osmosis.toml.j2
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
[[chains]]
id = 'osmosis-1'
rpc_addr = 'http://{{ relayer2_ip }}:12557'
grpc_addr = 'http://{{ relayer2_ip }}:12590'
websocket_addr = 'ws://{{ relayer2_ip }}:12557/websocket'

rpc_timeout = '20s'
account_prefix = 'osmo'
key_name = 'relayer'
address_type = { derivation = 'cosmos' }
store_prefix = 'ibc'
default_gas = 300000
max_gas = 3500000
gas_price = { price = 0.000, denom = 'uosmo' }
gas_multiplier = 1.2
max_msg_num = 30
max_tx_size = 1800000
clock_drift = '15s'
max_block_time = '10s'
trusting_period = '7days'
memo_prefix = '{{ memo }}'
trust_threshold = { numerator = '1', denominator = '3' }
12 changes: 12 additions & 0 deletions roles/hermes_config/templates/hermes.service.j2
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
Description=Hermes IBC relayer for {{ target }}
After=network.target

[Service]
Type=simple
User={{ ansible_user }}
ExecStart=/usr/local/bin/hermes --config /home/ubuntu/.hermes/{{ target }}.toml start
Restart=always
RestartSec=5

[Install]
WantedBy=multi-user.target

0 comments on commit 78abdde

Please sign in to comment.