Red Hat Bugzilla – Bug 1015431
postgresql server configuration is sitting in the wrong place
Last modified: 2014-09-22 09:19:30 EDT
Created attachment 807489 [details]
Description of problem:
Since Fedora 17 i am modifying the postgresql setup to follow more the rules of sysconfig. Originally i include setting also the encoding however this seems to work now on fedora 20, that initdb picks up the encoding from the system.
But still i believe it is a "bug" to put postgresql port and directory into the systemd service file. sysconfig is the right place, especially when i look into the ugly workaround in postgresql-setup, which cannot deal with with directories with spaces.
* Patch 1 service file
(1) Removes PGPORT and PGDATA values from service file
(2) add path to EnvironmentFile in service file
* Patch 2 sysconfig
(1) Adds variables in sysconfig
* Patch 3 posgresql-setup
(1) Includes sysconfig --> makes PGPORT AND PGDATA
(2) Removes ugly parsing of PGPORT and PGDATA
Version-Release number of selected component (if applicable):
Steps to Reproduce:
Created attachment 807490 [details]
Created attachment 807491 [details]
Dietmar, thanks for this report and your code! Just consider two "hurdles"
for users. Whether the postgresql-setup hack removal is so beneficial that it
makes these hurdles too small should come from discussion.
First, the new /etc/sysconfig/postgresql env file must be %conf and thus user
have to take care of it during upgrades (if changed).
Second, consider "MULTIPLE POSTMASTERS" usecase (see README.rpm-dist). We
need to add another step to the cookbook which suggests user to create another
file, which makes the use case a little bit more complicated.
Kind of relevant topic:
Dietmar, thanks again for this bugreport. Some of the ideas are implemented
via bug #1145129.
Note to the /etc/sysconfig/postgresql: We are strongly discouraged from
doing this (by systemd guys); see the thread from comment #4. That is why
I am closing this WONTFIX. They do not want yet another configuration file
in /etc/postgresql, nor in /etc/sysconfig/*.
The preferred way how to configure services should be via drop-in file e.g. in
/etc/systemd/system/postgresql.service.d/, lets say '10-default.conf', having
According to the spaces in directory path: I filled the bugs 1139154 and
bug 1139148. From the Fedora 22, you may pass EnvironmentFile= into systemd
configuration and postgresql-setup should be able to detect such environment
variables. This is, however, not the preferred way (it is kind of
work-around when you need the PGDATA with spaces).