你是怎么做的滚动与Capistrano的部署? [英] How do you do a rolling deploy with capistrano?

查看:159
本文介绍了你是怎么做的滚动与Capistrano的部署?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们后面有一个负载平衡器2实例应用程序运行在同一轨道客运。当我们部署服务器的启动时间会导致请求超时。因此,我们有一个单独采取一次性的LB,帽部署,测试动态页面加载,把它放回LB更新每个Web服务器的脚本。

We have 2 instances behind a load balancer running the same rails app with passenger. When we deploy, the server startup time causes requests to timeout. As a result we have a script that updates each webserver individually by taking one off the LB, deploying with cap, testing a dynamic page load, putting it back on the LB.

我们怎样才能Capistrano的同一个命令做到这一点的我们呢?我已经能够将其设置为同时部署到所有情况,但他们都重新启动在同一时间,并导致网站无法使用,持续20秒。

How can we get capistrano to do this for us with one command? I have been able to set it up to deploy to all instances simultaneously but they all restart at the same time and cause the site to be unavailable for 20 seconds.

我在想什么吗?看起来这应该是一个普遍的模式。

What am I missing here? Seems like this should be a common pattern.

推荐答案

我要寻找一个优雅的解决这一问题太多 - 基本上,如何组部署的服务器或如何做A / B部署。现在,我已经创建了两个独立的阶段 - production_even和production_odd。我们使用Capistrano的版本2。

I am looking for an elegant solution to this problem too - basically, how to group deployment servers or how to do A/B deployments. For now, I have created two separate stages - production_even and production_odd. We are using capistrano version 2.

在production_even.rb文件,我把我们所有的偶数服务器和奇数服务器中的其他文件。

In the production_even.rb file, I put all of our even numbered servers and odd numbered servers in the other file.

我运行这个人:>帽production_even部署和放大器;&安培;盖production_odd部署

I run this by:> cap production_even deploy && cap production_odd deploy

此外,我们的负载均衡器配置为执行Web服务器上的一个心跳检查,所以我停下来nginx的为使用sudo的/etc/init.d/nginx停止'的第一步(我想你也可以使用服务nginx的一站式')。这一次定时自动删除从轮换一组部署目标服务器,并确保所有当前请求关闭前通过nginx的回应。当部署完成后,我开始nginx的这使他们回到了轮换。

Also, our load balancer is configured to do a heartbeat check on the web servers, so I stop nginx as one of the first steps using 'sudo /etc/init.d/nginx stop' (I think you could also use 'service nginx stop'). This automatically removes the deployment target servers from rotation one group at a time and it ensures that all current requests are responded to by nginx before shutting down. When deployment is done, I start nginx which puts them back in rotation.

我知道这是不是一个命令的答案,但是这是我现在最好的。我会继续研究。

I realize this is not a one command answer, but this is the best I got for now. I will keep researching.

我同意这似乎是一个基本的部署用例应该是已经建成Capistrano的那个。

I agree that this seems to be a basic deployment use case that should be already built into capistrano.

希望这有助于。

这篇关于你是怎么做的滚动与Capistrano的部署?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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