From 89e6897a31b0c0203353e93cadbc86912dfac02e Mon Sep 17 00:00:00 2001 From: Andrea Dell'Amico Date: Tue, 29 Dec 2020 16:35:31 +0100 Subject: [PATCH] One replica. Choose betwen mount the configuration file or use it as a config. --- defaults/main.yml | 3 ++- templates/shinyproxy-docker-compose.yml.j2 | 7 +++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/defaults/main.yml b/defaults/main.yml index a05e7fb..0702ca7 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -26,7 +26,8 @@ shinyproxy_docker_image: 'adellamisti/shinyproxy:latest' shinyproxy_as_docker_service_name: 'shinyproxy' shinyproxy_as_docker_src_dir: /srv/{{ shinyproxy_as_docker_service_name }}_service shinyproxy_docker_network: 'shinyproxy' -shinyproxy_docker_swarm_replicas: 2 +shinyproxy_docker_swarm_replicas: 1 +shinyproxy_docker_mount_conf_file: True shinyproxy_docker_log_to_journal: True # Shinyproxy configuration # docker, docker-swarm, kubernetes diff --git a/templates/shinyproxy-docker-compose.yml.j2 b/templates/shinyproxy-docker-compose.yml.j2 index 07ed4a4..b023b28 100644 --- a/templates/shinyproxy-docker-compose.yml.j2 +++ b/templates/shinyproxy-docker-compose.yml.j2 @@ -7,9 +7,11 @@ networks: {% endif %} {{ shinyproxy_docker_network }}: +{% if not shinyproxy_docker_mount_conf_file %} configs: shinyproxy_conf: file: {{ shinyproxy_as_docker_src_dir }}/application.yml +{% endif %} services: shinyproxy: {% if shinyproxy_container_backend == 'docker' %} @@ -21,10 +23,15 @@ services: {% endif %} volumes: - /var/run/docker.sock:/var/run/docker.sock +{% if shinyproxy_docker_mount_conf_file %} + - {{ shinyproxy_as_docker_src_dir }}/application.yml:{{ shinyproxy_conf_dir }}/application.yml +{% endif %} +{% if not shinyproxy_docker_mount_conf_file %} configs: - source: shinyproxy_conf target: {{ shinyproxy_conf_dir }}/application.yml mode: 0400 +{% endif %} networks: - {{ shinyproxy_docker_network }} {% if shinyproxy_container_backend == 'docker-swarm' %}