From ac7a5ae5f9d3b7f829c7213b7ca5f38993a5f71a Mon Sep 17 00:00:00 2001 From: Andrea Dell'Amico Date: Wed, 6 Apr 2022 19:07:07 +0200 Subject: [PATCH] Support the 'privileged' mode for containers. --- defaults/main.yml | 1 + templates/shinyproxy-2-conf.yml.j2 | 9 ++++++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/defaults/main.yml b/defaults/main.yml index e77dc3f..4c7a7d7 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -62,6 +62,7 @@ shinyproxy_docker_protocol: http shinyproxy_docker_certs_dir: /etc/pki/shinyproxy shinyproxy_docker_url: '{{ shinyproxy_docker_protocol }}://{{ shinyproxy_docker_host }}:{{ shinyproxy_docker_port }}' shinyproxy_docker_port_range_start: 20000 +shinyproxy_docker_privileged: 'false' shinyproxy_docker_cpu_limit: 1 shinyproxy_docker_memory_request: '1g' shinyproxy_docker_memory_limit: '2g' diff --git a/templates/shinyproxy-2-conf.yml.j2 b/templates/shinyproxy-2-conf.yml.j2 index ff7f5b0..bef08bc 100644 --- a/templates/shinyproxy-2-conf.yml.j2 +++ b/templates/shinyproxy-2-conf.yml.j2 @@ -93,6 +93,7 @@ proxy: cert-path: {{ shinyproxy_docker_certs_dir }} url: {{ shinyproxy_docker_url }} container-protocol: {{ shinyproxy_docker_protocol }} + privileged: {{ shinyproxy_docker_privileged }} port-range-start: {{ shinyproxy_docker_port_range_start }} internal-networking: {{ shinyproxy_docker_internal_networking }} {% else %} @@ -118,7 +119,13 @@ proxy: {% if app.cmd is defined %}container-cmd: ["R", "-e {{ app.cmd }}"]{% endif %} container-image: {{ app.docker_image }} - container-memory: {{ app.docker_memory | default('2g') }} + container-privileged: {{ app.container_privileged | default('false') }} + container-memory-request: {{ app.container_memory_request | default('256m')}} + container-memory-limit: {{ app.docker_memory | default('2g') }} + container-cpu-request: {{ app.container_cpu_request | default('1') }} + + {% if app.container_cpu_limit is defined %}container-cpu-limit: {{ app.container_cpu_limit }}{% endif %} + {% if shinyproxy_version is version_compare('2.6.0', '>=') %} stop-on-logout: {{ app.stop_on_logout | default('true') }}