简体   繁体   English

构建后如何从TeamCity将Java .war文件部署到Linux服务器?

[英]How to deploy java .war file to Linux server from TeamCity after build?

We have a Java web service project that is checked into GitHub. 我们有一个Java Web服务项目,已签入GitHub。 We have a corresponding project in TeamCity that pulls the files from GitHub. 我们在TeamCity中有一个相应的项目,该项目从GitHub中提取文件。 TeamCity compiles the project and produces the deployable .war file as an artifact. TeamCity编译项目并生成可部署的.war文件作为工件。

Today TeamCity stops there and just sits on the artifact. 今天,TeamCity停在那里,仅坐在工件上。 Normally I deploy the war file through the built-in Apache management window on the :8080 port. 通常,我会通过内置的Apache管理窗口在:8080端口上部署war文件。 However, I'd like to have TeamCity perform this deploy automatically after a successful build. 但是,我想让TeamCity在成功构建后自动执行此部署。

The TeamCity build server is on a Windows machine, the Apache machine is Linux. TeamCity构建服务器位于Windows机器上,Apache机器是Linux。 The war file is deployed to the /var/lib/tomcat7/webapps folder. war文件已部署到/ var / lib / tomcat7 / webapps文件夹中。

So my question boils down to the following: how can I set up TeamCity so that it takes the war file and copies it over to /var/lib/tomcat7/webapps on a different machine? 因此,我的问题归结为以下几点:如何设置TeamCity,以便它接收war文件并将其复制到另一台计算机上的/ var / lib / tomcat7 / webapps中?

We have similar projects where TeamCity deploys a .NET project to another Windows server using psake scripts, ie it's Windows-to-Windows file transfer. 我们有类似的项目,其中TeamCity使用psake脚本将.NET项目部署到另一台Windows服务器,即Windows到Windows的文件传输。 Can psake be used to transfer files to Linux as well? psake也可以用于将文件传输到Linux吗?

I have been considering solutions such as Puppet and Putty, but I don't know where to start really. 我一直在考虑诸如Puppet和Putty之类的解决方案,但我不知道从哪里真正开始。

Any suggestions are welcome, Andras 欢迎任何建议,安德拉斯

I am working on a solution that uses SCP and SSH to allow TeamCity to copy the war file to the Tomcat server and then run some custom bash scripts to finish up the deploy. 我正在研究一种使用SCP和SSH允许TeamCity将war文件复制到Tomcat服务器,然后运行一些自定义bash脚本以完成部署的解决方案。

Similar to this proposed solution. 类似于此提议的解决方案。

Teamcity control application deploy? Teamcity控制应用程序部署?

Currently running into SSH problems but should get them worked out soon. 目前遇到SSH问题,但应该尽快解决。

There is also the option of using the Tomcat Management capabilities to upload a the war file. 还可以选择使用Tomcat管理功能来上传war文件。

http://tomcat.apache.org/tomcat-7.0-doc/manager-howto.html#Deploy_A_New_Application_Remotely http://tomcat.apache.org/tomcat-7.0-doc/manager-howto.html#Deploy_A_New_Application_Remotely

I've had this working in test environments using curl to make the request. 我已经在使用curl的测试环境中提出要求。

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

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