put container restarts under the "cont_restart" flag

Had to gave up on `docker-compose up --no-start` because it still
stopped the running container image before pulling and creating a new
one.

Further more, we can now handle containers being restarted automatically
on our Altona servers.
This commit is contained in:
Ștefan Talpalaru 2020-07-06 22:53:29 +02:00
parent 42a5d65627
commit afe9faf5af
No known key found for this signature in database
GPG Key ID: CBF7934204F1B6F9
3 changed files with 12 additions and 11 deletions

View File

@ -24,7 +24,7 @@ beacon_node_mem_limit: '{{ (ansible_memtotal_mb * 0.6) | int }}'
beacon_node_mem_reserve: '{{ (ansible_memtotal_mb * 0.4) | int }}'
# container restart policy
beacon_node_restart_ondition: 'on-failure'
beacon_node_restart_condition: 'on-failure'
beacon_node_restart_max_attempts: 3
beacon_node_restart_delay_sec: 10
beacon_node_restart_window_sec: 120

View File

@ -22,7 +22,7 @@
reservations:
memory: '{{ beacon_node_mem_reserve }}M'
restart_policy:
condition: '{{ beacon_node_restart_ondition }}'
condition: '{{ beacon_node_restart_condition }}'
max_attempts: '{{ beacon_node_restart_max_attempts }}'
delay: '{{ beacon_node_restart_delay_sec }}s'
window: '{{ beacon_node_restart_window_sec }}s'

View File

@ -9,17 +9,18 @@
# --compatibility flag required for mem/cpu limits
- name: 'Create container: {{ beacon_node_cont_name }}'
command: |
docker-compose \
--compatibility \
up \
--quiet-pull \
--no-build \
command: >-
docker-compose
--compatibility
up
--quiet-pull
--no-build
{% if compose_recreate %}
--force-recreate \
--force-recreate
{% endif %}
--no-color \
--no-start
--no-color
-d
args:
chdir: '{{ beacon_node_cont_vol }}'
when: cont_restart