From bd78eb956021b7deeceade21295fbf7807b34f38 Mon Sep 17 00:00:00 2001 From: Robert Kaussow Date: Sun, 16 Dec 2018 17:22:49 +0100 Subject: [PATCH] add memmory options --- defaults/main.yml | 5 +++++ templates/services/droneci-compose.yml.j2 | 12 ++++++++++++ 2 files changed, 17 insertions(+) diff --git a/defaults/main.yml b/defaults/main.yml index cc131ab..ca86e6d 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -9,9 +9,14 @@ droneci_server_image: "drone/drone:{{ droneci_version }}" droneci_server_restart_policy: always droneci_server_exposed_port: 8080 droneci_server_exposed_ip: 127.0.0.1 +# droneci_server_memory_limit: 512m # defaults to not set +# droneci_server_memory_reservation: 256m # defaults to not set +# droneci_server_extra_hosts: [] droneci_agent_image: "drone/agent:{{ droneci_version }}" droneci_agent_restart_policy: always +# droneci_agent_memory_limit: 512m # defaults to not set +# droneci_agent_memory_reservation: 256m # defaults to not set droneci_postgres_enabled: False droneci_postgres_ssl_mode: disable diff --git a/templates/services/droneci-compose.yml.j2 b/templates/services/droneci-compose.yml.j2 index 9c542a5..d5d9b25 100644 --- a/templates/services/droneci-compose.yml.j2 +++ b/templates/services/droneci-compose.yml.j2 @@ -54,6 +54,12 @@ services: {% endif %} - NO_PROXY={{ droneci_no_proxy | join(',') }} - no_proxy={{ droneci_no_proxy | join(',') }} + {% if droneci_server_memory_limitis defined %} + mem_limit: {{ droneci_server_memory_limitis }} + {% endif %} + {% if droneci_server_memory_reservation is defined %} + mem_reservation: {{ droneci_server_memory_reservation }} + {% endif %} droneagent: image: {{ droneci_agent_image }} @@ -69,6 +75,12 @@ services: - DRONE_SECRET={{ droneci_secret }} # TODO: temp static value, needs to be replaced by a custom fact - DOCKER_API_VERSION=1.26 + {% if droneci_agent_memory_limitis defined %} + mem_limit: {{ droneci_agent_memory_limit }} + {% endif %} + {% if droneci_agent_memory_reservation is defined %} + mem_reservation: {{ droneci_agent_memory_reservation }} + {% endif %} {% if not droneci_postgres_enabled %} volumes: