Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to find the IP address of the virtual machine/container hosting the applications deployed on Bluemix or Cloud Foundry

Need to find the IP address of the host machine[virtual machine] hosting the Cloud Foundry application after it is deployed.

Is there anyway to find the IP address? please let me know.

The IP address is needed to debug a connection time out problem for a database connection from application hosted on IBM Bluemix platform to Compose database.

like image 893
Mustansir Ali Avatar asked Dec 03 '22 23:12

Mustansir Ali


1 Answers

The IP address can be found using the Cloud Foundry CLI command given below.

CF_TRACE=true cf app <APP_NAME>

The application details that you get will have information as given below :-

{"0":{"state":"RUNNING","stats":{"name":"xxxxxx","uris":["xxxxx.ng.bluemix.net"],"host":"198.23.123.244","port":62461,"xxxxx":484527,"mem_quota":1073741824,"disk_quota":1073741824,"fds_quota":16384,"usage":{"time":"2016-10-27 06:09:24 +0000","cpu":0.34868865754162753,"mem":951832576,"disk":255479808}}}}

The "host" value is the IP which hosts customer's app.

BUT PLEASE NOTE THAT THE IP WILL BE CHANGED IF YOU RESTAGE THE APPLICATION OR APP INSTANCES ARE MOVED TO OTHER HOSTS

For example :

CF_TRACE=true cf app mustanshop

The command results contains following text

{"0":{"state":"RUNNING","stats":{"name":"mustanshop","uris":["mustanshop.mybluemix.net","erterte.testmmmm.com"],"host":"23.246.199.124","port":64220,"uptime":123233,"mem_quota":268435456,"disk_quota":1073741824,"fds_quota":16384,"usage":{"time":"2016-10-27 11:43:41 +0000","cpu":0.002698186246587801,"mem":183988224,"disk":210558976}}}}

Host IP for application mustanshop.mybluemix.net = 23.246.199.124

ALSO NOTE THAT THIS IP IS INTERNAL IP ASSIGNED TO THE VM HOSTING THE APP AND IS NOT ACCESSIBLE FROM OUTSIDE. SO THIS IP CANNOT BE USED TO REACH THE APPLICATION OR USED FOR ANY TYPE OF ROUTING CONFIGURATION TO THE APPLICATION.

like image 65
Mustansir Ali Avatar answered Jan 03 '23 10:01

Mustansir Ali