I followed this documentation: http://cloud.spring.io/spring-cloud-consul/1.0.x/index.html and configured my Spring Boot application as following:
spring:
cloud:
consul:
enabled: true
host: consul.domain.tld
port: 443
discovery:
instanceId: ${spring.application.name}:${spring.application.instance_id:${random.value}}
fail-fast: false
When deployed to Cloud Foundry, the app can connect to Consul and tries to register, but Consul's "service check" instantly fails.
Reading what is configured, I get the following instances in the Spring Boot app:
list = discoveryClient.getInstances("myApp");
list.get(0) => "http://05c81764-18a4-4905-41a8-b5b8:8080"
I see that the UUID most likely is the instanceId generated by Cloud Foundry. Of course, that URL doesn't work, neither within Cloud Foundry nor for an external Consul server trying to check the service's health periodically.
How do I have to configure my Spring Boot app correctly in order to make service registration with Consul work in Cloud Foundry?