Bug 1123850

Summary: Openshift overwrites data/postgresql.conf during restart, destroying Locale and Formatting configuration
Product: OpenShift Container Platform Reporter: Brenton Leanhardt <bleanhar>
Component: ImageStreamsAssignee: Jason DeTiberus <jdetiber>
Status: CLOSED ERRATA QA Contact: libra bugs <libra-bugs>
Severity: medium Docs Contact:
Priority: medium    
Version: 2.1.0CC: gpei, jokerman, jurgencuiza, libra-bugs, libra-onpremise-devel, mfojtik, mmccomas
Target Milestone: ---Keywords: Upstream
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: openshift-origin-cartridge-postgresql-1.29.2-1.git.147.ef6cd67.el6op Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: 1123587 Environment:
Last Closed: 2014-11-03 19:54:36 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On: 1123587    
Bug Blocks:    

Description Brenton Leanhardt 2014-07-28 13:18:10 UTC
+++ This bug was initially created as a clone of Bug #1123587 +++

Description of problem:

Openshift overwrites data/postgresql.conf file resetting all changes made to that file, whenever the database service is restarted, that is, when pushing changes or manually restarting the service via rhc.

Setting up datestyle and locale variables in the Locale and Formatting area is needed to run some applications correctly.

Version-Release number of selected component (if applicable):

Unknown

How reproducible:

Steps to Reproduce:
1. Create an application with a postgresql database. 
2. Modify datestyle and locale vars in data/postgresql.conf.
3. Restart the application or the database service.

Actual results:

Overwriting of data/postgresql.conf file

Expected results:

No overwriting of data/postgresql.conf or making those values configurable via environment value so that the regenerated conf file will contain the desired value. 

Additional info:

A related bug has been posted, referring the postgresql.conf file overwritting but focused on solving other variable set up at https://bugzilla.redhat.com/show_bug.cgi?id=1121727

A question has been opened on Stackoverflow: 
http://stackoverflow.com/questions/24955590/how-to-change-postgresql-conf-default-values-on-openshift

--- Additional comment from Michal Fojtik on 2014-07-28 05:00:16 EDT ---

Thanks for reporting this!

I don't think customizing the data/postgresql.conf is something we want to support or encourage users to do. If you want to set the local vars, we should allow this via the specialized env variables, like:

OPENSHIFT_POSTGRESQL_LOCALE="es_BO.utf8"

I'm going to fix this and I will update the bug with the actual variable name.

--- Additional comment from Michal Fojtik on 2014-07-28 05:41:21 EDT ---

https://github.com/openshift/origin-server/pull/5664

--- Additional comment from openshift-github-bot on 2014-07-28 06:31:19 EDT ---

Commit pushed to master at https://github.com/openshift/origin-server

https://github.com/openshift/origin-server/commit/0cdd022f6316d7597f54620d2805f23b8e866315
Bug 1123587 - Added OPENSHIFT_POSTGRESQL_LOCALE environment variable

Comment 1 Brenton Leanhardt 2014-08-01 12:48:56 UTC
https://github.com/openshift/origin-server/pull/5682

Comment 2 Jason DeTiberus 2014-10-08 02:15:02 UTC
http://etherpad.corp.redhat.com/puddle-2-2-2014-10-07

Comment 3 Gaoyun Pei 2014-10-08 06:31:26 UTC
Verify this bug with openshift-origin-cartridge-postgresql-1.29.2-1.git.147.ef6cd67.el6op.noarch


1. Create a php app with postgresql-9.2 embedded, check its default settings in 
postgresql/data/postgresql.conf:

datestyle = 'iso, mdy'
lc_messages = 'en_US.utf8'
lc_monetary = 'en_US.utf8'
lc_numeric = 'en_US.utf8'
lc_time = 'en_US.utf8'
default_text_search_config = 'pg_catalog.english'


2. Set env vars to modify datestyle and locale vars

rhc env-set OPENSHIFT_POSTGRESQL_LOCALE="zh_CN.utf8" -a app1
Setting environment variable(s) ... done

rhc env-set OPENSHIFT_POSTGRESQL_DATESTYLE="iso, dmy" -a app1
Setting environment variable(s) ... done


3. Restart the postgres cartridge
[root@dhcp-129-188 pei]# rhc cartridge restart postgresql-9 -a app1
Using postgresql-9.2 (PostgreSQL 9.2) for 'postgresql-9'
Restarting postgresql-9.2 ... done


4. Check postgresql/data/postgresql.conf again. The env vars setting by user was taking effect

datestyle = 'iso, dmy'
lc_messages = 'zh_CN.utf8'
lc_monetary = 'zh_CN.utf8'
lc_numeric = 'zh_CN.utf8'
lc_time = 'zh_CN.utf8'

The two env vars also work well with scalable app and postgresql-8.4 cartridge.

Comment 5 errata-xmlrpc 2014-11-03 19:54:36 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://rhn.redhat.com/errata/RHSA-2014-1796.html