用Capistrano部署Heroku? [英] Deploying on Heroku with Capistrano?

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

问题描述

我仍然习惯于Rails开发生态系统。最近我学会了如何使用capistrano来使用apache和passenger来部署到我的服务器上,并且我非常喜欢我可以将一套相当复杂的部署指令放到我的deploy.rb中,以便通过一次cap deploy调用执行它们,如果出现任何问题,请自动回滚。



现在我正在考虑在Heroku上部署项目,我希望能够在那里使用capistrano进行部署。但是我一直无法找到关于如何做到这一点的任何文档。可能吗?是否有capistrano任务让我在Heroku上自动部署?



这是否有意义?毕竟capistrano以特定的方式工作(ssh进入服务器),并假设一个特定的目录结构(public / releases / shared等)。就我所知,这两种方法对Heroku来说都是不可能的。但我仍然想拥有卡皮斯特拉诺的便利。我知道我可以将部署所需的步骤(git push / migrate / restart resque workers ...)放到一个rake任务中,我可以方便地通过调用单个命令进行部署;但我没有capistrano交易和回滚的好处,这在我看来非常重要。



我可能错过了关于这些技术如何配合在一起的非常基本的东西。这令我感到惊讶,我无法在任何地方找到关于此主题的任何讨论。任何人都可以分享他们的经验吗?

事实上,哲学本身是不同的 - Heroku没有服务器,您可以在其中进行SSH连接,或根据需要定制服务器。

Heroku使用Dynos,这是预定义的实例,具有特定的部署架构,覆盖了大部分Rails部署需求。您可以使用Heroku执行回滚,备份,迁移等操作,在某些情况下,可以比普通的Capistrano脚本更复杂。



除非您的设置完全不同,否则您可以安全地使用Heroku for Rails(当然,只有Git)。如果不是,AWS更好。

I'm still getting used to the Rails development ecosystem. Recently I learned how to use capistrano for deploying to my servers using apache and passenger, and I love how I can put a rather complex set of deployment instructions into my deploy.rb so that they are executed with a single "cap deploy" call, with an automatic rollback if anything goes wrong.

Now I'm looking into deploying my project on Heroku, and I expected to be able to use capistrano for my deployments there. But I've been unable to find any documentation on how to do this. Is it possible? Are there capistrano tasks that let me automate deployments on Heroku?

Does this even make sense? After all capistrano works in a specific way (ssh into the server) and assumes a specific directory structure (public/releases/shared etc). Both of these are not possible with Heroku as far as I know. But still I would like to have the convenience of capistrano. I know I can put the steps necessary for my deployment (git push/migrate/restart resque workers...) into a single rake task, and I would have the convenience of deploying with a call to a single command; but I would not have the benefit of capistrano transactions and rollbacks, which are very important in my mind.

I'm probably missing something very basic about how these technologies fit together. It surprises me a bit I haven't been able to find any discussion on this subject anywhere. Can anyone share their experiences?

解决方案

Heroku uses Git for deployment, and is not capistrano friendly. In fact, the philosophy itself is different - Heroku does not have 'servers' where you can SSH to, or customize server to your need.

Heroku uses Dynos, which are predefined instances, with specific deployment architecture which covers majority of Rails deployment needs. You can do actions like Rollbacks, backups, migrations etc with Heroku, in some cases, more sophisticated than normal capistrano scripts.

Unless your setup is quite different, you can safely use Heroku for Rails (with only Git, of course) . If not, AWS is better bet.

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

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