I have a Spring Boot services and I manage deployment on the server using a batch script. So, when ever I have to deploy a update I shutdown current running service using Spring Boot's shutdown hook. For example:
curl -X POST http://%HOST_NAME%:%PORT%/actuator/shutdown
Here I am giving %PORT% number of the service, Which is same as I have given in application.yml. I don't want hardcode the port neither in application.yml nor want to pass from the command line while starting the Spring Boot application. Actually I do not want to mention the port. I just want Spring Boot use any of the random port available on the server. If I will do the same then how can I shut down the service because I don't know the port where the service is running.
Related
I have this requirement that I need to check if the java application (not web app) is running or down via bash script.
It is non springboot application as well. It is just a normal spring application that connects and listen to kafka, get the the object from the topic and call an API.
We thought of to use spring actuator to check the health however it is not a web application.
What is the recommended way to check a non-web and non-springboot application if it is up or down?
Please advise.
For security purposes, I'd like to have javamelody running on my app management port, not the main traffic port. This is a 1.5.13 spring boot app running jetty with some actuator endpoints enabled. I have set the actuator property management.port to something other than the server.port.
I can run javamdelody in a standalone jetty server on a third port using an approach like this github project. But three ports is a little wieldy in a micro-service context.
This stackoverflow post has answers for Tomcat, but not for Jetty. Any suggestions to run javamelody on the management port with Jetty?
What kind of configuration should be used to make the apache ignite used in a restful webservice to identify itself the host and port wherever it is deployed.
I could see directly giving host and port name in the example-ignite.xml file.
Ignite doesn't know whether it's in web service or not. You need to configure your own web service, for example, using jetty + jersey and call Ignite API from it when it's needed:
Ignite Spring Boot integration example, Spring Boot REST service example
Ignite also comes with it's own REST API:
https://apacheignite.readme.io/docs/rest-api
I would like to know how I can programmatically find the netty port while a spring boot 2 + spring cloud Finchley application is starting up?
I am running the service in a docker container on AWS in EC2 container service - I therefore set server.port=0, and cannot use this property to find the actual port used.
In spring-boot 2 you can use #LocalServerPort to wire the dynamic port used
https://docs.spring.io/spring-boot/docs/current/api/org/springframework/boot/web/server/LocalServerPort.html
I am developing a microservice, using Spring Boot, that exposes REST Endpoint. Because of scalability, I have to run multiple instances of this services on a different port. What will be the configurations for the applications so that it can register with eureka and requests are load balanced? I am using Spring cloud config, Eureka server and zuul.
Attaching following entries in the client properties file will do the trick. This is for Spring cloud config dalston
eureka.instance.instanceId=${spring.application.name}:${spring.application.instance_id:${random.value}}
I guess you meant to register with Eureka instead of Config server.
To register multiple instances that might be running in the same host but listening on a different port you would need to set eureka.instance.metadataMap.instanceId to a unique value maybe using:
eureka.instance.metadataMap.instanceId=${spring.application.name}:${random.int}