简体   繁体   English

远程部署到tomcat

[英]Remote deploy to tomcat

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. 我想使用Maven将应用程序(war)部署到保留现有context.xml的远程tomcat(v7)中,否则也可以在war中部署context.xml。 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. 我认为这是一个经典的问题,如果您想通过管理器重新部署到tomcat,它将执行一次取消部署和一个后续部署-取消部署context.xml作为副作用,然后应用程序将无法启动。

What I already tried: 我已经尝试过的

  • cargo with different settings - no change 设置不同的货物-不变
  • 'autoDeploy' = false - does not work under tomcat 7 'autoDeploy'= false-在tomcat 7下不起作用
  • restrict tomcat writing its own config directory - throws error message and tomcat 7 does not start 限制tomcat编写自己的配置目录-引发错误消息,并且tomcat 7无法启动
  • 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 :-) 将所有上下文信息放入一个context.xml.default-不会删除上下文,但是不幸的是,我们有一些应用程序在不同的上下文中使用具有相同值的相同键:-)
  • putting context configuration into an alternative path - outside ${catalina.base} - could not make it work 将上下文配置放到$ {catalina.base}之外的替代路径中无法使其工作
  • 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. 我正在考虑编写一个简单的ssh脚本(stop-tomcat,copy-war,start-tomcat)或其他管理器脚本,但是首先我想问一下您是否要重新发明轮子。 I saw solutions using 'tomcat7-maven-plugin', but heard that it works only on local tomcat. 我看到了使用“ tomcat7-maven-plugin”的解决方案,但听说它仅适用于本地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. 我并不坚持要获得成熟的Maven解决方案:如果您建议使用带有简单REST调用的管理器的解决方案,我也可以在Maven中实现。

So the question splits into three possible solutions (under tomcat7): 因此,问题分为三个可能的解决方案(在tomcat7下):

  • To preserve context.xml through undeploy 通过取消部署保留context.xml
  • To deploy context.xml with war 使用war部署context.xml
  • To redeploy application without undeploy 无需取消部署即可重新部署应用程序

Do you know a reliable solution for that? 您知道可靠的解决方案吗?

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 最后,我提出了一个运行脚本的非但不错的解决方案:-登录tomcat计算机-停止实例-清理webapps目录-将wars下载到webapps目录中-启动实例

Again: the issue does not exist in tomcat 6 and 8 :-) 同样:tomcat 6和8中不存在此问题:-)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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