how to deploy the different spring boot micro service in tomcat with eureka, zuul server too? - spring

I have bellow spring boot microservice. these jar files
1, test-service -port no-8100
2, test-service -port no-8101
3, Zuul server, config server also there.
how to deploy the above service in tomcat server

Modify your maven or gradle build to produce a Package as a war.

Related

Start spring boot jar file as part of tomcat start

There is a way I can start the spring boot jar file as part of tomcat start(catalina.bat start).
I have a spring cloud api gateway which does not support war file deployment.
In a bare metal box, I have installed the tomcat, and as part of deployment I have converted all microservice into war file and able to deploy it into tomcat/webapp folder and up and running.
As spring cloud api gateway does not support war file, I kept this application with embed tomcat.
Now I need this jar file as well get started along with the tomcat [catalina.bat start].
In tomcat I have seen there is something shared.loader option in catalina.properties file.
I have kept the jar file in below path as shown below and when I try to start it, jar file is not getting picked up.
Need to know if there is a way to start the spring boot application [jar file] as part of tomcat [catalina.bat start] start.

How to specify JDBC URL in spring boot application in case of the MySQL running as a Kubernetes Service?

I have a java application with maven build. I have provided the k8 service name of the mysql in the application properties of the spring boot application. However, I get error as unknown host and the maven build fails. How do I overcome this?
Application properties:
spring.datasource.url=jdbc:mysql://mymysqlk8servicename/testdb
When I build the application using mvn clean install, the build fails with error as java.net.UnknownHostException.
For the record, I am running the maven build in the master machine of the Kubernetes cluster. Should I run the java application only as a Kubernetes service? Is it possible to just run the java application without deploying in the Kubernetes cluster?
If you do
kubectl get service
You should be able to see the servicename. Pay attention to the port too.

Control order of WAR file deployment in JBoss EAP 7.2.0

I have developed two Spring Boot applications, one is Cloud Config Server and the other is a Spring Boot application that fetches property from Config Server. I have deployed the two applications as WAR files in JBoss EAP. I am deploying the WAR files in sequence, deploying the Config Server before the other application. Problem is happening after I restart the server, the second war file is getting deployed before the war file for Config Server.
I Jboss EAP 7.2.0, how will I ensure that the WAR file for Config Server is always deployed before the WAR file of the other application?
You can control the startup order of deployment by using jboss-all.xml deployment descriptor to declare dependencies between the deployments.
Example:
If you want foo.ear is deployed before bar.ear then you can create an bar.ear/META-INF/jboss-all.xml file like this:
<jboss xmlns="urn:jboss:1.0">
<jboss-deployment-dependencies xmlns="urn:jboss:deployment-dependencies:1.0">
<dependency name="foo.ear" />
</jboss-deployment-dependencies>
</jboss>
[1] https://access.redhat.com/documentation/en-us/red_hat_jboss_enterprise_application_platform/7.1/html/configuration_guide/deploying_applications#control_order_deployments
[2] https://access.redhat.com/solutions/88763

How to start multiple spring-boot applications using Maven, say Client on port 8081 and API on port 8080

I have a multi-module project developed using Spring Boot managed by Maven. There are two spring boot applications, say the API which runs on port 8081 and the thymeleaf client which runs on port 8080. I would want to bootrun both the applications in a single maven command from the root project. Currently, I am explicitly starting each of the application class. How do I achieve this using Maven.?
The project folder structure is as below.
1 RootProject - pom.xml
1.1--API(Spring Boot Project) with port 8080- pom.xml
1.2--Client(Spring Boot Project) with port 8081 - pom.xml
Thanks,
KR

how to deploy Spring Cloud war to old container

I had a Spring Cloud project which was deployed in embeded tomcat. Now I modify the project add web.xml and make the Application class extends SpringBootServletInitializer. I followed the instruction of 81.5 Deploying a WAR in an Old (Servlet 2.5) Container in below link. But I found that the application.properties was not loaded. And the server port listed in application.properties was not listened.
[http://docs.spring.io/spring-boot/docs/current/reference/html/howto-traditional-deployment.html#howto-servlet-2-5]
Deploying a WAR in an Old (Servlet 2.5) Container
application.properties
spring.application.name=api-gateway
server.port=5555
# routes to serviceId
zuul.routes.api-a.path=/api-a/**
zuul.routes.api-a.serviceId=service-A
zuul.routes.api-b.path=/api-b/**
zuul.routes.api-b.serviceId=service-B
# routes to url
zuul.routes.api-a-url.path=/api-a-url/**
zuul.routes.api-a-url.url=http://localhost:2222/
eureka.client.serviceUrl.defaultZone=http://localhost:9999/eureka/

Resources