PostgreSQL systemd config scheme change

Pavel Raiskup praiskup at redhat.com
Mon Jul 7 12:48:40 UTC 2014


On Friday 04 of July 2014 00:09:03 Lennart Poettering wrote:
> On Mon, 23.06.14 16:23, Pavel Raiskup (praiskup at redhat.com) wrote:
> >   $ cat /etc/postgresql/postgresql at com_example
> >   PGDATA=/some/path/pg/com_example
> >   PGPORT=@SOMEPORT@
> >   $ systemctl start postgresql at com_example
> >
> > Would you see something bad on that approach (please, take into
> > account that we would not stop supporting the old way, we just want to
> > make future configuration easier and straight-forward).
>
> Unit files are configuration files.

Kind of - but not so "pure" configuration files because we can not mark
them %config based on packaging guildelines.

> It's OK to copy unit files from
> /usr/lib/systemd/system into /etc/systemd/system and edit it there.

Copying does not work for us (copied service file is no longer packager's
responsibility - which may seem like a benefit but it is at the expense of
admin's comfort).  Drop-in feature would be OK from this POV (.. but see
below the downsides.. ).

> I'd always advise against inventing addition configuration files that
> are neither the daemons own, nor systemd's.

I hope we can call this as a systemd's configuration, or no?  It sounds
like EnvironmentFile is also starting to be deprecated, is it so?

The first neat benefit about this is that the configuration file may be
sourced by any shell script.  The second benefit is that user doesn't need
to bother with so long directory names:

  $ cat /etc/systemd/system/postgresql at com.example.d/redef_sth.conf
  [service]
  Environ=PGDATA=_Pathname_without_spaces_

---

Little off-topic, but imo worth saying.  What I think we miss in systemd
in this regard is (because there are some convenience scripts trying to
automatize usual admin's tasks - and these are dependant on systemd's
configuration):

  * Automatic way of exporting service's environment.  Something like:

    $ systemctl environment postgresql.service
    PGDATA=/path/to/a/data/dir
    PGPORT=5433

    The 'systemctl show -p Environment' does not work for us, because it
    does not expand contents of EnvironmentFile :(.  Also white-space
    problems ..

  * I feel that you try to "standardize" the place where services are
    configured.  What about to have some "standard" location with
    files in EnvironementFile= format.  Could we then mark those as
    %config in spec file?

Pavel



More information about the devel mailing list