Title: Application Port Forwarding Describe the issue: If you want to enable port-forwarding to a gear, the default examples shown in the current documentation only show you how to get forwarded to the Head gear, and any attached Databased. However if you run: # rhc port-forward eap -g 54401bb67f116a704e000169 You can get forwarded to any gear in your environment. Suggestions for improvement: Explain / update the documentation to explain this -g option. Additional information: Currently Portforarding for a gear does the following: # Collect locally bound ports declare -A $(/usr/sbin/lsof -iTCP -sTCP:LISTEN -P 2> /dev/null | /bin/awk '/LISTEN/{ print "local_bindings["$9"]="$1 }') # Extract database ports out of the environment declare -A remote_bindings for host_var in $(env | grep _DB_HOST | awk -F '=' '{print $1}'); do db_name=$(echo $host_var |sed -e 's/.*OPENSHIFT_\(.*\)_DB_HOST/\1/' |tr '[A-Z]' '[a-z]') port_var=$(echo $host_var |sed 's/_DB_HOST/_DB_PORT/') port_val=$(echo ${!port_var}) host_val=$(echo ${!host_var}) db_binding="${host_val}:${port_val}" remote_bindings[$db_binding]=${db_name} done # Merge the database ports into the local binding list; if the databases are # local, the keys will simply be overwritten in the array if ! $exclude_remote ; then for remote_binding in "${!remote_bindings[@]}"; do local_bindings[$remote_binding]="${remote_bindings[$remote_binding]}" done fi In short: - you get a listing of ports seen by the gear - Find out if you have a database mapping - Determine if its scaled - Merge duplicates - Report on the ports for rhc to setup mappings.
https://blog.openshift.com/getting-started-with-port-forwarding-on-openshift/ should also be updated as it coves the same content.
Already documented. Closing.