-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Description
I'm developing spring boot service that runs both embedded Tomcat on port 8081 and embedded gRPC server on port 6565 (using grpc-spring-boot-starter).
Tomcat hosts actuator endpoints and gRPC server hosts gRPC services (over HTTP/2 protocol).
My config looks like this :
server:
port: 8081
grpc:
port: 6565
eureka:
instance:
nonSecurePort: ${grpc.port}
home-page-url: http://${spring.cloud.client.hostname}:${server.port:8081}
health-check-url: ${eureka.instance.home-page-url}/health
status-page-url: ${eureka.instance.home-page-url}/info
The problem is that de.codecentric.boot.admin.discovery.ApplicationDiscoveryListener creates de.codecentric.boot.admin.model.Application with health URL pointing to http://serviceHost:**6565**/health instead of http://serviceHost:**8081**/health
From ApplicationDiscoveryListener::convertmethod :
String serviceUrl = append(instance.getUri().toString(), serviceContextPath);
String managementUrl = append(instance.getUri().toString(), managementContextPath);
String healthUrl = append(managementUrl, healthEndpoint);I've overcame this problem with my custom EurekaApplicationDiscoveryListener (thanks to DiscoveryClientConfiguration and @ConditionalOnMissingBean)
@Component
public class EurekaApplicationDiscoveryListener extends ApplicationDiscoveryListener {
@Autowired
public EurekaApplicationDiscoveryListener(DiscoveryClient discoveryClient, ApplicationRegistry registry) {
super(discoveryClient, registry);
}
@Override
protected Application convert(ServiceInstance instance) {
EurekaDiscoveryClient.EurekaServiceInstance eurekaServiceInstance = (EurekaDiscoveryClient.EurekaServiceInstance) instance;
final Application converted = super.convert(instance);
return Application.create(converted)
.withHealthUrl(eurekaServiceInstance.getInstanceInfo().getHealthCheckUrl())
.withManagementUrl(eurekaServiceInstance.getInstanceInfo().getHomePageUrl())
.withServiceUrl(eurekaServiceInstance.getInstanceInfo().getHomePageUrl())
.build();
}
}
Would you please fix this in your code base ?
Thanks