Java/JVM Web 应用程序的持续部署
我和我的团队希望实施“持续部署” 用于我们的网站。持续部署基本上意味着非常频繁地部署到生产环境(一天多次)。据说 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
来自 http://radar.oreilly.com/2009/03/ Continuous-deployment-5-eas.html:
为了有效地实现持续部署到生产,您需要良好的监控,否则您将无法了解应用程序发生了什么。
From http://radar.oreilly.com/2009/03/continuous-deployment-5-eas.html:
To effectively implement continuous deployment to production, you need good monitoring, otherwise you will not understand what is happening with your application.
我不知道为什么你认为这是个好主意,但这取决于你。
我将使用一个具有两个热系统的平衡器应用程序,可以在 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.
我们为此使用 apache httpd 2.2 和 mod_proxy
然后我们有 2 个 Tomcat 运行,一个在端口 8080 上,一个在端口 88 上。
防火墙阻止外部访问这些端口,因此仅开放端口 80。
Apache HTTPd 配置为侦听端口 80。
配置也非常简单。
这是开箱即用的基本配置 (httpd.conf):
“+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:
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