ansible-role-haproxy/templates/haproxy-docker-compose.yml.j2

50 lines
1.3 KiB
Django/Jinja

version: '3.8'
services:
haproxy:
image: haproxytech/haproxy-debian:{{ haproxy_version }}
volumes:
- '{{ haproxy_cert_dir }}':'{{ haproxy_cert_dir }}':ro
- /etc/haproxy:/etc/haproxy:ro
ports:
- target: '{{ haproxy_default_port }}'
published: '{{ haproxy_default_port }}'
protocol: tcp
mode: host
- target: '{{ haproxy_ssl_port }}'
published: '{{ haproxy_ssl_port }}'
protocol: tcp
mode: host
{% if docker_swarm_haproxy_networks is defined %}
networks:
{% for net in docker_swarm_haproxy_networks %}
- {{ net }}
{% endfor %}
{% endif %}
{% if docker_swarm_haproxy_additional_services is defined %}
{% for net in docker_swarm_haproxy_additional_services %}
- {{ net.service_overlay_network }}
{% endfor %}
{% endif %}
deploy:
mode: replicated
replicas: 1
endpoint_mode: dnsrr
placement:
constraints: [node.role == manager]
restart_policy:
condition: unless-stopped
delay: 5s
max_attempts: 3
window: 120s
resources:
limits:
cpus: '2.0'
memory: 768M
reservations:
cpus: '1.0'
memory: 384M
{% if docker_log_to_journal %}
log_driver: 'journald'
{% endif %}