support raising and lowering the number of running nodes

This commit is contained in:
Zahary Karadjov 2019-05-08 16:57:10 +03:00
parent f9db5421e3
commit 3889a17e48
No known key found for this signature in database
GPG Key ID: C8936F8A3073D609
3 changed files with 3 additions and 2 deletions

View File

@ -2,6 +2,7 @@
beacon_node_build_flavour: 'rlpx'
beacon_node_network: 'testnet0'
beacon_node_total_nodes: 1
beacon_node_running_nodes: 1
beacon_node_log_level: INFO
# Image source: https://github.com/status-im/nimbus/tree/master/docker/beacon_node
@ -12,6 +13,5 @@ beacon_node_discovery_port: 9000
beacon_node_listening_port: 9000
# general container management
cont_state: started
cont_recreate: false
cont_restart: false

View File

@ -12,7 +12,7 @@
image: '{{ beacon_node_cont_image }}'
pull: true
restart_policy: always
state: '{{ cont_state }}'
state: '{{ "started" if is_running else "stopped" }}'
recreate: '{{ cont_recreate }}'
restart: '{{ cont_restart }}'
# enable image updates via watchtower

View File

@ -5,6 +5,7 @@
public_udp_port: '{{ beacon_node_discovery_port + loop_index }}'
container_name: 'beacon-node-{{ beacon_node_build_flavour }}-{{ beacon_node_network}}-{{loop_index }}'
index: '{{ loop_index }}'
is_running: '{{ loop_index < beacon_node_running_nodes }}'
loop: '{{ range(0, beacon_node_total_nodes) | list }}'
loop_control:
index_var: loop_index