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

86 lines
2.6 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 %}
secrets:
{{ shinyproxy_as_docker_stack_name }}_{{ shinyproxy_as_docker_service_name }}:
external: true
{% endif %}
services:
{{ shinyproxy_as_docker_service_name }}:
{% 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 %}
- 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_published_http_port }}
protocol: tcp
mode: 'ingress'
{% if shinyproxy_expose_prometheus %}
- target: 9090
published: {{ shinyproxy_prometheus_port }}
protocol: tcp
mode: 'ingress'
{% endif %}
{% endif %}
{% endif %}
{% if shinyproxy_docker_privileged_user or shinyproxy_docker_mount_conf_file %}
volumes:
{% if shinyproxy_docker_privileged_user %}
- /var/run/docker.sock:/var/run/docker.sock
{% endif %}
{% if shinyproxy_docker_mount_conf_file %}
- {{ shinyproxy_as_docker_src_dir }}/application.yml:{{ shinyproxy_conf_dir }}/application.yml
{% endif %}
{% endif %}
{% if not shinyproxy_docker_mount_conf_file %}
secrets:
- source: {{ shinyproxy_as_docker_stack_name }}_{{ shinyproxy_as_docker_service_name }}
target: {{ shinyproxy_conf_dir }}/application.yml
mode: 0444
{% 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 %}