diff --git a/defaults/main.yml b/defaults/main.yml index 1cb153c..b446c9b 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -5,7 +5,7 @@ docker_swarm_haproxy_installation_type: 'global' # I did not find any way to make it dependant on docker_swarm_haproxy_installation_type docker_swarm_haproxy_keepalive_installation: False docker_swarm_haproxy_swarm_port: '{{ docker_api_port }}' - +docker_swarm_haproxy_plain_http_api: True # docker_swarm_expose_api_via_haproxy: True docker_swarm_expose_api_hostname: 'swarm.example.com' @@ -19,6 +19,9 @@ docker_swarm_portainer_hostname: 'portainer-swarm.example.com' docker_swarm_portainer_additional_constraints: [] # - 'node.hostname != docker01' +# This is ugly +docker_swarm_haproxy_shinyproxy_metrics: False + docker_swarm_portainer_network: 'agent_network' docker_swarm_portainer_http_port: '9000' docker_swarm_portainer_service_port: '8000' diff --git a/templates/haproxy.cfg.j2 b/templates/haproxy.cfg.j2 index 1a915a9..1e6e7ce 100644 --- a/templates/haproxy.cfg.j2 +++ b/templates/haproxy.cfg.j2 @@ -106,7 +106,11 @@ frontend http {% if docker_swarm_expose_api_via_haproxy %} frontend docker_ft - bind :{{ docker_swarm_haproxy_swarm_port }} ssl crt {{ haproxy_cert_dir }} alpn h2,http/1.1 {% if docker_swarm_haproxy_installation_type == 'global' %}accept-proxy{% endif %} +{% if docker_swarm_haproxy_plain_http_api: %} + bind :{{ docker_swarm_haproxy_swarm_port }} {% if docker_swarm_haproxy_installation_type == 'global' %}accept-proxy{% endif %} +{% else %} + bind :{{ docker_swarm_haproxy_swarm_port }} ssl crt {{ haproxy_cert_dir }} alpn h2,http/1.1 {% if docker_swarm_haproxy_installation_type == 'global' %}accept-proxy{% endif %} +{% endif %} mode http acl swarm_api hdr_dom(host) -i {{ docker_swarm_expose_api_hostname }} @@ -143,6 +147,14 @@ frontend docker_ft default_backend swarm_api_bck {% endif %} +{% if docker_swarm_haproxy_shinyproxy_metrics %} +# shinyproxy opens a second port, 9090, to expose its metrics to prometheus +frontend shinyproxy_metrics + bind :9090 + mode http + default_backend shinyproxy_metrics +{% endif %} + # # Backends #