Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to register healthcheck if spring.cloud.consul.discovery.port property is set #281

Closed
petrkarel opened this issue Feb 16, 2017 · 2 comments
Labels
Milestone

Comments

@petrkarel
Copy link

It's impossible to register a new service with healthcheck if spring.cloud.consul.discovery.port property is set. Service is registered fine but without check. My spring boot application (service) run in docker container (bridge mode) with random external port managed by Mesos. The port inside container is set to 8080. The service is registered to Consul Service Registry with external IP and PORT with properties spring.cloud.consul.discovery.ip-address and spring.cloud.consul.discovery.port. Everything works as expected except healthcheck. If I comment out the spring.cloud.consul.discovery.port property - healthcheck is registered but with port 8080. I solved my problem with overriding org.springframework.cloud.consul.serviceregistry.ConsulAutoRegistration class where I modified registration() method:

public static ConsulAutoRegistration registration(ConsulDiscoveryProperties properties, ApplicationContext context, ServletContext servletContext, HeartbeatProperties heartbeatProperties) {
...
   if (properties.getPort() != null) {
     service.setPort(properties.getPort());
     setCheck(service, properties, context, heartbeatProperties);
   }
...

}

After that everything works fine. I'd like to ask you if I missed something in configuration.

Snippet of my bootstrap.yml:

spring:
  cloud:
    consul:
      host: ${HOST} #enviroment property
      port: 8500
      discovery:
        enabled: true
        register: true
        prefer-ip-address: true
        ip-address: ${HOST} #enviroment property
        port: ${PORT} #enviroment property
        register-health-check: true
        health-check-critical-timeout: 5m
server:
  port: 8080

Thank you very much.

Regards,
Peter

@spencergibb
Copy link
Member

What version are you using?

@spencergibb spencergibb added this to the 1.2.0.RC1 milestone Feb 20, 2017
@gabrielfsousa
Copy link

this option is right ? health-check-critical-timeout

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants