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: