From 27aea17ad6c02c597ec99efb8189ce765c70c930 Mon Sep 17 00:00:00 2001 From: Andrea Dell'Amico Date: Mon, 26 Oct 2020 19:06:43 +0100 Subject: [PATCH] shinyproxy: connect to the haproxy-public network from the compose file --- tasks/shinyproxy_docker_service.yml | 6 ------ templates/shinyproxy-docker-compose.yml.j2 | 14 +++++++++++--- 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/tasks/shinyproxy_docker_service.yml b/tasks/shinyproxy_docker_service.yml index e100ca0..10a1580 100644 --- a/tasks/shinyproxy_docker_service.yml +++ b/tasks/shinyproxy_docker_service.yml @@ -44,12 +44,6 @@ compose: - '{{ shinyproxy_as_docker_src_dir }}/docker-shinyproxy-stack.yml' - - name: Connect the shinyproxy serivce to the haproxy-public network - command: docker service update --network-add haproxy-public {{ shinyproxy_as_docker_service_name }}_{{ shinyproxy_as_docker_service_name }} --update-delay 30s --update-parallelism 1 - run_once: True - ignore_errors: True - - run_once: True when: - docker_swarm_manager_main_node is defined and docker_swarm_manager_main_node | bool - shinyproxy_container_backend == 'docker-swarm' diff --git a/templates/shinyproxy-docker-compose.yml.j2 b/templates/shinyproxy-docker-compose.yml.j2 index b7903bb..d06ac23 100644 --- a/templates/shinyproxy-docker-compose.yml.j2 +++ b/templates/shinyproxy-docker-compose.yml.j2 @@ -1,4 +1,11 @@ -version: '3.6' +version: '3.2' + +networks: +{% if shinyproxy_container_backend == 'docker-swarm' %} + haproxy-public: + external: true +{% endif %} + {{ shinyproxy_docker_network }}: services: shinyproxy: @@ -14,6 +21,9 @@ services: - {{ shinyproxy_as_docker_src_dir }}/application.yml:/opt/shinyproxy/application.yml:ro networks: - {{ shinyproxy_docker_network }} +{% if shinyproxy_container_backend == 'docker-swarm' %} + - haproxy-public +{% endif %} {% if shinyproxy_container_backend == 'docker-swarm' %} deploy: mode: replicated @@ -32,5 +42,3 @@ services: driver: 'journald' {% endif %} -networks: - {{ shinyproxy_docker_network }}: