Eureka - multiple services in one application - netflix-eureka

I have configured eureka-server and its working correctly. For the client side I have one application with two controllers. In the first controller I have 7 services and in the second i have one. The problem for me is when I set Eureka Client in my client app in Eureka dashboard I can only see the instance for the whole App.
The question is how to tell eureka to discover every service that I have in the application?

I found that eureka discover the application and not the services. So it is okay.

Related

Get Eureka instance metadata in browser

I have a Spring Boot (2.4) app (a generic service) and a Eureka discovery server running. The server doesn't register itself as an instance. I am able to navigate to the Eureka dashboard at the default location of localhost:8761 to get an overview of all the registered instances. I successfully see the service is registered in Eureka. However, this dashboard doesn't give any details about the instance except the name and the port number. I want to be able to see the instance meta data. Is this possible using the dashboard? O maybe there is some exposed URL by the Eureka server that I can call in a browser or postman? Or is there an URL available in the Eureka client (the service) that gives details about its Eureka metadata?
I read thet feign clients access something to be able to query the registry. Can I mimic this as human in a browser?
Go to localhost:8761/eureka/apps

Spring cloud - Server and client

I'm config an application using spring cloud eureka. I start my discovery app in the 8761 port and reaching the console in "http://localhost:8761".
So, I start my client application and it's appear in the "Application" page of eureka console.
First question:
My client is using "server.port=0" in properties config so the tomcat port is starting in random. How can I reaching my services in client? Example: I have a get request in "/api/stuff", is that possible to access this not using the random port? Suppose I don't know the port!
Second Question:
I can start any clients I want, they will start, assuming a random port and register in the cloud server discovery, I can see the log:
"Registering application FLY-CLIENT with eureka with status UP"
But they don't appear in "Application" page of eureka console, why they don't appear?
Thanks!
If you are using Spring RestTemplate to request the services registered in Eureka you need to make it #LoadBalanced, something like this should do the try:
#LoadBalanced
#Bean
RestTemplate restTemplate() {
return new RestTemplate();
}
// usage
restTemplate.getForObject("http://your-service-name/api/stuff", StuffResponse.class);
As for the 2nd question, I'm a little confused, as you mentioned earlier in the question that your application appears on Eureka's dashboard. Is this behavior only happening for the "fly-client"?

Spring boot admin behind firewall

I have a spring-boot client app deployed in a customer network and I want to use SBA as a GUI for its actuator endpoints. I cannot use register-client-applications to register the app, mainly because the client app has no connectivity to SBA (its behind a firewall).
Is there a way how to add a client to SBA manually?
You can add use a static configuration for spring cloud's discovery client. So there is no need that the client reach the sba server. See http://codecentric.github.io/spring-boot-admin/current/#spring-cloud-discovery-static-config

How to register an Eureka Client silently?

Background
We have almost a hundred Eureka clients (spring cloud apps) being registered to an Eureka discovery server. One client can depend as many as more than 10 other clients. Traditionally, we have to run all the dependencies (along with discovery and config server) on local dev environment when developing against one client. Sometimes, to avoid bring up so many projects, I just connect the single client I am working on to our integration test environment which has all clients running. This way, it is very convenient for myself, but having a critical issue: my local client can be discovered by other clients, meaning someone else's testing might be effected by my instance. I know there are ways to mock or proxy the client dependencies. But they are not always good for every scenario, also the setup takes additional time.
Question
Is there a practically quick and easy way to register a client without being discovered by other clients. Besides, I can not issuePUT /eureka/v2/apps/appID/instanceID/status?value=OUT_OF_SERVICEor other discovery server side command. I can only configure my local project.
The easiest way to achieve that is adding the below property only in your local profile.
eureka:
client:
registerWithEureka: false
If so, your application still can look up other instances from Eureka, but your application will not register itself into Eureka.

Register multiple microservice instance with same name on development enviroment

we have a eureka server deployed on server and developers for development purpose register their microservices with it. but when some developers that work on same microservice, register own microservice's instance on eureka [sure with their local ip address] get wrong instance. developer can't change instance name because other services call their service with service name. what's best pattern for our problem?
Another approach to make the developers register their microservices as OUT_OF_SERVICE so then the services will not be called by the rest of services registered in Eureka but they can interact with the rest of services registered.
You can set it as out fo service by adding this to the application.yml:
eureka:
instance:
initialStatus: OUT_OF_SERVICE