简体   繁体   中英

Spring Boot microservices Embedded tomcat vs External tomcat

I am building microservices(approx 15 to microservices) project for huge organization, I wants to know is it recommended to go for external tomcat with war file or just use the embedded tomcat of spring boot with jar file. Also I am facing issue after building my project on jenkins how to copy the file from jekins server to my server and run the file there and create and automatic build and deployment pipeline ie everytime I push the code it should be automatically deployed.

You need to identify what compels you to go for external tomcat deployment. As SpringBoot provides out of box facility to deploy within the container, it is not required to go for external tomcat deployment.

Besides, if you are going for many microservices, it will be good to have with built in springboot with embeded tomcat. Springboot also provides the facility to use undertow or jetty. I would recommend to use SpringBoot with either embeded tomcat or undertow with docker container for more flexibility.

It will be good if you provide the issues you are facing. You can check the below link for reference. https://dzone.com/articles/spring-boot-with-external-tomcat

I didn't encourage until today companies using Spring Boot and deploying in an external Tomcat.

If there is no requirements from your Infrastructure department, I would go with the embedded tomcat.

JARs vs WARs

I think both have their use cases, like a car vs a truck.

Getting started with jar files is definitely easier, it's provided out of the box. However, using war files in a tomcat has a few perks too:

  • You can use the "manager" UI to update/redeploy a webapp easely
  • You can monitor server status, inspect sessions, basically have a look under the hood
  • You can deploy/update multiple wars independently, which might be handy for larger project

...but there is definitely some learning curve to set things up, and it feels a bit...old. So it's up to you if you want an easy "jar car" or a whole "servlet container truck". ...or you can also have multiple cars. ;) Each has ups and downs.

Pipelines

Like for any other topic, there are very different ways to achieve this. If you use an extern tomcat, you may configure a "script" user and deploy it like this (or similar):

curl -u username:pwd -d path=/something -d war=file:target/someWar.war https://someurl.com/manager/deploy

...or you can go the other way round and create Docker images, or cloud-init VMs or whatever. Or just a shell script to stop it remotely, upload it and start it.

Depending on your situation, the know how of your team mates, etc, one or the other may be easier.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM