sensu / sensu-omnibus

Build full-stack platform-specific Sensu packages
12 stars 16 forks source link

Fix systemd unit #267

Closed nervo closed 6 years ago

nervo commented 6 years ago

I think there have been some confusion in this pr: https://github.com/sensu/sensu-omnibus/pull/229

I first noticed some strange issues on our servers, where the sensu-client was sometimes loaded, sometime not, without any reasonable explanations. I then realized that when it was not loaded, the network-online.target systemd unit was not reached too.

So the bug appeared on servers where sensu-client was the only service needing network-online.target.

The systemd documentation is pretty clear: https://www.freedesktop.org/wiki/Software/systemd/NetworkTarget/#cutthecraphowdoimakesurethatmyservicestartsafterthenetworkisreallyonline

So we must use Wants=network-online.target (which is obvious when you realize that network-online must be pulled in), and to avoid chicken/eggs issues, rollback WantedBy to something else, like multi-user.target which mimics runlevels 2 3 4 5, just like the good olds sysvinit scripts.

portertech commented 6 years ago

We need to do some testing. We can start by manually editing an previously installed systemd unit file for a Sensu service.

@amdprophet Can you please tackle this? ❤️

nervo commented 6 years ago

@portertech @amdprophet don't forget to enable the service too, so that the symink will be moved from /etc/systemd/system/network-online.target.wants to /etc/systemd/system/multi-user.target.wants

amdprophet commented 6 years ago

@nervo enabling the service is part of the installation documentation as we don't want the service to start on boot by default.

amdprophet commented 6 years ago

@nervo thanks for the contribution!

nervo commented 6 years ago

@amdprophet of course, it's part of the installation documentation, it just meant for your tests :)