Hi. I am currently trying to load some backend configurations via an external file, which are passed in on startup. This is HAProxy 1.8 on RHEL
If I run the start up command manually (backends.cfg is the external file to load)
/opt/rh/rh-haproxy18/root/usr/sbin/haproxy -Ws -f /etc/opt/rh/rh-haproxy18/haproxy/haproxy.cfg -p /run/rh-haproxy18-haproxy.pid -f /etc/opt/rh/rh-haproxy18/haproxy/backends/backends.cfg &
it starts up fine.
When I move the option into the startup config in
/etc/sysconfig/rh-haproxy18-haproxy
Add extra options to the haproxy daemon here. This can be useful for
specifying multiple configuration files with multiple -f options.
See haproxy(1) for a complete list of options.
OPTIONS="-d -f /etc/opt/rh/rh-haproxy18/haproxy/backends/backends.cfg"
I get errors of unable to find the backends
systemctl status rh-haproxy18-haproxy.service
● rh-haproxy18-haproxy.service - HAProxy Load Balancer
Loaded: loaded (/usr/lib/systemd/system/rh-haproxy18-haproxy.service; enabled; vendor preset: disabled)
Active: failed (Result: exit-code) since Thu 2020-04-23 11:40:49 NZST; 9s ago
Process: 28465 ExecStart=/opt/rh/rh-haproxy18/root/usr/sbin/haproxy -Ws -f $CONFIG -p $PIDFILE $OPTIONS (code=exited, status=1/FAILURE)
Process: 1375 ExecStartPre=/opt/rh/rh-haproxy18/root/usr/sbin/haproxy -f $CONFIG -c -q (code=exited, status=1/FAILURE)
Main PID: 28465 (code=exited, status=1/FAILURE)
Apr 23 11:40:48 systemd[1]: Starting HAProxy Load Balancer…
Apr 23 11:40:49 haproxy[1375]: [ALERT] 113/114049 (1375) : Proxy ‘MAIN’: unable to find required default_backend: ‘WWW’.
Apr 23 11:40:49 haproxy[1375]: [ALERT] 113/114049 (1375) : Proxy ‘MAIN’: unable to find required use_backend: ‘SALES-API’.
Apr 23 11:40:49 haproxy[1375]: [ALERT] 113/114049 (1375) : Fatal errors found in configuration.
Apr 23 11:40:49 systemd[1]: rh-haproxy18-haproxy.service: control process exited, code=exited status=1
Apr 23 11:40:49 systemd[1]: Failed to start HAProxy Load Balancer.
Apr 23 11:40:49 systemd[1]: Unit rh-haproxy18-haproxy.service entered failed state.
Apr 23 11:40:49 systemd[1]: rh-haproxy18-haproxy.service failed.
WWW & SALES-API are the backend names
These files load and startup correctly on a manual start
Any ideas please ?
Cheers
Chris