Disabling Eureka Client when running Zuul Server - spring-boot

I am trying to use Zuul as reverse proxy without discovery server. Things seem to work. One thing that bothers me is that the discovery client keeps looking for a discovery server. How do I disable this behavior?

Solution is as simple as adding this to application.yml:
eureka:
client:
enabled: false
As suggested by #spencergibb below, excluding the eureka dependencies also disables the discovery client. I ended up choosing this latter approach as it inherently simplifies my build.

Related

Specifying route URI in Spring Cloud Gateway Configuration

Here is the yml for spring cloud gateway. I want to write URI without load balancing. But as I'm using Eureka, I don't think hardcoding something like "localhost:6678" is a good idea. I would like to specify the service name, without the lb prefix. Any way to write it ?
spring:
cloud:
gateway:
routes:
- id: before_route
uri: lb://hello-service
I'm seeing this on the console when I run the gateway:
You already have RibbonLoadBalancerClient on your classpath. It will be used by default. As Spring Cloud Ribbon is in maintenance mode. We recommend switching to BlockingLoadBalancerClient instead. In order to use it, set the value of `spring.cloud.loadbalancer.ribbon.enabled` to `false` or remove spring-cloud-starter-netflix-ribbon from your project.
What is the official alternative of Ribbon? How can I enable it in my project instead of Ribbon?
Edit: I'm trying to avoid load balancing for now because of poor performance. Without lb I'm getting my request served within 150ms whereas lb makes it 500ms+
Thanks in advance!

Spring Boot & reactor-netty https multiple domains

I'm trying to configure a spring cloud gateway, (on top of project Reactor) to serve HTTPS across two domains.
However it appears that it is unable to use SNI to choose the correct certificate to show to the client.
My configuration is as follows:
I've generated two different private key/ certs and both of those are stored in keystore.jks
both of them have different CommonNames and they also have Subject Alternative Names that match the expected domains.
I've entered the common name into my hosts files. To fool browser/curl into thinking that its two seperate domains.
I've configured application.yml as follows
server:
ssl:
enabled: true
# The entire purpose of this project is so that client authentication is needed
client-auth: need
---
spring:
profiles: development
server:
ssl:
key-store: config/keystore.jks
trust-store: config/truststore.jks
The purpose of this is to enable 2 way ssl authentication with two different clients both of whom issue us with their own certificates.
I know netty which is the foundation for spring cloud gateway supports SNI. Is there any way to configure SNI for spring cloud gateway?
It looks like there is an outstanding issue to Support SNI.
https://github.com/spring-cloud/spring-cloud-gateway/issues/1525 which though closed is closed by the issue creator. Not by the framework creators.
This issue links to another issue in reactor.
https://github.com/reactor/reactor-netty/issues/573
Which at the time of writing is not closed.

can zuul be retryable without eureka and without ribbon?

I am a beginner in zuul.
now I try to use zuul as a reverse proxy for my mircoservices.because I am not using ribbon or eureka,so I do:
ribbon.eureka.enabled=false
I also notice that I can set:
zuul.retryable=true
to make zuul retryable.
But it seems not work in my project, so I want to know whether zuul retry should be used with ribbon? Or there is any other solution in this situation?

Route Existing Services via ZUUL without adding routing rule

I am trying to route existing services via Spring cloud Netflix Zuul.
I have an existing service available at below url,
http://localhost:3080/query-service/getquery/1
Out of the box, with zuul I can route to the service as below,
localhost:9000/queryservice-id/queryservice/getquery/1, with "queryservice-id" as the service-id of the service when it is registered in Service Registry. The zuul port is 9000.
I do not want to change the context path and service path information when accessing the service via ZUUL.
With ZUUL, I want to access the service as below,
http://localhost:9000/query-service/getquery/1
I do want to prefix with the "serviceId". This is because I do not want to impact any existing clients of the service. Only the host and port changes, without serviceId.
I was able to accomplish it as below with ZUUL Configuration,
zuul:
routes:
query-service:
path: /query-service/**
serviceId: query-service
stripPrefix: false
With the above configuration, I am able to only use the zuul host and port, the other service specific information remains as before. Seems like stripPrefix is helping in routing without the serviceId.
But, I have a lot of services and will be adding more services too.
For every such service, I do not want to be adding a rule like that to ZUUL configuration which will mean rebuilding and recycling the ZUUL Service.
I feel there should be a simpler and better way to accomplish this, without a big effort, because the change I want to do is common to all services
Is there a way to making this change common for alll the services I want
to be routed via ZUUL.
Thanks,
As checked with the Spring Cloud Netflix team this is recommended approach.
https://github.com/spring-cloud/spring-cloud-netflix/issues/1549

Enable eureka.client.healthcheck

I'm following http://cloud.spring.io/spring-cloud-netflix/spring-cloud-netflix.html to build distributed system with Spring Cloud.
All works as expected apart from Eureka Client Healthcheck.
I have
eureka:
client:
healthcheck:
enabled: true
And pointing my service to nonexisten config_server, this results in
http://myservice:8080/health
{
status: "DOWN"
}
But Eureka server still showing this instance as UP and keep sending traffic to it.
What am I missing?
spring-boot: 1.2.8.RELEASE
spring-cloud-netflix : 1.0.4.RELEASE
You have to explicitly set eureka.client.healthcheck.enabled=true to link the Spring Boot health indicator to the Eureka registration. Source code reference: here.
Ok, I think I found it.
According to https://jmnarloch.wordpress.com/2015/09/02/spring-cloud-fixing-eureka-application-status/ this feature will only be available on Spring Cloud 1.1.
To make it work with 1.0.4 I need to implement my own HealthCheckHandler.
Thanks #xtreme-biker for bringing up Spring Cloud version issue.

Resources