(Tomcat) Backup WAR for deployment

Are there any built-in mechanisms for backing up a war file when deployed to Tomcat?

For example, I am deploying whosit.war. I want the current whosit.war to be deployed for backup to whosit-backup.war. Or, if each deployment stores an additional copy of the deployment on whosit-deploy-20110317-211037.war. etc.

Obviously, I could add this to my script deployment, but it would make my life so enjoyable if Tomcat did something like the above.

+4
source share
2 answers

You can mark the deployment when deploying webapp remotely by specifying the tag attribute. If you are using Maven, you can specify the tag using the tomcat-plugin module . Assuming you already have a plugin setup, you only need to specify a property. Example:

 <properties> <maven.tomcat.url>http://example.com:8080/manager</maven.tomcat.url> <tomcat.username>tomcat</tomcat.username> <tomcat.password>tomcat</tomcat.password> <maven.tomcat.tag>mytag</maven.tomcat.tag> <maven.tomcat.path>/myapp</maven.tomcat.path> </properties> 

This will create a copy of the war in your manager’s working directory in the directory with the name after your tag (for example, $CATALINA_HOME/work/Catalina/localhost/manager/mytag ). You can restore and reinstall this war through the manager by specifying path and tag :

 http://example.com:8080/manager/deploy?path=/myapp&tag=mytag 

Note: if the manager’s working directory is ever deleted, your tagged deployments will disappear.

+4
source

I think you have to script it yourself.

+1
source

Source: https://habr.com/ru/post/1342740/


All Articles