New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dnsdist: Add support for systemd-notify #3677

Merged
merged 3 commits into from Apr 13, 2016

Conversation

Projects
None yet
3 participants
@pieterlexis
Member

pieterlexis commented Apr 7, 2016

We now also install our dnsdist.service file from make install.

Needs review

@pieterlexis pieterlexis force-pushed the pieterlexis:dnsdist-systemd-notify-support branch from f08bdf6 to ec22bbb Apr 7, 2016

@rgacogne

This comment has been minimized.

Member

rgacogne commented Apr 8, 2016

Nice! Perhaps we could also fallback to 'simple' if systemd support is not available, like weakforced does since 1?

@pieterlexis

This comment has been minimized.

Member

pieterlexis commented Apr 8, 2016

After pondering this, I feel there is no reason to generate a service file at all if there are no systemd(-dev) libraries installed, as the program is not intended to be run inside of systemd. We can stick a Type=simple service file in the contrib dir and have some documentation about this.

@pieterlexis pieterlexis force-pushed the pieterlexis:dnsdist-systemd-notify-support branch from ec22bbb to b141d4d Apr 8, 2016

sock = getenv("NOTIFY_SOCKET");
if(sock != NULL) // Are we indeed running inside of systemd?
g_cmdLine.beSupervised=true;
#endif

This comment has been minimized.

@Habbie

Habbie Apr 11, 2016

Member

This can be overridden from the commandline still, I presume?

This comment has been minimized.

@pieterlexis

pieterlexis Apr 11, 2016

Member

not if your actually running inside systemd. There is no other way (as daemonizing will break systemd's detection of a startup and not being supervised will spawn a console with a closed stdin, leading to program termination) to do this. We could just exit(1) here and print a message asking the user to start with --supervised

AC_DEFUN([AX_CHECK_SYSTEMD_LIBS], [
AC_CHECK_HEADER([systemd/sd-daemon.h], [
AC_CHECK_LIB([systemd-daemon], [sd_listen_fds], [libsystemddaemon="y"])

This comment has been minimized.

@rgacogne

rgacogne Apr 11, 2016

Member

This seems to fail on Arch because libsystemd-daemon.so has been merged into libsystemd.so a while ago (looks like it was in version 209).

This comment has been minimized.

@pieterlexis

pieterlexis Apr 12, 2016

Member

Even centos 7's pkg-config mentions it as 'deprecated'. Debian jessie has systemd 215, so I'll just change the systemd-daemon to systemd

# systemd.m4 - Macros to check for and enable systemd -*- Autoconf -*-
#
# Copyright (C) 2014 Luis R. Rodriguez <mcgrof@suse.com>
#

This comment has been minimized.

@Habbie

Habbie Apr 11, 2016

Member

Can we note the origin (including revision) of this file (or whatever we replace it with to fix @rgacogne's report)?

@pieterlexis pieterlexis force-pushed the pieterlexis:dnsdist-systemd-notify-support branch 6 times, most recently from e26d287 to 0cd2a77 Apr 12, 2016

pieterlexis added some commits Apr 12, 2016

dnsdist: patch the systemd.m4
This patch is twofold:
1 - It detects the correct library for sd-daemon (either
libsystemd-daemon (systemd pre-209) or libsystemd (systemd post-209)
2 - Detection of the library and files is only run once, even when
systemd support detection is automatic (when using AX_AVAILABLE_SYSTEMD)

@pieterlexis pieterlexis force-pushed the pieterlexis:dnsdist-systemd-notify-support branch from 0cd2a77 to a1c0a38 Apr 12, 2016

@pieterlexis

This comment has been minimized.

Member

pieterlexis commented Apr 12, 2016

I fixed up this PR so our packages use this and tested the resulting packages

@rgacogne rgacogne merged commit 369bec1 into PowerDNS:master Apr 13, 2016

1 check passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details

@pieterlexis pieterlexis deleted the pieterlexis:dnsdist-systemd-notify-support branch Apr 13, 2016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment