f1c8136556
Having all services in one giant haproxy file makes altering configuration for a service both painful and dangerous. Each service should be configured with a simple set of variables and rendered with a single unified template. Available are two new templates: * haproxy_single_service_listen.cfg.j2: close to the original style, but only one service per file * haproxy_single_service_split.cfg.j2: using the newer haproxy syntax for separated frontend and backend For now the default will be the single listen block, for ease of transition. Change-Id: I6e237438fbc0aa3c89a3c8bd706a53b74e71904b
11 lines
572 B
Django/Jinja
11 lines
572 B
Django/Jinja
#!/bin/bash -x
|
|
{% set haproxy_cmd='/usr/sbin/haproxy -W -db' if kolla_base_distro in ['ubuntu'] else '/usr/sbin/haproxy-systemd-wrapper' %}
|
|
|
|
# We need to run haproxy with one `-f` for each service, because including an
|
|
# entire config directory was not a feature until version 1.7 of HAProxy.
|
|
# So, append "-f $cfg" to the haproxy command for each service file.
|
|
# This will run haproxy_cmd *exactly once*.
|
|
find /etc/haproxy/services.d/ -mindepth 1 -print0 | \
|
|
xargs -0 -Icfg echo -f cfg | \
|
|
xargs {{ haproxy_cmd }} -p /run/haproxy.pid -f /etc/haproxy/haproxy.cfg
|