Remote deploy to tomcat

260 Views Asked by At

I would like to deploy an application (war) using maven into remote tomcat (v7) preserving the existing context.xml - or it would be also ok to deploy the context.xml with the war. I think it is a classic issue that if you want to redeploy to tomcat through the manager it performs an undeploy and a deploy sequentilly - which undeploys context.xml as a side effect and then the application cannot start.

What I already tried:

  • cargo with different settings - no change
  • 'autoDeploy' = false - does not work under tomcat 7
  • restrict tomcat writing its own config directory - throws error message and tomcat 7 does not start
  • putting every context information into one context.xml.default - does not delete the context, but unfortunately we have some applications that use the same key in different contexts with different values :-)
  • putting context configuration into an alternative path - outside ${catalina.base} - could not make it work
  • build a container (docker) and redeploy that - this is working but currently this is not an option here

I'm thinking about writing a simple ssh script (stop-tomcat, copy-war, start-tomcat) or an alternative manager script, but first I wanted to ask you before reinvent the wheel. I saw solutions using 'tomcat7-maven-plugin', but heard that it works only on local tomcat. I do not insist on getting a full-fledged maven solution: if you suggest a solution using the manager with simple REST calls, I can implement also, in maven.

So the question splits into three possible solutions (under tomcat7):

  • To preserve context.xml through undeploy
  • To deploy context.xml with war
  • To redeploy application without undeploy

Do you know a reliable solution for that?

1

There are 1 best solutions below

0
On

At last I came out with a not-nice-but-working solution running a script which: - logs in to tomcat machine - stops the instance - cleanup webapps directory - download the wars into webapps directory - start the instance

Again: the issue does not exist in tomcat 6 and 8 :-)