On Mon, Nov 20, 2017 at 02:07:18PM +0100, Tim Düsterhus wrote:
> > $ sudo env NOTIFY_SOCKET=foo ./haproxy -W -f ./haproxy.cfg
> > [ALERT] 000/010000 (22263) : NOTIFY_SOCKET is defined, but haproxy is not
> > compiled with USE_SYSTEMD=1. Change Type=notify in your unit file.
> > $ sudo env ./haproxy -W -f ./haproxy.cfg
> > ^C[WARNING] 323/140435 (22278) : Exiting Master process...
> > [ALERT] 323/140435 (22278) : Current worker 22279 left with exit code 130
> > [WARNING] 323/140435 (22278) : All workers are left. Leaving... (130)
>
> Rebuilding with USE_SYSTEMD and starting with the obviously incorrect
I really don't like this at all, because it means that we'll annoy all
the happy people who are not forced to suffer from systemd, ie basically
all those not running on a recent linux distro, simply because we're starting
to declare that certain environment variables only belong to other operating
systems (which is even worse when such variables are detected when the build
option is *not* set). Also the fact that such variables could be inherited
across multiple layers of processes is even more disgusting.
My suggestion instead would be :
- USE_SYSTEMD=1 enables *build-time* support for lib-sdnotify, as you did.
- -Ws enables *runtime* support for lib-sdnotify provided that USE_SYSTEMD
was enabled at build time. Otherwise it emits an error saying that this
mode is not supported.
- unit files making use of type=notify will call haproxy with -Ws. They
have to be modified anyway to change the type. Let's change both the
type and the startup argument accordingly. If haproxy is built without
USE_SYSTEMD, it will report the error saying that systemd support was
not built in, as you wanted.
- older unit files, those using type=fork, development etc can simply
continue to use -W to match the current behaviour, regardless of the
presence of the build option.
This way there is no confusion, and the working method is not guessed
(with all the frustration this causes when it doesn't work as expected)
but instead enforced. If a unit file references one mode, it must be
consistent with itself and pass the appropriate option as well.
Regards,
Willy