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:
Moving to the Node component.
need to turn into user story
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).
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?
jhonce: ^^
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.
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
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
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.
Finally change the status to "Verified" referring to Comment 8 & 9.
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.
Fixed in https://github.com/openshift/origin-server/pull/1313 Database ports now reported on stderr.
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
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
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