Support for systemd

Ingvar Hagelund ingvar at
Wed Aug 3 11:17:46 CEST 2011

The last chapter in the saga of sysv init replacements is systemd (1). Fedora 15 has shipped with systemd (2). From what I've heard, Debian (3) and OpenSuSE (4) is migrating. Ubuntu has not made any public announcements on using systemd yet, but there is experimental support (5) .

systemd startup files (so-called unit files) are simpler than the classical init.d shell scripts, and are meant to be distribution agnostic, which means less work on distribution hacks upstream.

Being a cool modern, uh, thing, varnish should probably support systemd too. (I also need systemd support for varnish in Fedora anyway.)

Win: A common systemd unit file for many linux distributions may be distributed and maintained upstream.

Win: Interesting extra features; Some socket activation mechanism that might make varnishd restart completely without loosing connections. (No, I know absolutely nothing about how this works.)

A problem is the way varnish starts up, by reading its startup configuration from environment variables in /etc/{sysconfig|defaults}/varnish. systemd does support reading files with environment variables, but only as a list of VAR=val statements, and not the cumulative way the default sysconfig|defaults file is built up.

Easiest fix for me, most work for developers: Skip the shell based startup that is used by Red Hat, SuSE and Debian derivates, and make varnish itself read its configuration from a file (as an alternative to only support command line options startup).

More or less ugly workaround with minimal changes: Make systemd call a script that boots varnish. The script will look a lot like the start part of the init scripts today

Timeline: No rush. Fedora 15 and 16 will continue to support old style init scripts. (systemd can read an emulate those scripts quite well). I will have to switch to systemd unit files at latest for Fedora 17. RHEL7 will probably use systemd, for what that's worth. I don't know about other distributions.



More information about the varnish-dist mailing list