Bug 661255 - Providing native systemd file for upcoming F15 Feature Systemd
Providing native systemd file for upcoming F15 Feature Systemd
Status: CLOSED ERRATA
Product: Fedora
Classification: Fedora
Component: varnish (Show other bugs)
rawhide
Unspecified Unspecified
low Severity medium
: ---
: ---
Assigned To: Ingvar Hagelund
Fedora Extras Quality Assurance
:
Depends On:
Blocks: SysVtoSystemd
  Show dependency treegraph
 
Reported: 2010-12-08 05:46 EST by Michał Piotrowski
Modified: 2012-03-13 14:31 EDT (History)
4 users (show)

See Also:
Fixed In Version: varnish-3.0.2-1.fc17
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2012-03-13 14:31:30 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:


Attachments (Terms of Use)
varnishncsa.service (222 bytes, text/plain)
2010-12-08 05:47 EST, Michał Piotrowski
no flags Details
varnishlog.service (215 bytes, text/plain)
2010-12-08 05:47 EST, Michał Piotrowski
no flags Details
varnish.service (263 bytes, text/plain)
2010-12-08 05:50 EST, Michał Piotrowski
no flags Details
systemd service/unit file for varnish (61 bytes, text/plain)
2011-10-14 06:15 EDT, Ingvar Hagelund
no flags Details
environment configuration file for varnish systemd service/unit file (66 bytes, text/plain)
2011-10-14 06:16 EDT, Ingvar Hagelund
no flags Details
varnish systemd service file with configuration environment merged in (78 bytes, text/plain)
2012-01-16 06:27 EST, Ingvar Hagelund
no flags Details
Native systemd service file for varnishncsa (249 bytes, text/plain)
2012-01-16 07:53 EST, Jóhann B. Guðmundsson
no flags Details
Native systemd service file for varnishlog (254 bytes, text/plain)
2012-01-16 07:54 EST, Jóhann B. Guðmundsson
no flags Details
Native systemd service file for varnish (467 bytes, text/plain)
2012-01-16 07:59 EST, Jóhann B. Guðmundsson
no flags Details

  None (edit)
Description Michał Piotrowski 2010-12-08 05:46:37 EST
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
Comment 1 Michał Piotrowski 2010-12-08 05:47:31 EST
Created attachment 467442 [details]
varnishncsa.service
Comment 2 Michał Piotrowski 2010-12-08 05:47:59 EST
Created attachment 467443 [details]
varnishlog.service
Comment 3 Michał Piotrowski 2010-12-08 05:50:17 EST
Created attachment 467446 [details]
varnish.service

User=varnis
Group=varnish
seems to be needed, but it doesn't work - daemon refuses to start.
Comment 4 Michał Piotrowski 2010-12-09 03:45:44 EST
These services should start after network.target
After=syslog.target network.target
Comment 5 Ingvar Hagelund 2011-10-14 06:14:05 EDT
I made an initial attempt, based on the varnish.service file attached above. Please consider the files attached. They may also be found here:

http://users.linpro.no/ingvar/varnish/systemd/

Ingvar
Comment 6 Ingvar Hagelund 2011-10-14 06:15:50 EDT
Created attachment 528185 [details]
systemd service/unit file for varnish

This service/unit file needs an environment config file
Comment 7 Ingvar Hagelund 2011-10-14 06:16:44 EDT
Created attachment 528187 [details]
environment configuration file for varnish systemd service/unit file
Comment 8 Jóhann B. Guðmundsson 2011-10-14 06:23:55 EDT
There is a question if that config file should not be dropped altogether and those variable set as they are and users directed to copy the unit file to /etc/systemd/system then edit it those options there and restart the daemon instead. 

Same amount of work for the user but one less file installed on the system...
Comment 9 Ingvar Hagelund 2012-01-16 06:27:35 EST
Created attachment 555479 [details]
varnish systemd service file with configuration environment merged in
Comment 10 Ingvar Hagelund 2012-01-16 06:28:32 EST
So, something like this? http://users.linpro.no/ingvar/varnish/systemd/varnish.service_with_environment
Comment 11 Jóhann B. Guðmundsson 2012-01-16 07:07:11 EST
Nope not quite let me look at this for a bit
Comment 12 Jóhann B. Guðmundsson 2012-01-16 07:53:46 EST
Created attachment 555497 [details]
Native systemd service file for varnishncsa
Comment 13 Jóhann B. Guðmundsson 2012-01-16 07:54:44 EST
Created attachment 555498 [details]
Native systemd service file for varnishlog
Comment 14 Jóhann B. Guðmundsson 2012-01-16 07:59:20 EST
Created attachment 555499 [details]
Native systemd service file for varnish

