Bug 661255 - Providing native systemd file for upcoming F15 Feature Systemd
Summary: Providing native systemd file for upcoming F15 Feature Systemd
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Fedora
Classification: Fedora
Component: varnish
Version: rawhide
Hardware: Unspecified
OS: Unspecified
low
medium
Target Milestone: ---
Assignee: Ingvar Hagelund
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks: SysVtoSystemd
TreeView+ depends on / blocked
 
Reported: 2010-12-08 10:46 UTC by Michał Piotrowski
Modified: 2012-03-13 18:31 UTC (History)
4 users (show)

Fixed In Version: varnish-3.0.2-1.fc17
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2012-03-13 18:31:30 UTC
Type: ---
Embargoed:


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

Description Michał Piotrowski 2010-12-08 10:46:37 UTC
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 10:47:31 UTC
Created attachment 467442 [details]
varnishncsa.service

Comment 2 Michał Piotrowski 2010-12-08 10:47:59 UTC
Created attachment 467443 [details]
varnishlog.service

Comment 3 Michał Piotrowski 2010-12-08 10:50:17 UTC
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 08:45:44 UTC
These services should start after network.target
After=syslog.target network.target

Comment 5 Ingvar Hagelund 2011-10-14 10:14:05 UTC
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 10:15:50 UTC
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 10:16:44 UTC
Created attachment 528187 [details]
environment configuration file for varnish systemd service/unit file

Comment 8 Jóhann B. Guðmundsson 2011-10-14 10:23:55 UTC
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 11:27:35 UTC
Created attachment 555479 [details]
varnish systemd service file with configuration environment merged in

Comment 10 Ingvar Hagelund 2012-01-16 11:28:32 UTC
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 12:07:11 UTC
Nope not quite let me look at this for a bit

Comment 12 Jóhann B. Guðmundsson 2012-01-16 12:53:46 UTC
Created attachment 555497 [details]
Native systemd service file for varnishncsa

Comment 13 Jóhann B. Guðmundsson 2012-01-16 12:54:44 UTC
Created attachment 555498 [details]
Native systemd service file for varnishlog

Comment 14 Jóhann B. Guðmundsson 2012-01-16 12:59:20 UTC
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 14:00:32 UTC
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 15:46:48 UTC
(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 17:41:47 UTC
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 22:39:44 UTC
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 18:31:30 UTC
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.