allow enabling websocket API port

Signed-off-by: Jakub Sokołowski <jakub@status.im>
This commit is contained in:
Jakub Sokołowski 2020-11-24 15:37:01 +01:00
parent 94d9f1bce1
commit bd4723548a
No known key found for this signature in database
GPG Key ID: 4EF064D0E6D63020
3 changed files with 24 additions and 0 deletions

View File

@ -29,6 +29,10 @@ geth_rpc_port: 8545
geth_rcp_api: 'eth,net,web3,personal,admin' geth_rcp_api: 'eth,net,web3,personal,admin'
# Alternative IPC socket # Alternative IPC socket
geth_ipc_path: '/data/geth.ipc' geth_ipc_path: '/data/geth.ipc'
# Web Sockets API
geth_websocket_enabled: true
geth_websocket_port: '{{ geth_rpc_port + 1 | int }}'
geth_websocket_api: 'eth,net,web3,personal,admin'
# useful for linking containers # useful for linking containers
geth_extra_alias: geth geth_extra_alias: geth
geth_aliases: geth_aliases:

View File

@ -45,3 +45,15 @@
type: script type: script
script: '{{ geth_sync_check_script }}' script: '{{ geth_sync_check_script }}'
timeout: '5s' timeout: '5s'
- name: '{{ geth_cont_name }}-ws'
tags: '{{ geth_consul_tags + ["websocket"] }}'
port: '{{ geth_websocket_port }}'
address: '{{ geth_consul_rpc_address }}'
meta:
env: '{{ env }}'
stage: '{{ stage }}'
checks:
- id: '{{ geth_cont_name }}-ws-status'
name: 'Geth WebSocket API'
type: 'tcp'
tcp: 'localhost:{{ geth_websocket_port }}'

View File

@ -15,6 +15,7 @@
ports: ports:
- '{{ geth_port }}:{{ geth_port }}/tcp' - '{{ geth_port }}:{{ geth_port }}/tcp'
- '{{ geth_port }}:{{ geth_port }}/udp' - '{{ geth_port }}:{{ geth_port }}/udp'
- '{{ geth_websocket_port }}:{{ geth_websocket_port }}/tcp'
- '{{ geth_rpc_addr }}:{{ geth_rpc_port }}:{{ geth_rpc_port }}' - '{{ geth_rpc_addr }}:{{ geth_rpc_port }}:{{ geth_rpc_port }}'
labels: labels:
# These are just for documentation # These are just for documentation
@ -65,6 +66,13 @@
--http.api={{ geth_rcp_api }} --http.api={{ geth_rcp_api }}
--ipcpath={{ geth_ipc_path }} --ipcpath={{ geth_ipc_path }}
{% endif %} {% endif %}
{% if geth_websocket_enabled %}
--ws
--ws.addr=0.0.0.0
--ws.port={{ geth_websocket_port }}
--ws.origins={{ geth_aliases | join(",") }}
--ws.api={{ geth_websocket_api }}
{% endif %}
volumes: volumes:
- '{{ geth_cont_vol }}/keys:/keys:rw' - '{{ geth_cont_vol }}/keys:/keys:rw'
# WARNING: This assumes /data is mounted, see bootstrap role # WARNING: This assumes /data is mounted, see bootstrap role