Bug 1015431 - postgresql server configuration is sitting in the wrong place
Summary: postgresql server configuration is sitting in the wrong place
Keywords:
Status: CLOSED WONTFIX
Alias: None
Product: Fedora
Classification: Fedora
Component: postgresql
Version: 20
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Pavel Raiskup
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On: 1145129
Blocks:
TreeView+ depends on / blocked
 
Reported: 2013-10-04 08:46 UTC by Dietmar Kling
Modified: 2014-09-22 13:19 UTC (History)
7 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2014-09-22 13:18:58 UTC
Type: Bug
Embargoed:


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

Description Dietmar Kling 2013-10-04 08:46:30 UTC
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):
postgresql-server-9.2.4-7.fc19.x86_64

How reproducible:


Steps to Reproduce:
1.
2.
3.

Actual results:


Expected results:


Additional info:

Comment 1 Dietmar Kling 2013-10-04 08:47:32 UTC
Created attachment 807490 [details]
sysconfig

Comment 2 Dietmar Kling 2013-10-04 08:48:19 UTC
Created attachment 807491 [details]
posgresql-setup

Comment 3 Pavel Raiskup 2013-10-09 06:06:38 UTC
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 14:40:28 UTC
Kind of relevant topic:
https://lists.fedoraproject.org/pipermail/devel/2014-June/200307.html

Comment 5 Pavel Raiskup 2014-09-22 13:18:58 UTC
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:
  [Service]
  Environment=PGDATA=/whatever/you/want

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.