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

查看:33
本文介绍了Teamcity 控制应用程序部署?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Teamcity 能否控制应用程序部署,例如部署到 tomcat?

Could Teamcity control application deploy, for example to tomcat?

附言没有像 this

推荐答案

我们使用 Teamcity 实现了类似的任务,将战争文件部署到我们的码头服务器:

We implemented similar tasks with Teamcity to deploy war files to our jetty servers:

  • 在创建war文件的普通构建步骤之后,我们调用一个命令行"构建步骤中使用 scp 复制战争的脚本文件到码头服务器.

  • After the ordinary build step that creates the war file, we invoke a script in a "Command Line" build step which uses scp to copy the war file to the jetty server.

在 jetty 服务器上,每 5 个运行一次 cron 作业分钟只是检查是否有新的战争文件.如果有,它关闭码头服务器,备份现有的战争文件和放入新的war文件,然后再次启动jetty服务器.

On the jetty server, there is a cron job running at every five minutes just checking if there is a new war file or not. If there is, it shutdowns down jetty server, backs up the existing war file and put the new war file, then start up jetty server again.

上述解决方案的一个缺点是,在 Teamcity 构建完成后,我们总是需要等待一段时间,直到 cron 作业开始并重新部署战争.

One drawback of the solution above is that after Teamcity build finishes, we always need to wait some time until the cron job kicks in and redeploys the war.

有一种稍微不同的方法,它可以在 Teamcity 构建过程中部署 war 文件:

There is a slightly different approach, which can deploy war file in the Teamcity build process:

不是使用 cron 作业来调用部署脚本,它也可以在scp"完成复制 war 文件后从命令行"构建步骤中调用,如下所示.

Instead of using a cron job to invoke the deployment script, it can be invoked from that "Command Line" build step also, by something like following, after "scp" finishes copying the war file.

ssh -t user@server: "path_to_the_deployment_script"

我们还没有尝试过第二种方法,理论上应该可行.

We have never tried the second approach yet, theoretically it should work.

这篇关于Teamcity 控制应用程序部署?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