Bug 684175

Summary: Providing native systemd file for upcoming F15 Feature Systemd
Product: [Fedora] Fedora Reporter: Jóhann B. Guðmundsson <johannbg>
Component: httpdAssignee: Joe Orton <jorton>
Status: CLOSED RAWHIDE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: rawhideCC: elad, jorton, limburgher, pahan, tcallawa, tomek
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2012-02-13 14:40:44 EST Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Bug Depends On:    
Bug Blocks: 713562    
Attachments:
Description Flags
Native systemd service file for apache
none
httpd-worker.service
none
Native systemd file for the apache mpm prefork
none
Native systemd file for the apache mpm event
none
Native systemd file for the apache mpm worker
none
Resubmitting with correct WantedBy for service
none
Resubmitting with correct WantedBy for service.
none
All three service files. none

Description Jóhann B. Guðmundsson 2011-03-11 06:43:31 EST
Created attachment 483693 [details]
Native systemd service file for apache

Description of problem:

The attached file is a native systemd file for upcoming F15 Feature [1]

Please read [2] on how to packaging and installing systemd Service files.

To learn more about Systemd daemon see [3].

To view old SysV with the new Systemd site by site see for your component see [4]

If you have any question dont hesitate to ask them on this bug report.

1.http://fedoraproject.org/wiki/Features/systemd

2.https://fedoraproject.org/wiki/Systemd_Packaging_Draft

3.http://0pointer.de/public/systemd-man/daemon.html

4.https://fedoraproject.org/wiki/User:Johannbg/QA/Systemd/compatability 

Version-Release number of selected component (if applicable):


How reproducible:


Steps to Reproduce:
1.
2.
3.
  
Actual results:


Expected results:


Additional info:
Comment 1 Joe Orton 2011-03-11 06:54:18 EST
This needs to allow override of $HTTPD, is that possible? Are those Exec* statements evaluated by /bin/sh or internally?  We'd need something like

 ${HTTPD-/usr/sbin/httpd}

in place of simply /usr/sbin/httpd.  Alternatively I guess separate service files for the separate executables.
Comment 2 Jóhann B. Guðmundsson 2011-03-11 08:02:05 EST
Could you give me a bit of bigger picture what's happening here why it's needed and which executable replace httpd so I can try to figure out what is the best solution for this.
Comment 3 Jóhann B. Guðmundsson 2011-03-11 08:31:55 EST
Ah I think I've figured it out. 

Is it not best to have two different service files one httpd.service and another one httpd-worker.service and the httpd service only enabled by default?
Comment 4 Jóhann B. Guðmundsson 2011-03-11 08:49:49 EST
Created attachment 483719 [details]
httpd-worker.service
Comment 5 Jóhann B. Guðmundsson 2011-03-11 10:06:10 EST
There is a way around if necessary which is discourage and not recommended except for some exceptional cases due to some SELinux implications.

Then you would replace Exec{Start/Reload/Restart/Stop}= with something in the line of /bin/bash -c "exec ${HTTPD-/usr/sbin/httpd} $OPTIONS -k start/restart/stop"
Comment 6 Jóhann B. Guðmundsson 2011-03-22 12:28:44 EDT
Ping?
Comment 7 Joe Orton 2011-03-22 12:45:33 EDT
By "SELinux implications" you mean httpd would lose SELinux support, right?  The transition to httpd_t would never happen if executed by bash IIUC.  So that's off the table.

We'd need service files for all three MPMs, best to loop and use %{mpms}.

https://fedoraproject.org/wiki/TomCallaway/Systemd_Revised_Draft

says the naming should be "apache-httpd", not "httpd".

I'm not sure what you mean by "enabled by default".  None of these daemons should be starting at boot by default.
Comment 8 Jóhann B. Guðmundsson 2011-03-22 13:55:08 EDT
> We'd need service files for all three MPMs, best to loop and use %{mpms}.

What's the third one? 

And what do you mean by loop and use %{mpms}?

> https://fedoraproject.org/wiki/TomCallaway/Systemd_Revised_Draft
> 
> says the naming should be "apache-httpd", not "httpd".

We want to create and push the systemd service files and get them accepted upstreams if possible so it should reflect how upstream wants it as in it should be named the same on all distro's I would think. 

> I'm not sure what you mean by "enabled by default".  None of these daemons
> should be starting at boot by default.

