jhipster / generator-jhipster

JHipster is a development platform to quickly generate, develop, & deploy modern web applications & microservice architectures.
https://www.jhipster.tech
Apache License 2.0
21.55k stars 4.02k forks source link

[FEATURE] Use "Discovery First Bootstrap" mode for Spring Cloud Config #7496

Closed PierreBesson closed 5 years ago

PierreBesson commented 6 years ago
Overview of the issue

Currently, our Spring Cloud Config setup is such that the application will first query the config server (at the single URL defined in spring.cloud.config.uri), update their config and then register with Eureka. This is a problem when using an HA registry (in cluster) as it means that you cannot have HA for the config server.

To illustrate the problem, here is an example (this actually happened in our production) with a replicated registry and microservice on 2 nodes:

On node1, microservice-1 (configured with env vars) will retrieve it's configuration from registry-1. On node2, microservice-2 (configured with env vars) will retrieve it's configuration from registry-2.

We temporarily lose node 2 and restart it. In our current default configuration, microservice 2 will actually fail to restart as long as registry-2 remains unavailable. For me, it is not acceptable that failure of one registry make all applications configured to use it fail to start.

Motivation for or Use Case

Provide full HA for the JHipster Registry including the config server and correctly load balance calls from microservices to the config server using Eureka and Ribbon.

Suggest a Fix

Configure applications to use Spring Cloud config Discovery First Bootstrap mode which uses Eureka to find all available config server URLs and will load balance request using Ribbon.

JHipster Version(s)

v3, v4, v5 beta and v5.0

PierreBesson commented 6 years ago

I have actually tried to make this work a few weeks ago but was completely stuck. It's hard to make it work in our case as the registry and config server are embedded in the same app.

This feature would also require some changes to the registry as for example, the registry does not currently registers itself. More over, the Eureka does not registers its server replicas as regular eureka instances so ribbon cannot load balance calls from regular apps to registry instances.

If the registry and configserver were different apps, this would be easy to do, otherwise if we really want to make this work, we will need a hack akin to the ZuulUpdaterService to fiddle with the Eureka server internals.

So in the end, I suggest that we give up on this idea.

gmarziou commented 6 years ago

Have you considered setting multiple URLs in the spring.cloud.config.uri property?

https://cloud.spring.io/spring-cloud-config/multi/multi__spring_cloud_config_client.html#_specifying_multiple_urls_for_the_config_server

PierreBesson commented 6 years ago

Oh no and this is a new feature but it could solve the problem ! Nice find.

gmarziou commented 6 years ago

My app is very far behind Spring Cloud latest version so I may rather use DNS load balancing.

savirs commented 6 years ago

Hello @gmarziou, I am stuck in a similar problem. Setting multiple URLs in spring.cloud.config.uri property would mean multiple URLs pointing to same repository? Another one can be a DR URL?

Regarding the DNS load balancing. How do we provide login credentials for the same?

Thanks

gmarziou commented 6 years ago

Hello @savirs, this is an issue tracker not a discussion forum. If you have questions please use our chat room on gitter or use Stack Overflow, and tag the question with jhipster.

And sorry but I did not understand your points.

jdubois commented 5 years ago

As this has been stuck for a long time, even with the $100 tag, I'm closing this as "won't fix".