Bug 1015431 - postgresql server configuration is sitting in the wrong place
postgresql server configuration is sitting in the wrong place
Product: Fedora
Classification: Fedora
Component: postgresql (Show other bugs)
Unspecified Unspecified
unspecified Severity unspecified
: ---
: ---
Assigned To: Pavel Raiskup
Fedora Extras Quality Assurance
Depends On: 1145129
  Show dependency treegraph
Reported: 2013-10-04 04:46 EDT by Dietmar Kling
Modified: 2014-09-22 09:19 EDT (History)
7 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2014-09-22 09:18:58 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)
service file (594 bytes, patch)
2013-10-04 04:46 EDT, Dietmar Kling
no flags Details | Diff
sysconfig (262 bytes, patch)
2013-10-04 04:47 EDT, Dietmar Kling
no flags Details | Diff
posgresql-setup (1.10 KB, patch)
2013-10-04 04:48 EDT, Dietmar Kling
no flags Details | Diff

  None (edit)
Description Dietmar Kling 2013-10-04 04:46:30 EDT
Created attachment 807489 [details]
service file

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.

See  patches.
* 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):

How reproducible:

Steps to Reproduce:

Actual results:

Expected results:

Additional info:
Comment 1 Dietmar Kling 2013-10-04 04:47:32 EDT
Created attachment 807490 [details]
Comment 2 Dietmar Kling 2013-10-04 04:48:19 EDT
Created attachment 807491 [details]
Comment 3 Pavel Raiskup 2013-10-09 02:06:38 EDT
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.
Comment 4 Pavel Raiskup 2014-06-23 10:40:28 EDT
Kind of relevant topic:
Comment 5 Pavel Raiskup 2014-09-22 09:18:58 EDT
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
contents like:

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).

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