1

System Information: I have a system with 10 tomcat server and load balancer in linux operating system.

Configration: I am running tomcats in linux screen

Problem: When i have to deploy new war file , i need to stop 10 tomcat server, remove old war and extracted old war folder, copy new war file to webapps directory and start it

Question: Is there any way to do this operations faster ?

hkn
  • 371
  • 1
  • 14
  • One way is to use any of the CI/CD tools available. If you don't want to use those then maybe you can write a bash script which will stop all servers for you deploy the war and start the servers again. – Sandeep Singh Feb 14 '18 at 13:23
  • maybe JRebel? https://vimeo.com/59571963 – danilo Feb 14 '18 at 13:26
  • 1
    Write a shell script for it. – Aniket Sahrawat Feb 14 '18 at 13:31
  • Yeah it looks like i have to use script btw development and deploy areas on different network actually i was wondering a solution like web logic has – hkn Feb 14 '18 at 13:35
  • One of the simplest approaches is to have the war file centralized, with symbolic links in each server. Stop the servers, update the physical file, start the servers. Same with any externalized config files. As @AniketSahrawat said, put it in a script. – Andrew S Feb 14 '18 at 13:39
  • What's the point in stopping the servers even if they are on different networks? I don't know about other technologies but I would use `tomcat-maven-plugin` and push it to the server using `mvn tomcat:redeploy`. This won't require a restart. – Aniket Sahrawat Feb 14 '18 at 13:46
  • @AniketSahrawat tomcat servers are on the same network but i am developing code at different network, i get war file with maven package command then i put war file to usb and deploying it to servers via ftp and linux commands at different computer – hkn Feb 14 '18 at 13:49
  • 1
    Why are you stop tomcat? You can redeploy with maven tomcat plugin. Aniket Sahrawat +1 – P_M Feb 14 '18 at 13:50
  • @AniketSahrawat you are telling that i will remove old war file and its extracted folder then put new war file to webapps then run command mvn tomcat:redeploy without restarting tomcat right? – hkn Feb 14 '18 at 13:54
  • Yes! If you use `mvn tomcat:redeploy` you won't need to restart tomcat servers. But as you said that they are on some network that is inaccessible from the development, then I think you are doing it better already. – Aniket Sahrawat Feb 14 '18 at 13:58
  • @AniketSahrawat yeah maybe installing maven to application servers will save me restarting server – hkn Feb 14 '18 at 14:08
  • In some cases you can't redeploy application.correctly without restart tomcat because of classloader leak. – user1516873 Feb 14 '18 at 14:47

2 Answers2

0

The best solution is using Curl(linux command) with tomcats manager.

Detailed usage: Using Curl with tomcats manager

I have create a page that uploads war file to file store which all of my tomcats can access then calling curl commands for each server in java.

hkn
  • 371
  • 1
  • 14
0

Normally you don't have to stop the tomcat server to delete the previous war file. When you delete the war file it will automatically delete the corresponding directory of if.

Use a bash script to delete and copy the files.