summaryrefslogtreecommitdiffstats
path: root/roles/openshift_loadbalancer/templates/haproxy.docker.service.j2
blob: 90111449cf8f59b26ce2fb1e1df797c4d10536c9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
[Unit]
After={{ openshift_docker_service_name }}.service
Requires={{ openshift_docker_service_name }}.service
PartOf={{ openshift_docker_service_name }}.service

[Service]
ExecStartPre=-/usr/bin/docker rm -f openshift_loadbalancer
ExecStart=/usr/bin/docker run --rm --name openshift_loadbalancer {% for frontend in openshift_loadbalancer_frontends %} {% for bind in frontend.binds %} -p {{ bind |regex_replace('^[^:]*:(\d+).*$', '\\1') }}:{{ bind |regex_replace('^[^:]*:(\d+).*$', '\\1') }} {% endfor %} {% endfor %} -v /etc/haproxy/haproxy.cfg:/etc/haproxy/haproxy.cfg:ro --entrypoint=haproxy {{ openshift_router_image }}:{{ openshift_image_tag }} -f /etc/haproxy/haproxy.cfg
ExecStartPost=/usr/bin/sleep 10
ExecStop=/usr/bin/docker stop openshift_loadbalancer
LimitNOFILE={{ openshift_loadbalancer_limit_nofile | default(100000) }}
LimitCORE=infinity
Restart=always
RestartSec=5s

[Install]
WantedBy={{ openshift_docker_service_name }}.service