I have an application which is running on multiple AWS hosts behind a load balancer. All of these instances load the configuration from a spring config server. I can use spring boot admin server to identify the the URL's so that I can execute the POST at hostname:port/actuator/refresh command for individual host using POSTMAN. As the number of hosts increase, it becomes difficult to run a command for each one of the hosts. Is there a way I can do the same with a single command?
We use something similar for our application
i.e Spring applications fetching properties from config server and a spring boot admin server to which all these application registers.
We have exposed an post api in bootadmin which calls refresh endpoint on all instances of specified app.
Since bootadmin has all information about registered apps, we are using it to 'publish' message to all 'subscribed' apps.
I have a spring boot application.
I know that spring mvc is incompatible with spring cloud gateway and it is needed to use spring-boot-starter-webflux instead of spring-boot-starter-web.
But the problem is that I have to add a gateway functionality to an existing app.
And so I have some questions that I hope will help with the problem:
May I create another spring context for separate beans of this libraries? I. e., I mean the old app will work with old context and gateway only with the new. And here are another question: How can I load spring starter in another spring context?
May I configure another port for gateway? So that the old app receives messages on port 8080, and the gateway receives messages for itself on port 8081.
One of our client applications has following architecture -
Angular based front end
Spring Boot based web application to talk to front end
Spring Boot based microservices to talk to web application
Eureka Discovery client to enable web app locate microservices
Recently we faced some issue and want to make one of the microservice to be installed as application under standalone tomcat. Making microservice application main class extend SpringBootServletInitializer, and changing packaging to war helped generate war artifact and it gets deployed on tomcat, as well as registers on Eureka - but its not servicable.
When web application looks up the service via Eureka and invoked any API, it fails. Even invoking service via Postman or directly in browser fails for registered URL. It seems the microservice when exposed as web application under tomcat does not resolve via Eureka. Any suggestions?
Configuration:
Data service - to be deployed as war
spring.application.name=data-service
server.contextPath=/data-service
server.servlet.application-display-name=Data Service
spring.main.banner-mode=log
#server.port=9090
spring.jmx.default-domain=${spring.application.name}
eureka.client.service-url.defaultZone=http://localhost:9098/eureka
eureka.client.register-with-eureka=true
eureka.client.fetch-registry=true
eureka.client.preferSameZoneEureka=true
ribbon.eureka.enabled=true
ribbon.ReadTimeout = 60000
When deployed, it registers with Eureka Discovery with name data-service, but The uri is not a correct one to reach the instance, it happens to be something like
GET http://data-service/query/xxxxx HTTP/1.1
It misses the Tomcat port 8080 and the tomcat context. Manually checking uri
http://localhost:8080/data-service/query/xxxxx
does work.
I am using Spring Cloud for Creating Microservice Architecture.
I was using the below feature from the Spring Cloud
Zuul – API gateway service that provides dynamic routing, monitoring, resiliency, security, and more -
Ribbon – Client side load balancer
Feign – Declarative REST client
Eureka – Service registration and discovery
Sleuth – Distributed tracing via logs
Zipkin – Distributed tracing system with request visualization.
Hystrix - Circuit Breaker, Fault Tolerance, Hystrix Dashboard for all API
Now Lets say if I have 100 microservices, then we need 100 servers to maintain each microservices. So I thought of using Kubernetes to solve this issue by deploying each microservices in a separate docker container, so now since Kubernetes takes care of microserivice health check, autoscaling, load-balancing so do I need to again use Ribbon, Eureka and Zuul.
Can anyone please help me on this
Even when you use Spring Cloud, 100 services do NOT mean 100 servers. In Spring Cloud the packaging unit is Spring Boot application and a single server may host many such Spring Boot applications. If you want, you can containerize the Spring Boot applications and other Spring Cloud infrastructure support components. But that is not Kubernetes.
If you move to Kubernetes, you don't need the infrastructure support services like Zuul, Ribbon etc. because Kubernetes has its own components for service discovery, gateway, load balancer etc. In Kubernetes, the packaging unit is Docker images and one or more Docker containers can be put inside one pod which is the minimal scaling unit. So, Kubernetes has a different set of components to manage the Microservices.
Kubernetes is a different platform than Spring cloud. Both have the same objectives. However, Kubernetes has some additional features like self healing, auto-scaling, rolling updates, compute resource management, deployments etc.
Just to add to saptarshi basu's answer, you might want to look at https://dzone.com/articles/deploying-microservices-spring-cloud-vs-kubernetes as it walks through the comparison and asks which responsibilities you might want to be handled by which components when using Spring cloud on kubernetes
I have a eureka server and some services, they register to the eureka and use a Feign to communicate with each other.
Every of such services is deployed into embedded tomcat container. Also I have some services which are executed as a demons by scheduled, they shouldn't be into tomcat container, but they also have to use a Feign to get data from some services.
By example I have a monitoring which is executed one time per day and checks some data got from another service by REST. That monitoring don't have to register in eureka cause it doesn't have api for input.
If I put #EnableFeignClients without #EnableEurekaClient, it won't work, but
if i put both of these annotations, service will be deployed into tomcat.
How could I do that without tomcat container?