Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature] External Relay Chain Support #39

Merged
merged 6 commits into from
Jul 13, 2023
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions roles/node/defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,10 @@ node_parachain_chainspec: ""
# It has to be a link to wasm runtime. It will be used by the "--wasm-runtime-overrides" CLI flag
node_parachain_wasm_runtime: ""

### Experimental Feature
# Remote Relay Chain via RPC
node_parachain_relay_chain_rpc_urls: [""]
lazam marked this conversation as resolved.
Show resolved Hide resolved

### Keys
## p2p key
# If it's empty, the node will generate default key file
Expand Down
4 changes: 2 additions & 2 deletions roles/node/tasks/001-health-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

- name: Health check | Run health check
ansible.builtin.uri:
url: "http://127.0.0.1:{{ node_rpc_port }}"
url: "http://127.0.0.1:{{ (node_parachain_relay_chain_rpc_urls | length > 0) | ternary(node_parachain_rpc_port, node_rpc_port) }}"
lazam marked this conversation as resolved.
Show resolved Hide resolved
method: "POST"
body_format: "json"
body:
Expand All @@ -46,7 +46,7 @@

- name: Health check | Check the current version using API
ansible.builtin.uri:
url: "http://127.0.0.1:{{ node_rpc_port }}"
url: "http://127.0.0.1:{{ (node_parachain_relay_chain_rpc_urls | length > 0) | ternary(node_parachain_rpc_port, node_rpc_port) }}"
method: "POST"
body_format: "json"
body:
Expand Down
5 changes: 4 additions & 1 deletion roles/node/tasks/100-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,10 @@
- name: Test | Check node_chain
ansible.builtin.fail:
msg: "The 'node_chain' variable can't be empty!"
when: node_chain == '' and node_chainspec == ''
when:
- node_chain == ''
- node_chainspec == ''
- node_parachain_relay_chain_rpc_urls == ''
lazam marked this conversation as resolved.
Show resolved Hide resolved

- name: Test | Check node_parachain_chain
ansible.builtin.fail:
Expand Down
8 changes: 8 additions & 0 deletions roles/node/templates/env.j2
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ COMMON="\
--detailed-log-output
{%- endif %}"

{% if node_parachain_relay_chain_rpc_urls == '' %}
lazam marked this conversation as resolved.
Show resolved Hide resolved
RC_NAME="{% if node_parachain_has_name_fix %}--name {{ node_public_name }}{% endif %}"

RC_KEY="
Expand Down Expand Up @@ -99,6 +100,7 @@ RC_CUSTOM_OPTIONS="\
{{ option }}{% if not loop.last %} \
{% endif %}
{%- endfor %}"
{%- endif %}

{% if node_log_trace_enable or node_parachain_log_trace_enable %}
RUST_BACKTRACE=1
Expand Down Expand Up @@ -135,6 +137,12 @@ PC_CHAIN="
--chain {{ node_parachain_chain }}
{%- endif %}"

PC_REMOTE_RC_URLS="
{%- if node_parachain_relay_chain_rpc_urls != '' %}
lazam marked this conversation as resolved.
Show resolved Hide resolved
--relay-chain-rpc-urls {% for url in node_parachain_relay_chain_rpc_urls %}'{{ url }}'{% if not loop.last %} {% endif %}{% endfor %}
{%- endif %}"


PC_ADDR="\
--listen-addr=/ip4/{{ node_parachain_p2p_bind_addr }}/tcp/{{ node_parachain_p2p_port }}
{%- if node_enable_public_ip_detection %} \
Expand Down
6 changes: 5 additions & 1 deletion roles/node/templates/node.service.j2
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,15 @@ MemoryHigh={{ node_memory_high }}
MemoryMax={{ node_memory_max }}
ExecStart={{ _node_binary_file }} \
$COMMON \
{% if node_parachain_role != '' %}
{% if node_parachain_role != '' and node_parachain_relay_chain_rpc_urls != '' %}
lazam marked this conversation as resolved.
Show resolved Hide resolved
$PC_NAME $PC_ROLE_SPECIFIC $PC_KEY $PC_CHAIN $PC_REMOTE_RC_URLS $PC_ADDR $PC_CONNECTIONS $PC_DB $PC_TELEMETRY $PC_PRUNING $PC_LOGS $PC_METRICS $PC_WS $PC_RPC $PC_WASM_RUNTIME $PC_CUSTOM_OPTIONS
{% elif node_parachain_role != '' %}
$PC_NAME $PC_ROLE_SPECIFIC $PC_KEY $PC_CHAIN $PC_ADDR $PC_CONNECTIONS $PC_DB $PC_TELEMETRY $PC_PRUNING $PC_LOGS $PC_METRICS $PC_WS $PC_RPC $PC_WASM_RUNTIME $PC_CUSTOM_OPTIONS \
-- \
{% endif %}
{% if node_parachain_relay_chain_rpc_urls == '' %}
lazam marked this conversation as resolved.
Show resolved Hide resolved
$RC_NAME $RC_ROLE_SPECIFIC $RC_KEY $RC_CHAIN $RC_ADDR $RC_CONNECTIONS $RC_DB $RC_TELEMETRY $RC_PRUNING $RC_LOGS $RC_METRICS $RC_WS $RC_RPC $RC_WASM_RUNTIME $RC_CUSTOM_OPTIONS
{% endif %}

{% if node_syslog_labels != '' %}
SyslogIdentifier={{ node_syslog_labels }}
Expand Down