Graylog2 / fpm-recipes

Graylog package build recipes
http://docs.graylog.org/en/latest/pages/installation/operating_system_packages.html
18 stars 19 forks source link

systemd dependencies missing #75

Closed joschi closed 7 years ago

joschi commented 7 years ago

From @mhutter on November 9, 2016 14:52

When rebooting a server, it is possible for Graylog2 to crash on boot due to MongoDB not being available yet.

I would have sent a PR but I could not find the unit file in any of the Graylog Repos.

Expected Behavior

Graylog starts correctly after a reboot :-)

Current Behavior

Graylog crashes during start after a reboot

Possible Solution

in graylog-server.service, add the following:

[Unit]
After=mongod.service

Steps to Reproduce (for bugs)

  1. Install graylog
  2. reboot system

Your Environment

Copied from original issue: Graylog2/graylog2-server#3074

joschi commented 7 years ago

@mhutter You can find the systemd unit file at https://github.com/Graylog2/fpm-recipes/blob/master/recipes/graylog-server/files/systemd.service

mhutter commented 7 years ago

@joschi Thanks! Looks like I'll have to work on my GitHub-search-fu

bernd commented 7 years ago

@mhutter Thanks for the report! Does this introduce an implicit dependency on a MongoDB system package? What happens if there is no mongod.service present?

We decided to not depend on Elasticsearch and MongoDB packages to make the OS packages more flexible.

mhutter commented 7 years ago

@bernd good point, I'll investigate if there is a way to fix the order without breaking if mongod.service is missing

bernd commented 7 years ago

Closing this due to inactivity. Please re-open if you have any updates. Thank you!

drAlberT commented 6 years ago

This is still an issue .. my server is not starting on reboot due to this problem too

drAlberT commented 6 years ago

These two settings expect a space-separated list of unit names. They configure ordering dependencies between units. If a unit foo.service contains a setting Before=bar.service and both units are being started, bar.service's start-up is delayed until foo.service has finished starting up. Note that this setting is independent of and orthogonal to the requirement dependencies as configured by Requires=, Wants= or BindsTo=. It is a common pattern to include a unit name in both the After= and Requires= options, in which case the unit listed will be started before the unit that is configured with these options

https://www.freedesktop.org/software/systemd/man/systemd.unit.html#Before=

AFAIK Wants + After should be the way

bernd commented 6 years ago

@drAlberT You can create a systemd snipped in /etc/systemd/system/graylog-server.service.d/ to change the Graylog server's systemd config without touching the original files.

We didn't add an explicit MongoDB dependency because the systemd service might be named differently depending on the Linux distribution you are using and our DEB and RPM files are not tied to any distribution.

drAlberT commented 6 years ago

OK, I already did then .. thanks