Support swarm without haproxy.

This commit is contained in:
Andrea Dell'Amico 2021-04-13 19:57:26 +02:00
parent 1c4826b3e8
commit 65b1c019c5
4 changed files with 16 additions and 5 deletions

View File

@ -28,9 +28,11 @@ shinyproxy_log_retention: 10
shinyproxy_default_apps: True
# Shinyproxy as docker service
shinyproxy_docker_image: 'openanalytics/shinyproxy:latest'
shinyproxy_as_docker_stack_name: 'shinyproxy'
shinyproxy_as_docker_service_name: 'shinyproxy'
shinyproxy_as_docker_src_dir: /srv/{{ shinyproxy_as_docker_service_name }}_service
shinyproxy_as_docker_src_dir: /srv/{{ shinyproxy_as_docker_stack_name }}_service
shinyproxy_docker_network: 'shinyproxy'
shinyproxy_docker_swarm_behind_haproxy: True
shinyproxy_docker_swarm_replicas: 1
shinyproxy_docker_mount_conf_file: True
shinyproxy_docker_log_to_journal: True

View File

@ -44,7 +44,7 @@
- name: Start the shinyproxy stack
docker_stack:
name: shinyproxy
name: '{{ shinyproxy_as_docker_stack_name }}'
state: present
compose:
- '{{ shinyproxy_as_docker_src_dir }}/docker-shinyproxy-stack.yml'

View File

@ -85,7 +85,7 @@ proxy:
{% if shinyproxy_as_docker_service %}
{% if shinyproxy_container_backend == 'docker-swarm' %}
container-network: {{ shinyproxy_as_docker_service_name }}_{{ shinyproxy_docker_network }}
container-network: {{ shinyproxy_as_docker_stack_name }}_{{ shinyproxy_docker_network }}
{% else %}

View File

@ -1,7 +1,7 @@
version: '3.8'
networks:
{% if shinyproxy_container_backend == 'docker-swarm' %}
{% if shinyproxy_container_backend == 'docker-swarm' and shinyproxy_docker_swarm_behind_haproxy %}
haproxy-public:
external: true
{% endif %}
@ -23,6 +23,13 @@ services:
{% endif %}
{% else %}
image: {{ shinyproxy_docker_image }}
{% if not shinyproxy_docker_swarm_behind_haproxy %}
ports:
- {{ shinyproxy_http_port }}:{{ shinyproxy_http_port }}
{% if shinyproxy_expose_prometheus and shinyproxy_version is version_compare('2.5.0', '>=') %}
- {{ shinyproxy_prometheus_port }}:{{ shinyproxy_prometheus_port }}
{% endif %}
{% endif %}
{% endif %}
volumes:
- /var/run/docker.sock:/var/run/docker.sock
@ -37,14 +44,16 @@ services:
{% endif %}
networks:
- {{ shinyproxy_docker_network }}
{% if shinyproxy_container_backend == 'docker-swarm' %}
{% if shinyproxy_container_backend == 'docker-swarm' and shinyproxy_docker_swarm_behind_haproxy %}
- haproxy-public
{% endif %}
{% if shinyproxy_container_backend == 'docker-swarm' %}
deploy:
mode: replicated
replicas: {{ shinyproxy_docker_swarm_replicas }}
{% if shinyproxy_docker_swarm_behind_haproxy %}
endpoint_mode: dnsrr
{% endif %}
placement:
constraints: [node.role == manager]
restart_policy: