You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by Luca Toscano <to...@gmail.com> on 2020/01/31 03:14:41 UTC
mod_systemd question
Hi everybody,
I tested a bit the mod_systemd backport proposal (thanks Joe for
working on it!) and I have some doubts, that might be due to my
limited understanding of systemd. I tried the following unit on Debian
10 (Buster):
--------------------------------------------------------------------
# /etc/systemd/system/apache2.service
[Unit]
Description=The Apache HTTP Server
After=network.target
[Service]
Type=notify
ExecStart=/usr/local/apache2/bin/httpd -k start
ExecReload=/usr/local/apache2/bin/httpd -k graceful
ExecStop=/usr/local/apache2/bin/httpd -k graceful-stop
PrivateTmp=true
[Install]
WantedBy=multi-user.target
--------------------------------------------------------------------
The type is "notify" on purpose, the "forking" one seems to work fine
but IIUC it doesn't care at all the sd_notify() calls. I didn't put
any "PidFile" since IIUC it should be provided by mod_systemd via
notifications. This is what I get when trying to start:
Starting The Apache HTTP Server...
Started The Apache HTTP Server.
apache2.service: Got notification message from PID 12291, but
reception only permitted for main PID 12290
apache2.service: Got notification message from PID 12291, but
reception only permitted for main PID which is currently not known
apache2.service: Got notification message from PID 12291, but
reception only permitted for main PID which is currently not known
apache2.service: Succeeded.
It seems as if the children processes signal systemd, but in theory
from what I can see sd_notify is called only from hooks running in the
main process. If I add NotifyAccess=all (default to "main"), the "Got
notification etc.." goes away but I don't see any httpd process up.
I am probably missing something obvious, so if anybody can clarify I'd
be happy :) (vote + documentation will follow in exchange!)
Luca
Re: mod_systemd question
Posted by Luca Toscano <to...@gmail.com>.
Il giorno ven 31 gen 2020 alle ore 00:43 Joe Orton <jo...@redhat.com>
ha scritto:
>
> On Fri, Jan 31, 2020 at 08:30:06AM +0100, Ruediger Pluem wrote:
> > On 01/31/2020 04:14 AM, Luca Toscano wrote:
> > > Hi everybody,
> > >
> > > I tested a bit the mod_systemd backport proposal (thanks Joe for
> > > working on it!) and I have some doubts, that might be due to my
> > > limited understanding of systemd. I tried the following unit on Debian
> > > 10 (Buster):
> > >
> > > --------------------------------------------------------------------
> > > # /etc/systemd/system/apache2.service
> > > [Unit]
> > > Description=The Apache HTTP Server
> > > After=network.target
> > >
> > > [Service]
> > > Type=notify
> > > ExecStart=/usr/local/apache2/bin/httpd -k start
> >
> > What if you add -D FOREGROUND to the above?
>
> That should fix the problem described. The Fedora httpd.service is
> designed to be used with mod_systemd and looks like this:
>
> https://src.fedoraproject.org/rpms/httpd/blob/master/f/httpd.service
>
> We could add a cut-down version of that without some Fedora-specific
> stuff, but there are some policy choices here about what reload & stop
> do so it is maybe best left to distributions, not sure. At least I
> could document it better!
I would add a bare minimum unit example in the docs with a warning
about special policy choices, just to give a skeleton to our users to
work on. Will try to add an example in the docs during the next days,
but it shouldn't stop the backport, just voted +1!
Luca
Re: mod_systemd question
Posted by Joe Orton <jo...@redhat.com>.
On Fri, Jan 31, 2020 at 08:30:06AM +0100, Ruediger Pluem wrote:
> On 01/31/2020 04:14 AM, Luca Toscano wrote:
> > Hi everybody,
> >
> > I tested a bit the mod_systemd backport proposal (thanks Joe for
> > working on it!) and I have some doubts, that might be due to my
> > limited understanding of systemd. I tried the following unit on Debian
> > 10 (Buster):
> >
> > --------------------------------------------------------------------
> > # /etc/systemd/system/apache2.service
> > [Unit]
> > Description=The Apache HTTP Server
> > After=network.target
> >
> > [Service]
> > Type=notify
> > ExecStart=/usr/local/apache2/bin/httpd -k start
>
> What if you add -D FOREGROUND to the above?
That should fix the problem described. The Fedora httpd.service is
designed to be used with mod_systemd and looks like this:
https://src.fedoraproject.org/rpms/httpd/blob/master/f/httpd.service
We could add a cut-down version of that without some Fedora-specific
stuff, but there are some policy choices here about what reload & stop
do so it is maybe best left to distributions, not sure. At least I
could document it better!
Regards, Joe
Re: mod_systemd question
Posted by Luca Toscano <to...@gmail.com>.
Il giorno gio 30 gen 2020 alle ore 23:30 Ruediger Pluem
<rp...@apache.org> ha scritto:
>
>
>
> On 01/31/2020 04:14 AM, Luca Toscano wrote:
> > Hi everybody,
> >
> > I tested a bit the mod_systemd backport proposal (thanks Joe for
> > working on it!) and I have some doubts, that might be due to my
> > limited understanding of systemd. I tried the following unit on Debian
> > 10 (Buster):
> >
> > --------------------------------------------------------------------
> > # /etc/systemd/system/apache2.service
> > [Unit]
> > Description=The Apache HTTP Server
> > After=network.target
> >
> > [Service]
> > Type=notify
> > ExecStart=/usr/local/apache2/bin/httpd -k start
>
> What if you add -D FOREGROUND to the above?
Seems working really well now, also together with no NotifyAccess set
(defaulting to "main" that seems a good value).
Will do more testing but so far all good!
Thanks!
Luca
Re: mod_systemd question
Posted by Ruediger Pluem <rp...@apache.org>.
On 01/31/2020 04:14 AM, Luca Toscano wrote:
> Hi everybody,
>
> I tested a bit the mod_systemd backport proposal (thanks Joe for
> working on it!) and I have some doubts, that might be due to my
> limited understanding of systemd. I tried the following unit on Debian
> 10 (Buster):
>
> --------------------------------------------------------------------
> # /etc/systemd/system/apache2.service
> [Unit]
> Description=The Apache HTTP Server
> After=network.target
>
> [Service]
> Type=notify
> ExecStart=/usr/local/apache2/bin/httpd -k start
What if you add -D FOREGROUND to the above?
Regards
RĂ¼diger