-
Notifications
You must be signed in to change notification settings - Fork 9
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
docker: drop RPC flag and add REST API flags #25
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,44 +1,38 @@ | ||
--- | ||
- name: 'Wait for RPC port to be available' | ||
- name: 'Wait for REST port to be available' | ||
wait_for: | ||
port: '{{ nim_waku_rpc_tcp_port }}' | ||
port: '{{ nim_waku_rest_port }}' | ||
delay: 5 | ||
|
||
- name: 'Extract address of the node for Consul' | ||
uri: | ||
url: 'http://localhost:{{ nim_waku_rpc_tcp_port }}/' | ||
method: POST | ||
body: | ||
method: 'get_waku_v2_debug_v1_info' | ||
params: [] | ||
jsonrpc: '2.0' | ||
id: 1 | ||
url: 'http://localhost:{{ nim_waku_rest_port }}/debug/v1/info' | ||
status_code: 200 | ||
body_format: json | ||
register: waku_info | ||
ignore_errors: true | ||
|
||
- name: Verify we got the node address | ||
assert: | ||
that: 'waku_info.json.result.listenAddresses is defined' | ||
that: 'waku_info.json.listenAddresses is defined' | ||
fail_msg: 'Did not receive Nim-Waku node address!' | ||
quiet: true | ||
|
||
- name: Extract LibP2P TCP address from list | ||
set_fact: | ||
nim_waku_libp2p_enr_uri: |- | ||
{{ waku_info.json.result.enrUri }} | ||
{{ waku_info.json.enrUri }} | ||
nim_waku_libp2p_multiaddr: |- | ||
{{ waku_info.json.result.listenAddresses | ||
{{ waku_info.json.listenAddresses | ||
| reject("contains", "/ws") | first }} | ||
|
||
- name: Extract LibP2P WS address from list | ||
when: nim_waku_websocket_enabled or nim_waku_websockify_enabled | ||
set_fact: | ||
nim_waku_libp2p_websocket: |- | ||
{{ waku_info.json.result.listenAddresses | ||
{{ waku_info.json.listenAddresses | ||
| select("contains", "/ws") | first }} | ||
|
||
- name: Extract peer ID from RPC response | ||
- name: Extract peer ID from API response | ||
set_fact: | ||
nim_waku_peer_id: '{{ nim_waku_libp2p_multiaddr.split("/") | last }}' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
#!/usr/bin/env bash | ||
# vim: set ft=sh: | ||
|
||
TIMEOUT="${TIMEOUT:-5}" | ||
URL="http://localhost:{{ nim_waku_rest_port }}" | ||
|
||
# List known useful endpoints when called without arguments. | ||
read -r -d '' ENDPOINTS << EOF | ||
/debug/v1/info | ||
/debug/v1/version | ||
/admin/v1/peers | ||
/health | ||
EOF | ||
|
||
if [[ $# == 0 ]]; then | ||
ENDPOINT=$( | ||
echo "${ENDPOINTS}" | fzf \ | ||
--preview='{{ nim_waku_cont_vol }}/api.sh ${1}' \ | ||
--preview-window='bottom,80%' | ||
) | ||
if [[ -z "${ENDPOINT}" ]]; then | ||
exit 0 | ||
fi | ||
elif [[ $# > 1 ]]; then | ||
echo "Too many arguments!" >&2 | ||
exit 1 | ||
else | ||
ENDPOINT="${1}" | ||
fi | ||
|
||
# Not all endpoints return JSON, that's the readon for jq magic. | ||
curl --silent --max-time "${TIMEOUT}" --show-error --fail-with-body "${URL}${ENDPOINT}" \ | ||
| jq --color-output --raw-input --raw-output '. as $line | try (fromjson) catch $line' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice