When running the rhc-port-forward on a jbossas application on production, the httpd/java process are not listed in tha available ports. Consequently, remote debugging java applications on JBoss AS is not possible. Below, an extract of the command output: rhc-port-forward -a test2 Password: Submitting form: debug: true rhlogin: xcoulon Contacting https://openshift.redhat.com Checking available ports... ssh -t 7155b6a0a47b42049b55c58571e948b3.com 'rhc-list-ports' Binding mongod -> 127.10.187.1:27017... Binding mysqld -> 127.10.187.1:3306... ssh -N -L 127.10.187.1:27017:127.10.187.1:27017 -L 127.10.187.1:3306:127.10.187.1:3306 7155b6a0a47b42049b55c58571e948b3.com
ssh to your app: 7155b6a0a47b42049b55c58571e948b3.com and run ps, see if jboss is running.
indeed, application was not running. I did not try the 'ps' command in ssh, just performed a 'restart' from the 'rhc' CLI and it worked. Sorry, I was not aware of the 'idler' that stops the application if it is not used...
According to comments 2, that's because the app is idle, so can we provide useful information while port-forward an idle app or stopped app ?
rhc-port-forward should check app status and return appropriate message to user.
Coincidentally Fabiano fixed this as part of a review comment. Ffranz believe this is fixed
This bug has been checked on the latest client. Please refer to the details as below: Build: rhc.0.98.10.gem int.openshift.redhat.com(devenv_2138) Steps: 1. Create an jbossas app. 2. Stop this app to check rhc port-forward status. 3. Add cartridge like postgresql to this stopped app. 4. Check rhc port-forward status. Actual results: To step 2: The message is shown as below: # rhc port-forward -a jbosap -p redhat Checking available ports... No available ports to forward To step 4: The message is still as same as before, the running postgressql port is listed and no appropriate message is displayed to indicate the app status is stopped or not. # rhc port-forward -a jbosap -p redhat Checking available ports... Binding postgres -> 127.7.14.129:5432... Use ctl + c to stop It seems this bug is not fixed yet, could you please help double confirm? Thanks.
Fixed on rhc-0.98.12-1+, added meaningful message.
This bug has been verified and partially fixed. Please refer to the details as below: Verified build: rhc-0.98.14.gem devenv_2155 Verified steps: 1. Create an jbossas app. 2. Stop this app to check rhc port-forward status. 3. Add cartridge like postgresql and mongodb to this stopped app. 4. Check rhc port-forward status. Verified results: To step2: It's fixed as meaningful message is shown in red color as below: # rhc port-forward -a jbosap -p a Checking available ports... There are no available ports to forward for this application. Your application may be stopped. To step4: The added cartridges port are forwarded, but no meaning full message is shown to indicate the app status is stopped while no httpd/java process listed as below: # rhc port-forward -a jbosap -p a Checking available ports... Binding mongod -> 127.0.250.129:27017... Binding postgres -> 127.0.250.129:5432... Forwarding ports, use ctl + c to stop
I tweaked this a little bit as a part of US2773. When an application is down, server will respond with no ports to forward. When this happens, we query broker and find if the application is known to be down. If so, we inform the user appropriately. This should be included in fork_ami_us2773_273. The output follows: ===== $ bx bin/rhc app show test47145925 --state Password: RESULT: Geargroup php-5.3 is stopped $ bx bin/rhc port-forward test47145925 Password: Checking available ports... Application test47145925 is stopped. Please restart the application and try again.
I tried this on fork_ami_US2773_273 and port_forwarding failed with an error message on the stopped app. - c^CChandrikas-MacBook-Pro:rhtest3 chandrikagole$ rhc app show --state -a jb2 Password: RESULT: Geargroup jbossas-7 is stopped Chandrikas-MacBook-Pro:rhtest3 chandrikagole$ rhc port-forward -a jb2 -d Password: DEBUG: Connecting to https://ec2-23-20-115-196.compute-1.amazonaws.com/broker/rest/api DEBUG: Client supports API versions 1.0, 1.1, 1.2 DEBUG: Server supports API versions 1.0, 1.1, 1.2, 1.3 DEBUG: Client API version 1.2 is not current. Refetching API DEBUG: Getting all domains DEBUG: Request: #<RestClient::Request:0x105bb5cf0 @tf=nil, @password=nil, @verify_ssl=false, @ssl_ca_file=nil, @user=nil, @url="https://ec2-23-20-115-196.compute-1.amazonaws.com/broker/rest/domains", @raw_response=false, @processed_headers={"Authorization"=>"Basic Y2dvbGVAcmVkaGF0LmNvbTo=", "Content-Type"=>"application/x-www-form-urlencoded", "User-Agent"=>"rhc/1.0.3 (ruby 1.8.7; universal-darwin11.0)", "Content-Length"=>"0", "Accept-Encoding"=>"gzip, deflate", "Accept"=>"application/json; version=1.2"}, @open_timeout=nil, @payload="", @ssl_client_key=nil, @method="GET", @headers={:accept=>:json, "Authorization"=>"Basic Y2dvbGVAcmVkaGF0LmNvbTo=", "User-Agent"=>"rhc/1.0.3 (ruby 1.8.7; universal-darwin11.0)", "Accept"=>"application/json; version=1.2"}, @max_redirects=10, @timeout=nil, @cookies={}, @ssl_client_cert=nil, @args={:payload=>{}, :timeout=>nil, :url=>"https://ec2-23-20-115-196.compute-1.amazonaws.com/broker/rest/domains", :method=>"GET", :headers=>{:accept=>:json, "Authorization"=>"Basic Y2dvbGVAcmVkaGF0LmNvbTo=", "User-Agent"=>"rhc/1.0.3 (ruby 1.8.7; universal-darwin11.0)", "Accept"=>"application/json; version=1.2"}}, @block_response=nil> DEBUG: Finding domain cgolecg DEBUG: Getting all domains DEBUG: Request: #<RestClient::Request:0x105b5a8a0 @tf=nil, @password=nil, @verify_ssl=false, @ssl_ca_file=nil, @user=nil, @url="https://ec2-23-20-115-196.compute-1.amazonaws.com/broker/rest/domains", @raw_response=false, @processed_headers={"Authorization"=>"Basic Y2dvbGVAcmVkaGF0LmNvbTo=", "Content-Type"=>"application/x-www-form-urlencoded", "User-Agent"=>"rhc/1.0.3 (ruby 1.8.7; universal-darwin11.0)", "Content-Length"=>"0", "Accept-Encoding"=>"gzip, deflate", "Accept"=>"application/json; version=1.2"}, @open_timeout=nil, @payload="", @ssl_client_key=nil, @method="GET", @headers={:accept=>:json, "Authorization"=>"Basic Y2dvbGVAcmVkaGF0LmNvbTo=", "User-Agent"=>"rhc/1.0.3 (ruby 1.8.7; universal-darwin11.0)", "Accept"=>"application/json; version=1.2"}, @max_redirects=10, @timeout=nil, @cookies={}, @ssl_client_cert=nil, @args={:payload=>{}, :timeout=>nil, :url=>"https://ec2-23-20-115-196.compute-1.amazonaws.com/broker/rest/domains", :method=>"GET", :headers=>{:accept=>:json, "Authorization"=>"Basic Y2dvbGVAcmVkaGF0LmNvbTo=", "User-Agent"=>"rhc/1.0.3 (ruby 1.8.7; universal-darwin11.0)", "Accept"=>"application/json; version=1.2"}}, @block_response=nil> D, [2012-11-14T15:56:14.445657 #5752] DEBUG -- : Finding application :name => jb2, :framework => D, [2012-11-14T15:56:14.445777 #5752] DEBUG -- : Getting all applications for domain cgolecg D, [2012-11-14T15:56:14.446039 #5752] DEBUG -- : Request: #<RestClient::Request:0x105b03a78 @tf=nil, @password=nil, @verify_ssl=false, @ssl_ca_file=nil, @user=nil, @url="https://ec2-23-20-115-196.compute-1.amazonaws.com/broker/rest/domains/cgolecg/applications", @raw_response=false, @processed_headers={"Authorization"=>"Basic Y2dvbGVAcmVkaGF0LmNvbTo=", "Content-Type"=>"application/x-www-form-urlencoded", "User-Agent"=>"rhc/1.0.3 (ruby 1.8.7; universal-darwin11.0)", "Content-Length"=>"0", "Accept-Encoding"=>"gzip, deflate", "Accept"=>"application/json; version=1.2"}, @open_timeout=nil, @payload="", @ssl_client_key=nil, @method="GET", @headers={:accept=>:json, "Authorization"=>"Basic Y2dvbGVAcmVkaGF0LmNvbTo=", "User-Agent"=>"rhc/1.0.3 (ruby 1.8.7; universal-darwin11.0)", "Accept"=>"application/json; version=1.2"}, @max_redirects=10, @timeout=nil, @cookies={}, @ssl_client_cert=nil, @args={:payload=>{}, :timeout=>nil, :url=>"https://ec2-23-20-115-196.compute-1.amazonaws.com/broker/rest/domains/cgolecg/applications", :method=>"GET", :headers=>{:accept=>:json, "Authorization"=>"Basic Y2dvbGVAcmVkaGF0LmNvbTo=", "User-Agent"=>"rhc/1.0.3 (ruby 1.8.7; universal-darwin11.0)", "Accept"=>"application/json; version=1.2"}}, @block_response=nil> Using ssh://bfb041e3a4a34175af4f09eebc39d6cb.rhcloud.com... Checking available ports... bfb041e3a4a34175af4f09eebc39d6cb Error trying to forward ports. You can try to forward manually by running: ssh -N bfb041e3a4a34175af4f09eebc39d6cb.rhcloud.com
Could you try fork_ami_us2773_298? Thank you.
I am still seeing this on fork_ami_us2773_298 1. Create an jbossas app. 2. Stop this app to check rhc port-forward status. Chandrikas-MacBook-Pro:tmp chandrikagole$ rhc port-forward -a jb1 Password: Checking available ports... There are no available ports to forward for this application. Your application may be stopped. 3. Add cartridge like postgresql and mongodb to this stopped app. 4. Check rhc port-forward status. Chandrikas-MacBook-Pro:tmp chandrikagole$ rhc port-forward -a jb1 Password: Checking available ports... Binding postgres -> 127.0.250.129:5432... Forwarding ports, use ctl + c to stop Error trying to forward ports. You can try to forward manually by running: ssh -N -L 127.0.250.129:5432:127.0.250.129:5432 abe8b1b27f5548dc93cb78ca527e1f7e.rhcloud.com
Ah. You are running 'rhc' from your local machine. That won't work. You should run 'rhc' on the fork_ami image. I apologize that the instructions weren't clear. Can you test 'rhc' on the image? You can connect to 'localhost' to set up, and so on. === [root@ip-10-77-10-64 ~]# rhc setup Starting Interactive Setup for OpenShift's command line interface We'll help get you setup with just a couple of questions. You can skip this in the future by copying your config's around: /root/.openshift/express.conf /root/.ssh/ To connect to localhost enter your OpenShift login (email or Red Hat login id): test Password: ⋮ ⋮ ⋮ [root@ip-10-77-10-64 ~]# rhc app show foo --state Password: RESULT: Geargroup jbossas-7 is stopped [root@ip-10-77-10-64 ~]# rhc port-forward foo Password: Checking available ports... Application foo is stopped. Please restart the application and try again.
(In reply to comment #12) > I am still seeing this on fork_ami_us2773_298 > > 1. Create an jbossas app. > 2. Stop this app to check rhc port-forward status. > > Chandrikas-MacBook-Pro:tmp chandrikagole$ rhc port-forward -a jb1 > Password: > > Checking available ports... > There are no available ports to forward for this application. Your > application may be stopped. > > > 3. Add cartridge like postgresql and mongodb to this stopped app. > > 4. Check rhc port-forward status. > > Chandrikas-MacBook-Pro:tmp chandrikagole$ rhc port-forward -a jb1 > > Password: > > Checking available ports... > Binding postgres -> 127.0.250.129:5432... > Forwarding ports, use ctl + c to stop > > Error trying to forward ports. You can try to forward manually by running: > ssh -N -L 127.0.250.129:5432:127.0.250.129:5432 > abe8b1b27f5548dc93cb78ca527e1f7e.rhcloud.com Hi Chandrika, There's a workaround for MacOS, please refer to the instructions from the guide below: https://access.redhat.com/knowledge/docs/en-US/OpenShift/2.0/html/User_Guide/sect-OpenShift-User_Guide-Application_Maintenance_Monitoring_and_Troubleshooting-Performing_Application_Maintenance_from_Your_Workstation.html#sect-OpenShift-User_Guide-Port_Forwarding
For this bug, it works well when using rhc port-forward for a stopped/idled app, but for the stopped app with running db cartirdges, no clear message is shown that the app status is stopped. Please refer to the details as below: Build: fork_ami_us2773_298 client built from fork_ami_us2773_298 Steps: 1. Create an app: #rhc app create php2 php-5.3 -p xx 2. Stop this app and check rhc port-forward result 3. Add cartridge to this stopped app and make sure added cartridge is running #rhc cartridge add postgresql-8.4 -a php2 -p xx 4. Try to use rhc port-forward again. Actual result: To step2: Meaningful message is shown as below: # rhc port-forward php2 -p a Checking available ports... Application php2 is stopped. Please restart the application and try again. To step4:No meaningful message shown to indicate that the app status is stopped, it just forward the running cartridges ports. # rhc port-forward php2 -p a Checking available ports... Forwarding ports Service Connect to Forward to ======== ================== ==== ================== postgres 127.0.250.129:5432 => 127.0.250.129:5432 Expected results: To step4: There should be meaningful messages shown that the app status is stopped, and meanwhile running postgresql port is forwarded succesfully. Additional info: If try to stop both the app and added db cartridge, it can work well as below: # rhc port-forward php2 Checking available ports... Application php2 is stopped. Please restart the application and try again.
(In reply to comment #15) > For this bug, it works well when using rhc port-forward for a stopped/idled > app, but for the stopped app with running db cartirdges, no clear message is > shown that the app status is stopped. This is a known issue with distributed cartridges. Please see https://bugzilla.redhat.com/show_bug.cgi?id=812418 Also, US2773 addresses the issue with Mac OS X, which Chandrika alluded to in comment #12. The message shows that local ports are forwarded to the appropriate host and port. (Unfortunately, you will have to fetch the source from my repo/branch if you want to try it.)
Sorry. The correct bugzilla ticket for the known issue is https://bugzilla.redhat.com/show_bug.cgi?id=876247
(In reply to comment #17) > Sorry. The correct bugzilla ticket for the known issue is > https://bugzilla.redhat.com/show_bug.cgi?id=876247 It seems this bug is quite different with the known issue above, Let me make it more clear for your reference: Steps: 1. Create an app: #rhc app create php2 php-5.3 -p xx 2. Add cartridge to this app #rhc cartridge add postgresql-8.4 -a php2 -p xx 3. Stop app and make sure the DB cartridge in running # rhc app stop php2 Password: ****** RESULT: php2 stopped # rhc cartridge status postgresql-8.4 -a php2 -p redhat RESULT: PostgreSQL server instance is running 4.#rhc port-forward php2 Actual results: # rhc port-forward php2 -p redhat Checking available ports... Binding postgres -> 127.5.211.129:5432... Forwarding ports, use ctl + c to stop Expected results: According to the port-forward results above, user is not aware of the app is stopped. It's expected to see a friendly message like "application is stopped" while the running postgresql port is forwarded. eg: # rhc port-forward php2 -p redhat Checking available ports... Binding postgres -> 127.5.211.129:5432... Application php2 is stopped Forwarding ports, use ctl + c to stop
(In reply to comment #16) > > Also, US2773 addresses the issue with Mac OS X, which Chandrika alluded to > in comment #12. The message shows that local ports are forwarded to the > appropriate host and port. (Unfortunately, you will have to fetch the source > from my repo/branch if you want to try it.) For the Mac OS issue added by Chandrika, it's a known issue which has been added to online user guide. Please refer to the detail contents copied from user guide:https://access.redhat.com/knowledge/docs/en-US/OpenShift/2.0/html/User_Guide/sect-OpenShift-User_Guide-Application_Maintenance_Monitoring_and_Troubleshooting-Performing_Application_Maintenance_from_Your_Workstation.html#sect-OpenShift-User_Guide-Port_Forwarding 4.4.1.1. Port Forwarding on Mac OS X Currently, out of the box, Mac OS X only provides the following interfaces for loopback addresses: localhost 127.0.0.1 Therefore, you may experience error messages similar to those shown below when attempting to configure port forwarding using the IP address for your OpenShift application. $ rhc-port-forward -a qnodejs Password: ****** Checking available ports... Binding httpd -> 127.11.25.2:8080... Binding mysqld -> 127.11.25.1:3306... Binding node -> 127.11.25.1:8080... Use ctl + c to stop Error trying to forward ports. You can try to forward manually by running: ssh -N -L 127.11.25.1:3306:127.11.25.1:3306 -L 127.11.25.1:8080:127.11.25.1:8080 -L 127.11.25.2:8080:127.11.25.2:8080 70277280b8534c8a9fc76d2734393dfa.rhcloud.com The current workaround to enable port forwarding on Mac OS X is to manually configure an alias using the ifconfig command for each IP address used by your application, using the command as shown below: $ sudo ifconfig lo0 alias application_IP_address For example, if the IP address used by your application is 127.10.51.129, run the command as shown below: $ sudo ifconfig lo0 alias 127.10.51.129 If your application uses multiple IP addresses, as shown in the example above, you must configure an alias for each IP address. For example, suppose you have a Node.js application with both MySQL and phpMyAdmin cartridges added, and it uses the IP addresses 127.11.25.1 and 127.11.25.2. To correctly enable port forwarding, you must configure an alias for each IP address, as shown in the example below. $ sudo ifconfig lo0 alias 127.11.25.1 $ sudo ifconfig lo0 alias 127.11.25.2
(In reply to comment #18) > Expected results: > According to the port-forward results above, user is not aware of the app is > stopped. It's expected to see a friendly message like "application is > stopped" while the running postgresql port is forwarded. > eg: > # rhc port-forward php2 -p redhat > Checking available ports... > Binding postgres -> 127.5.211.129:5432... > Application php2 is stopped > Forwarding ports, use ctl + c to stop Oh. I see what you're saying now. I apologize for the confusion here. We will need enhancements on the server end to make this happen reliably on the CLI level.
(In reply to comment #19) > (In reply to comment #16) > > > > Also, US2773 addresses the issue with Mac OS X, which Chandrika alluded to > > in comment #12. The message shows that local ports are forwarded to the > > appropriate host and port. (Unfortunately, you will have to fetch the source > > from my repo/branch if you want to try it.) > > For the Mac OS issue added by Chandrika, it's a known issue which has been > added to online user guide. Please refer to the detail contents copied from > user > guide:https://access.redhat.com/knowledge/docs/en-US/OpenShift/2.0/html/ > User_Guide/sect-OpenShift-User_Guide- > Application_Maintenance_Monitoring_and_Troubleshooting- > Performing_Application_Maintenance_from_Your_Workstation.html#sect-OpenShift- > User_Guide-Port_Forwarding I am fully aware of the documentation. That is not the point. The present behavior is that CLI tool provides the following cryptic message === Error trying to forward ports. You can try to forward manually by running: ssh -N -L 127.11.25.1:3306:127.11.25.1:3306 -L 127.11.25.1:8080:127.11.25.1:8080 -L 127.11.25.2:8080:127.11.25.2:8080 70277280b8534c8a9fc76d2734393dfa.rhcloud.com === This command, written as is, does not work on Mac OS X. And there is no other immediate recourse. It is great that it is documented, but I wager that the vast majority of the users will not consult the documentation when confronted by this error. The CLI tool needs to either work around this problem, or provide a better explanation so that the user can take action. I believe the correct solution is the former, and I implemented in the work for US 2773.
(In reply to comment #21) > > I am fully aware of the documentation. That is not the point. > > The present behavior is that CLI tool provides the following cryptic message > > === > Error trying to forward ports. You can try to forward manually by running: > ssh -N -L 127.11.25.1:3306:127.11.25.1:3306 -L > 127.11.25.1:8080:127.11.25.1:8080 -L 127.11.25.2:8080:127.11.25.2:8080 > 70277280b8534c8a9fc76d2734393dfa.rhcloud.com > === > > This command, written as is, does not work on Mac OS X. And there is no > other immediate recourse. It is great that it is documented, but I wager > that the vast majority of the users will not consult the documentation when > confronted by this error. > > The CLI tool needs to either work around this problem, or provide a better > explanation so that the user can take action. I believe the correct solution > is the former, and I implemented in the work for US 2773. Thanks a lot for your patience and clarification. It works on Mac OS after trying on fork ami. Here's the detail for your reference: Build level: fork_ami_us2773_298 client built from fork_ami_us2773_298 Steps: 1. Create a jbossas app on Mac 2. Run rhc port-forward for this app Actual results: It works well as below: OpenShiftmatoMacBook-Pro:joyce root# rhc port-forward app1 -p a Checking available ports... Forwarding ports Service Connect to Forward to ==== ============== ==== ================== java localhost:3528 => 127.0.250.129:3528 java localhost:4447 => 127.0.250.129:4447 java localhost:5445 => 127.0.250.129:5445 java localhost:5455 => 127.0.250.129:5455 java localhost:8080 => 127.0.250.129:8080 java localhost:9990 => 127.0.250.129:9990 java localhost:9999 => 127.0.250.129:9999 Press CTRL-C to terminate port forwarding So let's just use this bug to track the issue in comment #20. Thanks.
I've created the server side issue: https://bugzilla.redhat.com/show_bug.cgi?id=928811 I'm closing this one, since there is nothing further to do on the client side.