Usage of /etc/sysconfig/foo file are no longer necessary and unit containing reference of such files wont work across distributions thus upstream wont accept the units when you submit it there.

Users should now copy the relevant unit file they want to make modification to /etc/systemd/system and add/edit any options to it there like adding additional switches to a daemon when the unit is being started.
Comment 16 Ingvar Hagelund 2012-01-16 09:00:32 EST
Jóhann,

varnishlog and varnishncsa are trivial, so those are fine.

For varnish itself, my last update ("varnish.service_with_environment") does not use sysconfig. It has all options merged into one systemd service file.

Just adding a default set of options may work, but that would be a big step backwards. I would really, really like to keep comments about what the options actually do, as unfortunately, there are a lot of users that won't read all the fine print in the man pages. It also makes the transition from configuration in sysconfig/defaults to systemd easier for the such users.

I also need the configuration to available to other scripts, like varnish_reload_vcl. Inlining the configuration environment in systemd makes it possible to let other scripts do nice and dirty things like emulating sysconfig/defaults:

. <(/bin/systemctl show varnish.service --property=Environment | tr ' ' '\n' )

As for acceptance of systemd files upstream in varnish, that will probably be me, testing it out in Fedora.

Ingvar
Comment 17 Jóhann B. Guðmundsson 2012-01-16 10:46:48 EST
(In reply to comment #16)
> Jóhann,
> 
> varnishlog and varnishncsa are trivial, so those are fine.
> 
> For varnish itself, my last update ("varnish.service_with_environment") does
> not use sysconfig. It has all options merged into one systemd service file.

Which is not the problem here.

> Just adding a default set of options may work, but that would be a big step
> backwards. I would really, really like to keep comments about what the options
> actually do, as unfortunately, there are a lot of users that won't read all the
> fine print in the man pages. It also makes the transition from configuration in
> sysconfig/defaults to systemd easier for the such users.
>

Calling those environment variable from within a unit makes absolutely no sense in your case since you can pass those options directly to the daemon and unit files are not meant to serve as some kind of documentation for command line switches and what those switches do that's what man pages, configuration files 
and upstream documentations. 

> I also need the configuration to available to other scripts, like
> varnish_reload_vcl. Inlining the configuration environment in systemd makes it
> possible to let other scripts do nice and dirty things like emulating
> sysconfig/defaults:
> 
> . <(/bin/systemctl show varnish.service --property=Environment | tr ' ' '\n' )

Both your example here above and suggestion of the unit file are just workarounds.

When unit files starts to get bloated that only highlights an underlying problem.

The underlying problem here with varnish is that it's daemon does not parse configuration file at startup so convincing upstream to fix this would be the absolute best way to proceed in this situation then the unit file could look something like these..

[Unit]
Description=Varnish HTTP Accelerator
After=network.target

[Service]
Type=forking
PIDFile=/run/varnish.pid
LimitNOFILE=131072
LimitMEMLOCK=82000
LimitCORE=infinity
ExecStart=/usr/sbin/varnishd -F /etc/varnish/varnish.conf 
ExecReload=/usr/sbin/varnish_reload_vcl

[Install]
WantedBy=multi-user.target

In that configuration file you could put the documentation and create and use a script to read it's settings.

> As for acceptance of systemd files upstream in varnish, that will probably be
> me, testing it out in Fedora.

Now if upstream is not willing to patch their daemon to support parsing a configuration file then it's better to continue to use an environment file but place it and call it from a distro agnostic place like /etc/varnish directory ( /etc/sysconfig/ is Fedora/Red Hat spesific ).
Comment 18 Fedora Update System 2012-03-07 12:41:47 EST
varnish-3.0.2-1.fc17 has been submitted as an update for Fedora 17.
https://admin.fedoraproject.org/updates/varnish-3.0.2-1.fc17
Comment 19 Fedora Update System 2012-03-07 17:39:44 EST
Package varnish-3.0.2-1.fc17:
* should fix your issue,
* was pushed to the Fedora 17 testing repository,
* should be available at your local mirror within two days.
Update it with:
# su -c 'yum update --enablerepo=updates-testing varnish-3.0.2-1.fc17'
as soon as you are able to.
Please go to the following url:
https://admin.fedoraproject.org/updates/FEDORA-2012-3246/varnish-3.0.2-1.fc17
then log in and leave karma (feedback).
Comment 20 Fedora Update System 2012-03-13 14:31:30 EDT
varnish-3.0.2-1.fc17 has been pushed to the Fedora 17 stable repository.  If problems still persist, please make note of it in this bug report.

Note You need to log in before you can comment on or make changes to this bug.