Search code examples
cloud-foundrynetflix-eurekaservice-discoverynetflix-feignpredix

Feign Client communication in predix (Cloud Foundry)


I have 2 microservices built using Netflix eureka. They communicate using feign client. In my local environment feign client works without any issue. But in the Predix (a cloud foundry) environment they fail to communicate. Feign client always gives connection time out error. As found that feign client try to connect using instance ip address (I think feign client uses the internal ip address). Is there a way to fix this issue, may be enabling container communication or using public uri

EDIT: I managed to get the public url by changing hostname like below.

eureka:
 instance:
  hostname: ${vcap.application.uris[0]}

but in the eureka server it register as ${vcap.application.uris[0]}:[random port] (like xxxxxx.run.aws-usw02-pr.ice.predix.io:61142/yyy) is there a way to remove that random port.


Solution

  • There's currently no way to assign a specific port to an application running in Predix Cloud Foundry. CF assigns a random port, as you've discovered, but this is only used inside the CF environment. Any other microservice/client/application should only use port 443 for HTTPS. So, maybe you can hardcode your Eureka client to use 443, if possible.