From c67fc0ef6cbbdb538b552584889716e7e9541d43 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20Soko=C5=82owski?= Date: Thu, 25 Mar 2021 20:47:27 +0100 Subject: [PATCH] swap limits are not supported by docker-compose MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit https://stackoverflow.com/questions/44325949/ Signed-off-by: Jakub SokoĊ‚owski --- defaults/main.yml | 1 - templates/docker-compose.yml.j2 | 6 ++++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/defaults/main.yml b/defaults/main.yml index dd9f75f..13ea68b 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -107,7 +107,6 @@ geth_cache_size: ~ # Container memory limits geth_cont_mem_ratio: 0.6 geth_cont_mem_limit: '{{ (ansible_memtotal_mb * geth_cont_mem_ratio|float) | int }}' -geth_cont_swap_limit: '{{ (geth_cont_mem_limit|int) + (ansible_swaptotal_mb * geth_cont_mem_ratio|float) | int }}' # general container management compose_recreate: 'smart' diff --git a/templates/docker-compose.yml.j2 b/templates/docker-compose.yml.j2 index e63e117..d91fb6e 100644 --- a/templates/docker-compose.yml.j2 +++ b/templates/docker-compose.yml.j2 @@ -6,8 +6,10 @@ services: image: '{{ geth_cont_image }}' user: root restart: 'always' - mem_limit: '{{ geth_cont_mem_limit }}m' - memswap_limit: '{{ geth_cont_swap_limit }}m' + deploy: + resources: + limits: + memory: '{{ geth_cont_mem_limit }}m' ports: - '{{ geth_port }}:{{ geth_port }}/tcp' - '{{ geth_port }}:{{ geth_port }}/udp'