Bug 980753

Summary: [origin_runtime_157]No OPENSHIFT_POSTGRESQL_VERSION shown in app after having embedded postgresql-9.2 with scalable app
Product: OpenShift Online Reporter: Yan Du <yadu>
Component: ContainersAssignee: Hiro Asari <hasari>
Status: CLOSED NOTABUG QA Contact: libra bugs <libra-bugs>
Severity: medium Docs Contact:
Priority: medium    
Version: 2.xCC: hasari, jkeck
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2013-07-03 09:41:53 EDT Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Description Yan Du 2013-07-03 03:42:00 EDT
Description of problem:
create an app embedded postgresql-9.2, and ssh in to the all, run env | grep POSTGRESQL to check psql environment variables, no OPENSHIFT_POSTGRESQL_VERSION shown



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



How reproducible:
Always



Steps to Reproduce:
1. Create an app and added postgresql-9.2 to the app
$ rhc app create j7s jbossas-7 -s
$ rhc cartridge add -a j7s -c postgresql-9.2
2. ssh the app and env
$ rhc app ssh j7s
$ env | grep POSTGRESQL



Actual results:
no OPENSHIFT_POSTGRESQL_VERSION shown.
[j7s-111.dev.rhcloud.com 574972695356251140259840]\> env | grep POSTGRESQL
OPENSHIFT_POSTGRESQL_DB_PASSWORD=ivpZBTFLARIZ
OPENSHIFT_POSTGRESQL_DB_HOST=f44b4698e39b11e28d3122000a98b95e-111.dev.rhcloud.com
OPENSHIFT_POSTGRESQL_DB_GEAR_DNS=f44b4698e39b11e28d3122000a98b95e-111.dev.rhcloud.com
OPENSHIFT_POSTGRESQL_DB_USERNAME=admins9krum5
OPENSHIFT_POSTGRESQL_DB_GEAR_UUID=f44b4698e39b11e28d3122000a98b95e
OPENSHIFT_POSTGRESQL_DB_URL=postgresql://admins9krum5:ivpZBTFLARIZ@f44b4698e39b11e28d3122000a98b95e-111.dev.rhcloud.com:35546/
OPENSHIFT_POSTGRESQL_DB_PORT=35546



Expected results:
OPENSHIFT_POSTGRESQL_VERSION=9.2 should exist.



Additional info:

it works noramlly with non-scalable app

[j6-111.dev.rhcloud.com 226342571932868581261312]\> env | grep POSTGRESQL
OPENSHIFT_POSTGRESQL_DB_SOCKET=/var/lib/openshift/226342571932868581261312/postgresql//socket/
OPENSHIFT_POSTGRESQL_DB_PASSWORD=_mkDsveFnuyj
OPENSHIFT_POSTGRESQL_DB_HOST=127.0.255.2
OPENSHIFT_POSTGRESQL_IDENT=redhat:postgresql:9.2:0.3.0
OPENSHIFT_POSTGRESQL_DB_PID=/var/lib/openshift/226342571932868581261312/postgresql//pid/postgres.pid
OPENSHIFT_POSTGRESQL_DIR=/var/lib/openshift/226342571932868581261312/postgresql/
OPENSHIFT_POSTGRESQL_DB_USERNAME=adminfc5ar1t
OPENSHIFT_POSTGRESQL_PATH_ELEMENT=/opt/rh/postgresql92/root/usr/bin
OPENSHIFT_POSTGRESQL_DB_URL=postgresql://adminfc5ar1t:_mkDsveFnuyj@127.0.255.2:5432
OPENSHIFT_POSTGRESQL_VERSION=9.2               <<======
OPENSHIFT_POSTGRESQL_DB_PORT=5432
OPENSHIFT_POSTGRESQL_DB_LOG_DIR=/var/lib/openshift/226342571932868581261312/postgresql//log/
Comment 1 Hiro Asari 2013-07-03 09:35:02 EDT
The issue here is not one where the environment variables are not set to expected values. It is that you are connecting to a wrong gear.

On a scaled application, the DB gear and the application gears are most likely different, but the DB environment is set up correctly on the DB gear. Of course, it is not clear how the user would connect to the DB gear.
Comment 2 Hiro Asari 2013-07-03 09:36:13 EDT
*** Bug 980713 has been marked as a duplicate of this bug. ***
Comment 3 Hiro Asari 2013-07-03 09:41:53 EDT
Right.

Use 'rhc app show j7s --gears' to get the correct parameter to connect to the postgresql gear:

$ bx bin/rhc app show j7s --gears
ID                       State   Cartridges            Size  SSH URL
------------------------ ------- --------------------- ----- ------------------------------------------------------------------------------
51d4220ba7ecc11f6c000002 started postgresql-9.2        small 51d4220ba7ecc11f6c000002@51d4220ba7ecc11f6c000002-fooooooooooo.dev.rhcloud.com
51d4220aa7ecc11f6c000001 started jbossas-7 haproxy-1.4 small 51d4220aa7ecc11f6c000001@j7s-fooooooooooo.dev.rhcloud.com

$ ssh 51d4220ba7ecc11f6c000002@51d4220ba7ecc11f6c000002-fooooooooooo.dev.rhcloud.com
…
[51d4220ba7ecc11f6c000002-fooooooooooo.dev.rhcloud.com 51d4220ba7ecc11f6c000002]\> env | sort | grep POSTGRES
OPENSHIFT_POSTGRESQL_DB_HOST=127.0.250.129
OPENSHIFT_POSTGRESQL_DB_LOG_DIR=/var/lib/openshift/51d4220ba7ecc11f6c000002/postgresql//log/
OPENSHIFT_POSTGRESQL_DB_PASSWORD=PYS69-TxbH_s
OPENSHIFT_POSTGRESQL_DB_PID=/var/lib/openshift/51d4220ba7ecc11f6c000002/postgresql//pid/postgres.pid
OPENSHIFT_POSTGRESQL_DB_PORT=5432
OPENSHIFT_POSTGRESQL_DB_PROXY_PORT=35536
OPENSHIFT_POSTGRESQL_DB_SOCKET=/var/lib/openshift/51d4220ba7ecc11f6c000002/postgresql//socket/
OPENSHIFT_POSTGRESQL_DB_URL=postgresql://adminhiwic1u:PYS69-TxbH_s@127.0.250.129:5432
OPENSHIFT_POSTGRESQL_DB_USERNAME=adminhiwic1u
OPENSHIFT_POSTGRESQL_DIR=/var/lib/openshift/51d4220ba7ecc11f6c000002/postgresql/
OPENSHIFT_POSTGRESQL_IDENT=redhat:postgresql:9.2:0.3.0
OPENSHIFT_POSTGRESQL_PATH_ELEMENT=/opt/rh/postgresql92/root/usr/bin
OPENSHIFT_POSTGRESQL_VERSION=9.2