CloudFoundry application opening two ports

橙三吉。 提交于 2019-12-23 15:17:58

问题


I have a CF application that opens two ports. AFAIK CF can create routing on only for one of them - to the one that is located in VCAP_APP_PORT or PORT. How can I create some route to the second port? I don't mind having separate name directing to other port.


回答1:


Currently an application on Cloud Foundry is not able to have two ports mapped into its container environment. As part of the new Diego runtime, multiple port mappings has been exposed, but is not currently available through the API.

Depending on what you need, you could take a look at Lattice, which uses the Diego runtime. Some documentation can be found here.




回答2:


Cloud Foundry will route TCP/WebSocket traffic coming from 80/443 to the one assigned port. Your application can not listen to any other port.

https://docs.cloudfoundry.org/devguide/deploy-apps/prepare-to-deploy.html#ports

You can either create multiple url mappings, or have two applications that communicate with each other using a messaging or database service.




回答3:


Resurrecting an old question, but this is supported in Cloud Foundry now. Support was added around April 2019. Check your version to see if it supports this.

The general process is:

  • Use cf cli to update your app to list all the ports it listens on
  • Update each route to the app with the specific port that the route should use. If you have two ports, you'll need two or more routes one port per route.
  • Restart the app

Right now you have to use cf curl to manually update these records. Instructions can be found here: https://docs.cloudfoundry.org/devguide/custom-ports.html. Hopefully future cf cli versions make this easier.



来源:https://stackoverflow.com/questions/32073627/cloudfoundry-application-opening-two-ports

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!