Improve Discovery support for Consul
See original GitHub issueI use consul for service-discovery and my services has a context-path:
@SpringBootApplication
@Configuration
@EnableAutoConfiguration
@ComponentScan("com.vattenfall.aot.mcf.core")
@EnableDiscoveryClient
@EnableHystrix
@ImportResource({"classpath:foo-service-spring.xml"})
public class McfFooServiceSpringBoot {
protected static void start(String[] args) {
SpringApplication.run(McfFooServiceSpringBoot .class, args);
}
}
My service property:
spring.application.name=foo-service
server.port=10274
server.context-path=/bar/foo-service
spring.cloud.consul.discovery.healthCheckPath=${server.context-path}/health
spring.cloud.consul.discovery.healthCheckInterval=10s
If I start Spring-Boot-Admin like this:
@SpringBootApplication
@Configuration
@EnableAutoConfiguration
@EnableAdminServer
@EnableDiscoveryClient
public class AdminDemoApplication {
public static void main(String[] args) {
SpringApplication.run(AdminDemoApplication.class, args);
}
}
and a property file like this:
spring.application.name=admin
server.port=9999
Then a wrong health-endpoint for the foo service is shown in spring boot admin UI page. And the service is shown as offline:
http://localhost:10274/health
instead of
http://localhost:10274/bar/foo-service//health
The properties spring.boot.admin.discovery.converter.* seems to has no effect. I guess the DefaultServiceInstanceConverter.convert
method ignores context-path details.
Issue Analytics
- State:
- Created 7 years ago
- Comments:13 (1 by maintainers)
Top Results From Across the Web
Service Discovery Explained | Consul - HashiCorp Developer
Service discovery provides benefits for all organizations, ranging from simplified scalability to improved application resiliency.
Read more >Discover Services with Consul
Discover Services with Consul · Maintaining service information · Use Consul to discover, track, and monitor services · Mercedes-Benz · Getting Started with...
Read more >Implementing Service Discovery of Microservices with ...
Service Discovery : Distributed applications can use Consul to dynamically discover service endpoints. Once a service is registered with Consul, ...
Read more >CAS - Consul Service Discovery - Apereo Blog
Service Discovery : Clients of Consul can provide a service, such as api or mysql, and other clients can use Consul to discover...
Read more >Discovery - HashiCorp Consul | F5 Distributed Cloud Tech Docs
Create Discovery for Consul Cluster · Click Manage > Service Discoveries . · Click Add Discovery .
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
As a workaround I got it also running with 1.3.3:
This is my new Consul-Converter considering the context-path of the services:
And with that I enable the converter:
BTW: I like the fix #205 to ignoring the consul agent itself. Good job! 😃
@mirwais27 not scheduled yet… but I think roughly in 2 weeks…