Yes you are correct.
Comment 9 Joe Orton 2011-03-29 08:36:28 EDT
See use of %{mpms} in the spec file.
Comment 10 Jóhann B. Guðmundsson 2011-03-29 15:36:48 EDT
Created attachment 488538 [details]
Native systemd file for the apache mpm prefork
Comment 11 Jóhann B. Guðmundsson 2011-03-29 15:38:13 EDT
Created attachment 488539 [details]
Native systemd file for the apache mpm event
Comment 12 Jóhann B. Guðmundsson 2011-03-29 15:39:09 EDT
Created attachment 488541 [details]
Native systemd file for the apache mpm worker
Comment 13 Jóhann B. Guðmundsson 2011-03-29 15:42:39 EDT
Added native systemd service files for mpm events.
Renamed the services files as mentioned in comment 7.
Shorten the Description field.
Comment 14 Jóhann B. Guðmundsson 2011-03-29 15:47:02 EDT
Created attachment 488547 [details]
Resubmitting with correct WantedBy for service
Comment 15 Jóhann B. Guðmundsson 2011-03-29 15:48:02 EDT
Created attachment 488548 [details]
Resubmitting with correct WantedBy for service.
Comment 16 Jóhann B. Guðmundsson 2011-04-12 08:28:58 EDT
It would be good if you can push this into rawhide we are converting more than this script and need to add for example Conflicts= encase they conflict with the apache daemon.
Comment 17 Joe Orton 2011-04-12 08:34:33 EDT
Go ahead and push the changes if they are complete, I presume you are provenpackager?
Comment 18 Jóhann B. Guðmundsson 2011-04-12 09:02:47 EDT
You presume wrong. 

I thought you were testing it since it is rather high profile and perhaps discussing it upstream?
Comment 19 Jóhann B. Guðmundsson 2011-04-12 09:41:25 EDT
Created attachment 491483 [details]
All three service files.

Now I've compressed the final native systemd service files and tested starting stopping and restarting all three of them and they all do so cleanly. 

To test you need to be on F15 or rawhide

uncompress them into /lib/systemd/system/ directory. 

Then run systemctl daemon-reload 

systemctl start apache-mpm-$foo.service to start a service

systemctl stop apache-mpm-$foo.service to stop a service

systemctl restart apache-mpm-$foo.service to restart a service

And

systemctl enable ( or disable ) apache-mpm-$foo.service to enable/disable a service

Given that we now created a three seperated service files along with renaming them commands such as service httpd $foo or chkconfig httpd $foo wont work.
Comment 20 Joe Orton 2011-04-12 10:47:10 EDT
(In reply to comment #19)
> Created attachment 491483 [details]
> All three service files.

Thanks a lot.

> Given that we now created a three seperated service files along with renaming
> them commands such as service httpd $foo or chkconfig httpd $foo wont work.

I didn't realise that... and I don't think that'd be acceptable really.  I've renamed them to httpd (prefork, default), httpd-worker and httpd-event, and pushed this to F16.  Testing welcome!
Comment 21 Tomasz Torcz 2011-04-14 05:02:22 EDT
Unit files shipped in rawhide's httpd-2.2.17-12.fc16.x86_64 are malformed:

ExecStart=%{sbindir}/httpd $OPTIONS -k start
ExecReload=%{sbindir}/httpd $OPTIONS -t
ExecReload=/bin/kill -HUP $MAINPID
ExecStop=%{sbindir}/httpd $OPTIONS -k stop

Those macros should've been expanded. Systemd requires full paths.
Comment 22 Joe Orton 2011-04-14 11:45:18 EDT
Thanks Tomasz, pushed -13 to fix that.
Comment 23 Bill Nottingham 2011-04-26 13:36:00 EDT
Moving systemd service RFEs to rawhide.

At this point, it is not appropriate in the Fedora 15 cycle to add these. Furthermore, at this point, we are still finalizing the packaging guidelines to handle SysV -> systemd upgrades.

We therefore request:
- wait until there are packaging guidelines (this will be announced on the devel list). This ensures that upgrades will work smoothly and we/you won't have to do multiple sets of changes.
- work on these sorts of changes for Fedora 16 where necessary, not Fedora 15, as we're trying to fix things for release.
- do *not* change a service from SysV to systemd in an existing release (such as Fedora 15), as this is the sort of behavior change that goes against our update policy, documented as https://fedoraproject.org/wiki/Updates_Policy
Comment 24 Elad Alfassa 2011-06-20 02:18:44 EDT
*** Bug 714568 has been marked as a duplicate of this bug. ***
Comment 25 Jóhann B. Guðmundsson 2011-07-11 12:16:35 EDT
Joe you need to update you spec file to either drop or subpackage the legacy sysv init script as stated in the now existing official guidelines for systemd 

https://fedoraproject.org/wiki/Packaging:Guidelines:Systemd
https://fedoraproject.org/wiki/Packaging:ScriptletSnippets#Systemd
https://fedoraproject.org/wiki/Packaging:Tmpfiles.d

Ones fixed please close this bug :)
Comment 26 Jon Ciesla 2012-02-13 14:40:44 EST
Looks like this is complete as of 1/16/2012, with a correction 1/23/2012.