I am trying hard to register my node app, with Netflix's Eureka , and after googling a lot, I am still looking for a solution . The max I can figure out is we have Prana but I got an issue which is still in the issue list of Prana (I guess it means my REST Template is not able to discover this app).
Sidecar , is another suggested solution , for which I am not getting any response . Apart from these two I have found a node module Eureka-Node-client , but none of them serve my purpose .
The @EnableEurekaClient annotation makes your Spring Boot application act as a Eureka client. To register the Spring Boot application into Eureka Server we need to add the following configuration in our application. properties file or application. yml file and specify the Eureka Server URL in our configuration.
Visit the eureka-client in the browser, at http://localhost:8080/service-instances/a-bootiful-client . There, you should see the ServiceInstance for the eureka-client reflected in the response.
Implementing a Eureka Server for service registry is as easy as: adding spring-cloud-starter-netflix-eureka-server to the dependencies. enabling the Eureka Server in a @SpringBootApplication by annotating it with @EnableEurekaServer. configuring some properties.
You can create a Sidecar
application like you would create any spring-boot
app:
@EnableSidecar
@SpringBootApplication
public class SideCarApplication {
public static void main(final String[] args) {
SpringApplication.run(SideCarApplication.class, args);
}
}
The important thing is that you have to configure it to correctly register your actual service. Your application.yml
should look like this:
server:
port: 9999 -- the port your spring-boot sidecar is running
spring:
application:
name: nodeapplication -- the name will be your id in eureka
sidecar:
port: 8000 -- the node applications port
health-uri: http://localhost:8000/health.json -- the exposed health eindpoint of your node application
It is important to note that the healthpoint should return UP
so your services status will be correct in eureka. The returned json for a healthy service :
{
"status":"UP"
}
If you are having trouble setting up a spring-boot
app, use https://start.spring.io/ to configure a project. Sadly there isn't a sidecar option to tick, but you will get the idea. You can do the same from STS
(Spring Tool Suite).
The maven dependency for Sidecar
(with spring-cloud as a parent):
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-netflix-sidecar</artifactId>
</dependency>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With