ansible-role-shinyproxy/templates/shinyproxy-docker-compose.y...

82 lines
2.4 KiB
Django/Jinja

version: '3.8'
networks:
{% if shinyproxy_container_backend == 'docker-swarm' and shinyproxy_docker_swarm_behind_haproxy %}
haproxy-public:
external: true
{% 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' %}
build: .
ports:
- target: {{ shinyproxy_http_port }}
published: {{ shinyproxy_http_port }}
protocol: tcp
mode: '{{ shinyproxy_docker_http_port_mode }}'
{% if shinyproxy_expose_prometheus and shinyproxy_version is version_compare('2.5.0', '>=') %}
- target: 9090
published: {{ shinyproxy_prometheus_port }}
protocol: tcp
mode: '{{ shinyproxy_docker_http_port_mode }}'
{% endif %}
{% else %}
image: {{ shinyproxy_docker_image }}
{% if not shinyproxy_docker_swarm_behind_haproxy %}
ports:
- target: {{ shinyproxy_http_port }}
published: {{ shinyproxy_http_port }}
protocol: tcp
mode: 'ingress'
{% if shinyproxy_expose_prometheus and shinyproxy_version is version_compare('2.5.0', '>=') %}
- target: 9090
published: {{ shinyproxy_prometheus_port }}
protocol: tcp
mode: 'ingress'
{% endif %}
{% endif %}
{% 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' 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:
condition: on-failure
delay: 5s
max_attempts: 3
window: 120s
{% endif %}
{% if shinyproxy_docker_log_to_journal %}
logging:
driver: 'journald'
{% endif %}