HAProxy community

Haproxy seamless reload by changing unit file

Hi, I have the following haproxy systemd unit file
Just the defaults.
[Unit]
Description=HAProxy Load Balancer
After=network.target

[Service]
Environment=“CONFIG=/etc/haproxy/haproxy.cfg” “PIDFILE=/run/haproxy.pid”
ExecStartPre=@SBINDIR@/haproxy -f $CONFIG -c -q
ExecStart=@SBINDIR@/haproxy -Ws -f $CONFIG -p $PIDFILE
ExecReload=@SBINDIR@/haproxy -f $CONFIG -c -q
ExecReload=/bin/kill -USR2 $MAINPID
KillMode=mixed
Restart=always
SuccessExitStatus=143
Type=notify

[Install]
WantedBy=multi-user.target

So just the defaults from version 1.8

using systemctl reload haproxy.service works fine and reloads a new process.
However I would like to change the unit file to do
Environment=“CONFIG=/etc/haproxy/haproxy_new.cfg” “PIDFILE=/run/haproxy.pid”

and then reload, after doing a daemon-reload.
However when I check the process running, its always running with the old /etc/haproxy/haproxy.cfg and not with the new /etc/haproxy/haproxy_new.cfg

I understand that this is not conventional, but I’m required to stick to creating a new config file and recreate the unit file and then do a reload.
Can someone help me on how to achieve the above?

Did you check whether the new configuration is actually applied, or did you just review the ps output?

Initially I just reviewed the output of ps.
After your ask, I checked the configuration being served, and its still the original
Since it looks like this
ExecReload=@SBINDIR@/haproxy -f $CONFIG -c -q
ExecReload=/bin/kill -USR2 $MAINPID

just checks the config for validity and kills the MAINPID, which triggers a new worker to spring up.
But from the original master who was using haproxy.cfg and not haproxy_new.cfg.

If I do systemctl daemon-reload and systemctl restart haproxy.service, only then I see the process and requests being served by the new haproxy_new.cfg