add consul service definition, fix volume paths
Signed-off-by: Jakub Sokołowski <jakub@status.im>
This commit is contained in:
parent
8154ed43b3
commit
793e9a66f7
|
@ -1,12 +1,14 @@
|
||||||
---
|
---
|
||||||
beacon_node_verbose: false
|
beacon_node_verbose: false
|
||||||
|
|
||||||
# https://github.com/status-im/nimbus/docker
|
|
||||||
beacon_node_build_flavour: 'rlpx'
|
beacon_node_build_flavour: 'rlpx'
|
||||||
beacon_node_network: 'testnet0'
|
beacon_node_network: 'testnet0'
|
||||||
beacon_node_cont_image: 'statusteam/nimbus_beacon_node:{{beacon_node_network}}-{{beacon_node_build_flavour}}'
|
|
||||||
beacon_node_total_nodes: 1
|
beacon_node_total_nodes: 1
|
||||||
|
|
||||||
|
# Image source: https://github.com/status-im/nimbus/tree/master/docker/beacon_node
|
||||||
|
beacon_node_cont_tag: '{{ beacon_node_network }}-{{ beacon_node_build_flavour }}'
|
||||||
|
beacon_node_cont_image: 'statusteam/nimbus_beacon_node:{{ beacon_node_cont_tag }}'
|
||||||
|
|
||||||
beacon_node_cont_vol: '/docker/beacon_node'
|
beacon_node_cont_vol: '/docker/beacon_node'
|
||||||
|
|
||||||
beacon_node_disovery_port: 9000
|
beacon_node_disovery_port: 9000
|
||||||
|
|
|
@ -1,5 +1,12 @@
|
||||||
---
|
---
|
||||||
- name: 'Create {{container_name}} container'
|
- name: 'Create container dir: {{ container_name }}'
|
||||||
|
file:
|
||||||
|
path: '/docker/{{ container_name }}/data'
|
||||||
|
state: directory
|
||||||
|
owner: dockremap
|
||||||
|
group: docker
|
||||||
|
|
||||||
|
- name: 'Create container: {{ container_name }} {{ public_tcp_port }}'
|
||||||
docker_container:
|
docker_container:
|
||||||
name: '{{ container_name }}'
|
name: '{{ container_name }}'
|
||||||
image: '{{ beacon_node_cont_image }}'
|
image: '{{ beacon_node_cont_image }}'
|
||||||
|
@ -9,8 +16,6 @@
|
||||||
recreate: false
|
recreate: false
|
||||||
restart: false
|
restart: false
|
||||||
ports:
|
ports:
|
||||||
- '127.0.0.1:{{public_tcp_port}}:{{beacon_node_listening_port}}'
|
|
||||||
- '127.0.0.1:{{public_udp_port}}:{{beacon_node_disovery_port}}/udp'
|
|
||||||
- '{{ public_tcp_port }}:{{ beacon_node_listening_port }}'
|
- '{{ public_tcp_port }}:{{ beacon_node_listening_port }}'
|
||||||
- '{{ public_udp_port }}:{{ beacon_node_disovery_port }}/udp'
|
- '{{ public_udp_port }}:{{ beacon_node_disovery_port }}/udp'
|
||||||
command: |
|
command: |
|
||||||
|
@ -21,29 +26,33 @@
|
||||||
--tcpPort={{ beacon_node_listening_port }}
|
--tcpPort={{ beacon_node_listening_port }}
|
||||||
--udpPort={{ beacon_node_disovery_port }}
|
--udpPort={{ beacon_node_disovery_port }}
|
||||||
volumes:
|
volumes:
|
||||||
- '{{beacon_node_cont_vol}}/node-{{index}}:/root/.cache/nimbus'
|
- '/docker/{{ container_name }}/data:/root/.cache/nimbus'
|
||||||
|
|
||||||
- name: 'Enable TCP port for beacon node {{index}}'
|
- name: 'Enable ports for: {{ container_name }}'
|
||||||
iptables:
|
iptables:
|
||||||
comment: 'TCP port for beacon node {{index}}'
|
comment: '{{ container_name }} {{ item.protocol }}'
|
||||||
action: insert
|
action: insert
|
||||||
chain: DOCKER-USER
|
chain: DOCKER-USER
|
||||||
jump: ACCEPT
|
jump: ACCEPT
|
||||||
source: '0.0.0.0/0'
|
source: '0.0.0.0/0'
|
||||||
protocol: 'tcp'
|
protocol: '{{ item.protocol }}'
|
||||||
destination_port: '{{public_tcp_port}}'
|
destination_port: '{{ item.por }}'
|
||||||
notify:
|
with_items:
|
||||||
- Save iptables rules
|
- { protocol: 'tcp', port: '{{ public_tcp_port }}' }
|
||||||
|
- { protocol: 'udp', port: '{{ public_udp_port }}' }
|
||||||
- name: 'Enable UDP port for beacon node {{index}}'
|
|
||||||
iptables:
|
|
||||||
comment: 'UDP port for beacon node {{index}}'
|
|
||||||
action: insert
|
|
||||||
chain: DOCKER-USER
|
|
||||||
jump: ACCEPT
|
|
||||||
source: '0.0.0.0/0'
|
|
||||||
protocol: 'udp'
|
|
||||||
destination_port: '{{public_udp_port}}'
|
|
||||||
notify:
|
notify:
|
||||||
- Save iptables rules
|
- Save iptables rules
|
||||||
|
|
||||||
|
- name: 'Consul service definition - {{ container_name }}'
|
||||||
|
include_role: name=consul-service
|
||||||
|
vars:
|
||||||
|
consul_config_name: '{{ container_name | replace("-", "_") }}'
|
||||||
|
consul_services:
|
||||||
|
- id: '{{ container_name }}-{{ index }}'
|
||||||
|
name: '{{ container_name }}'
|
||||||
|
port: '{{ public_tcp_port }}'
|
||||||
|
tags: ['{{ env }}.{{ stage }}', 'beacon', 'nimbus']
|
||||||
|
checks:
|
||||||
|
- id: beacon-node-health
|
||||||
|
type: tcp
|
||||||
|
tcp: 'localhost:{{ public_tcp_port }}'
|
||||||
|
|
|
@ -2,10 +2,9 @@
|
||||||
- include_tasks: beacon_node.yml
|
- include_tasks: beacon_node.yml
|
||||||
vars:
|
vars:
|
||||||
public_tcp_port: '{{ beacon_node_listening_port + loop_index }}'
|
public_tcp_port: '{{ beacon_node_listening_port + loop_index }}'
|
||||||
public_udp_port: '{{beacon_node_listening_port + loop_index}}'
|
public_udp_port: '{{ beacon_node_disovery_port + loop_index }}'
|
||||||
container_name: 'beacon-node-{{ beacon_node_build_flavour }}-{{ beacon_node_network}}-{{loop_index }}'
|
container_name: 'beacon-node-{{ beacon_node_build_flavour }}-{{ beacon_node_network}}-{{loop_index }}'
|
||||||
index: '{{ loop_index }}'
|
index: '{{ loop_index }}'
|
||||||
loop: '{{ range(0, beacon_node_total_nodes) | list }}'
|
loop: '{{ range(0, beacon_node_total_nodes) | list }}'
|
||||||
loop_control:
|
loop_control:
|
||||||
index_var: loop_index
|
index_var: loop_index
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue