Java/JVM Web 应用程序的持续部署

发布于 2024-10-18 12:53:18 字数 538 浏览 8 评论 0原文

我和我的团队希望实施持续部署” 用于我们的网站。持续部署基本上意味着非常频繁地部署到生产环境(一天多次)。据说 Etsy 一直都是这么做的。

我们的环境是Tomcat + Nginx。我们已经使用 Hudson 和热部署的 Hudson+Cargo 插件将任何代码更改持续部署到我们的快照服务器(即传统的持续集成)。

令人惊讶的是,效果很好(尽管随着时间的推移,我们有时必须重新启动 tomcat)。

对于生产来说这是行不通的,因为我们不能关闭网站。 我有一些想法,例如拥有两个网络应用程序并在其中一个应用程序关闭时进行重定向。

有人有任何想法或之前在真实的生产环境中这样做过吗?

My team and I would like to implement "Continuous Deployment" for our website. Continuous Deployment basically means deploying to production very frequently (multiple times a day). Supposedly Etsy does this all the time.

Our environment is Tomcat + Nginx. We already do Continuous deployment of any code change to our snapshot server (ie traditional continuous integration) using Hudson and a Hudson+Cargo plugin that hot deploys.

Surprisingly that works well (albeit over time we have to restart tomcat sometimes).

For production this is not going to work because we can't have the website down.
I have some ideas like having two web apps and redirecting while one is down.

Anybody have any ideas or has done this before in a real production environment?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

因为看清所以看轻 2024-10-25 12:53:18

来自 http://radar.oreilly.com/2009/03/ Continuous-deployment-5-eas.html

实时警报。无论您的部署过程有多好,错误仍然可能出现。最烦人的错误是在部署导致这些错误的代码数小时或数天后才显现出来的错误。为了捕获这些令人讨厌的错误,您需要一个监控平台,可以让您知道何时出现问题,并让人员参与调试它们。

为了有效地实现持续部署到生产,您需要良好的监控,否则您将无法了解应用程序发生了什么。

From http://radar.oreilly.com/2009/03/continuous-deployment-5-eas.html:

Real-time alerting. No matter how good your deployment process, bugs can still get through. The most annoying variety are bugs that don’t manifest until hours or days after the code that caused them is deployed. To catch those nasty bugs, you need a monitoring platform that can let you know when things have gone awry, and get a human being involved in debugging them.

To effectively implement continuous deployment to production, you need good monitoring, otherwise you will not understand what is happening with your application.

耶耶耶 2024-10-25 12:53:18

我不知道为什么你认为这是个好主意,但这取决于你。

我将使用一个具有两个热系统的平衡器应用程序,可以在 tomcat 本身中找到它,然后在部署之前停止服务器,部署并重新启动服务器。为每个热服务器留出两分钟的时间窗口,这样就可以了。

编辑:我不会每次都部署。我们也是一家小公司,没有太多 QA (tm),但仍然只需在构建系统中单击一下即可上线。

I don't know WHY you think this is a good idea, but thats up to you.

I would use a balancer application with two hot systems, which can be found in tomcat itself, and then just stop the server before deployment, deploy, and restart the server. Leave a two minute window for each hot server, and you should be good.

EDIT: I wouldn't deploy EVERYTIME. We also are a small company with noch much QA (tm), but it is still one click in the build system to go live.

上课铃就是安魂曲 2024-10-25 12:53:18

我们为此使用 apache httpd 2.2 和 mod_proxy

然后我们有 2 个 Tomcat 运行,一个在端口 8080 上,一个在端口 88 上。
防火墙阻止外部访问这些端口,因此仅开放端口 80。

Apache HTTPd 配置为侦听端口 80。

配置也非常简单。
这是开箱即用的基本配置 (httpd.conf):

 LoadModule proxy_module modules/mod_proxy.so
 LoadModule proxy_balancer_module modules/mod_proxy_balancer.so
 LoadModule proxy_http_module modules/mod_proxy_http.so
 <Proxy balancer://mycluster>
    BalancerMember http://localhost:8080
    BalancerMember http://localhost:88 status=+H
 </Proxy>
 ProxyPass / balancer://mycluster/
 ProxyPassReverse / balancer://mycluster/

“+H”表示它仅用作备份服务器,因此当 8080 无法访问时,它将在 88 上运行,直到 8080 重新上线

We use apache httpd 2.2 and mod_proxy for this

We then have 2 tomcats running, one on port 8080, and one on port 88.
The firewall prevents outside access to those ports, so only port 80 is open

Apache HTTPd is configured to listen on port 80

It is very simple to configure too.
This is a basic configuration (httpd.conf) that will work out of the box:

 LoadModule proxy_module modules/mod_proxy.so
 LoadModule proxy_balancer_module modules/mod_proxy_balancer.so
 LoadModule proxy_http_module modules/mod_proxy_http.so
 <Proxy balancer://mycluster>
    BalancerMember http://localhost:8080
    BalancerMember http://localhost:88 status=+H
 </Proxy>
 ProxyPass / balancer://mycluster/
 ProxyPassReverse / balancer://mycluster/

The "+H" means that it is only used as a backup server, so when 8080 is unreachable, it will run on 88 until 8080 comes back online

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文