Bug 876247 - For a scaled application, 'rhc-list-ports' command does not return ports for Database cartridges
Summary: For a scaled application, 'rhc-list-ports' command does not return ports for ...
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: OKD
Classification: Red Hat
Component: Containers
Version: 2.x
Hardware: All
OS: Unspecified
medium
medium
Target Milestone: ---
: ---
Assignee: Jhon Honce
QA Contact: libra bugs
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2012-11-13 16:17 UTC by Hiro Asari
Modified: 2015-05-14 23:02 UTC (History)
4 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2013-02-14 00:36:32 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)

Description Hiro Asari 2012-11-13 16:17:53 UTC
Description of problem:
When a DB cartridge is added to a scaled application, "rhc-list-ports" command on the server does not return ports belonging to the application.

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


How reproducible:
Always


Steps to Reproduce:
1. rhc application create foo jbossas-7 -n bar -s
2. rhc cartridge add mongodb-2.2 -a foo -n bar
3. ssh to the server, run "rhc-list-ports > /dev/null"
  
Actual results:
[bar-foofoo.dev.rhcloud.com ~]\> rhc-list-ports > /dev/null
haproxy -> 127.0.250.130:8080
haproxy -> 127.0.250.131:8080
java -> 127.0.250.129:3528
java -> 127.0.250.129:4447
java -> 127.0.250.129:5445
java -> 127.0.250.129:5455
java -> 127.0.250.129:8080
java -> 127.0.250.129:9990
java -> 127.0.250.129:9999


Expected results:
[bar-foofoo.dev.rhcloud.com ~]\> rhc-list-ports > /dev/null
haproxy -> 127.0.250.130:8080
haproxy -> 127.0.250.131:8080
java -> 127.0.250.129:3528
java -> 127.0.250.129:4447
java -> 127.0.250.129:5445
java -> 127.0.250.129:5455
java -> 127.0.250.129:8080
java -> 127.0.250.129:9990
java -> 127.0.250.129:9999
mongod -> 127.0.250.NNN:27017
mongos -> 127.0.250.NNN:27018
mongod -> 127.0.250.NNN:27019
mongod -> 127.0.250.NNN:28017


Additional info:

Comment 1 Hiro Asari 2012-11-13 16:23:43 UTC
Moving to the Node component.

Comment 2 John Poelstra 2012-11-14 19:14:23 UTC
need to turn into user story

Comment 3 Jhon Honce 2012-12-03 18:44:20 UTC
The node can provide the following output:

$ rhc-list-ports
127.0.251.1:34774
127.0.251.1:8080
127.0.251.2:8080
127.0.251.3:8080
haproxy -> 127.0.251.2:8080
haproxy -> 127.0.251.3:8080
httpd -> 127.0.251.1:8080
ruby -> 127.0.251.1:34774
MONGODB -> 752808fa1f-jwh201211301047.dev.rhcloud.com:35556
MYSQL -> 8087b7f8d0-jwh201211301047.dev.rhcloud.com:35551
SCALE5313d0dc273e4b698e82a1ab50f4c203


If this is insufficient, then rhc-list-ports will need to be implemented on the broker as the node has no other visibility into database gear(s).

Comment 4 Hiro Asari 2012-12-14 14:50:10 UTC
Hi, Jhon,

The output looks pretty good.

The format seems to me that it is split by ' -> ' with the left side being the name of the service, and the right side being the host and port. Most likely I will be matching with

/\A(\S+) -> (\S+)\z/

There are a few lines in the example here that don't have ' -> '. Is it safe to assume that 'rhc port-forward' can ignore them?

Comment 5 Dan McPherson 2013-01-31 16:00:27 UTC
jhonce: ^^

Comment 6 Jhon Honce 2013-02-04 17:44:34 UTC
Fixed in https://github.com/openshift/origin-server/pull/1294

The lines that begin with SCALE are showing scaled applications. They are reachable via the haproxy ports.

Comment 7 openshift-github-bot 2013-02-04 20:09:40 UTC
Commit pushed to master at https://github.com/openshift/origin-server

https://github.com/openshift/origin-server/commit/70f1333960a5f0fdfc5398c0abf476a3a570d4d2
Bug 876247 - Report attached databases in a scaled application via rhc-list-ports

* Added loop over .env/.uservars for attached databases

Comment 8 Zhe Wang 2013-02-05 06:30:55 UTC
Assign back this bug, since it was reproduced in devenv_2772.

Steps:

1. rhc application create foo jbossas-7 -n bar -s
2. rhc cartridge add mongodb-2.2 -a foo -n bar
3. ssh to the server, run "rhc-list-ports > /dev/null"
4. run "rhc-list-ports"

Actual results:

3. [sjbsas-dev2772tst.dev.rhcloud.com ~]\> rhc-list-ports > /dev/null
haproxy -> 127.1.5.2:8080
haproxy -> 127.1.5.3:8080
java -> 127.1.5.1:3528
java -> 127.1.5.1:4447
java -> 127.1.5.1:5445
java -> 127.1.5.1:5455
java -> 127.1.5.1:8080
java -> 127.1.5.1:9990
java -> 127.1.5.1:9999

4. [sjbsas-dev2772tst.dev.rhcloud.com ~]\> rhc-list-ports
127.1.5.1:3528
127.1.5.1:4447
127.1.5.1:5445
127.1.5.1:5455
127.1.5.1:8080
127.1.5.1:9990
127.1.5.1:9999
127.1.5.2:8080
127.1.5.3:8080
haproxy -> 127.1.5.2:8080
haproxy -> 127.1.5.3:8080
java -> 127.1.5.1:3528
java -> 127.1.5.1:4447
java -> 127.1.5.1:5445
java -> 127.1.5.1:5455
java -> 127.1.5.1:8080
java -> 127.1.5.1:9990
java -> 127.1.5.1:9999
mongodb -> 5110a0fdb7-dev2772tst.dev.rhcloud.com:35691
mysql -> 5110a34db7-dev2772tst.dev.rhcloud.com:35706

Comment 9 Zhe Wang 2013-02-05 07:25:40 UTC
Change the status back to "ON_QA".

Sorry for the misunderstanding to Comment 3, which I considered as the output when running "rhc-list-ports" WITHOUT "> /dev/null" in STG (The results in Comment 8 shows the difference), but it was a temp fix in fact.


Moreover, the results in Comment 8 indicates that the output of rhc-list-ports in master (devenv_2772) matches the proposed one in Comment 3 & 4.

Comment 10 Zhe Wang 2013-02-05 07:26:39 UTC
Finally change the status to "Verified" referring to Comment 8 & 9.

Comment 11 Hiro Asari 2013-02-05 15:32:07 UTC
Jhon,

It looks like scalable DB connection information are written to STDOUT, whilst application ports are written to STDERR.

Is this intentional? Should the UI tools rely on this distinction? Right now, rhc assumes that the information is written to STDERR.

Comment 12 Jhon Honce 2013-02-05 16:42:18 UTC
Fixed in https://github.com/openshift/origin-server/pull/1313

Database ports now reported on stderr.

Comment 13 openshift-github-bot 2013-02-06 00:53:09 UTC
Commit pushed to master at https://github.com/openshift/origin-server

https://github.com/openshift/origin-server/commit/11dd608873f949ec62c92a67678f389134d177ff
Bug 876247 - Write DB forwarding to stderr

* The rhc scritps expect the port forwarding information on stderr not stdout

Comment 14 Jianwei Hou 2013-02-06 05:49:52 UTC
Verified on devenv_2779

Now, the DB forwarding is written to stderr

[php1s-2779t.dev.rhcloud.com ~]\> rhc-list-ports
127.0.252.129:8080
127.0.252.130:8080
127.0.252.131:8080
haproxy -> 127.0.252.130:8080
haproxy -> 127.0.252.131:8080
httpd -> 127.0.252.129:8080
mongodb -> 5111ec3f83-2779t.dev.rhcloud.com:35571


[php1s-2779t.dev.rhcloud.com ~]\> rhc-list-ports 1>/dev/null
haproxy -> 127.0.252.130:8080
haproxy -> 127.0.252.131:8080
httpd -> 127.0.252.129:8080
mongodb -> 5111ec3f83-2779t.dev.rhcloud.com:35571

[php1s-2779t.dev.rhcloud.com ~]\> rhc-list-ports 2>/dev/null
127.0.252.129:8080
127.0.252.130:8080
127.0.252.131:8080

Comment 15 openshift-github-bot 2013-02-06 05:51:51 UTC
Commit pushed to master at https://github.com/openshift/origin-server

https://github.com/openshift/origin-server/commit/145b2b7c25f134bbf8198954d22657f51282d861
Bug 876247 - Write DB forwarding to stderr

* The rhc scritps expect the port forwarding information on stderr not stdout


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