简体   繁体   English

使用Capistrano在Heroku上部署?

[英]Deploying on Heroku with Capistrano?

I'm still getting used to the Rails development ecosystem. 我还是习惯了Rails开发生态系统。 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. 最近我学会了如何使用capistrano使用apache和passenger来部署到我的服务器,我喜欢如何将一组相当复杂的部署指令放到我的deploy.rb中,以便它们通过单个“cap deploy”调用执行,如果出现任何问题,请自动回滚。

Now I'm looking into deploying my project on Heroku, and I expected to be able to use capistrano for my deployments there. 现在我正在考虑在Heroku上部署我的项目,我希望能够在那里使用capistrano进行部署。 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? 是否有capistrano任务可以让我在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). 毕竟capistrano以特定的方式工作(ssh进入服务器)并假设一个特定的目录结构(公共/发布/共享等)。 Both of these are not possible with Heroku as far as I know. 据我所知,Heroku无法实现这两个目标。 But still I would like to have the convenience of capistrano. 但我仍然希望有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; 我知道我可以将部署所需的步骤(git push / migrate / restart resque workers ...)放到一个rake任务中,并且我可以通过调用单个命令来部署; but I would not have the benefit of capistrano transactions and rollbacks, which are very important in my mind. 但是我不会受到capistrano交易和回滚的好处,这在我看来非常重要。

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. Heroku使用Git进行部署,并且不是capistrano友好的。 In fact, the philosophy itself is different - Heroku does not have 'servers' where you can SSH to, or customize server to your need. 事实上,哲学本身是不同的 - Heroku没有“服务器”,您可以通过SSH连接或根据需要自定义服务器。

Heroku uses Dynos, which are predefined instances, with specific deployment architecture which covers majority of Rails deployment needs. Heroku使用Dynos作为预定义实例,具有特定的部署体系结构,可满足大多数Rails部署需求。 You can do actions like Rollbacks, backups, migrations etc with Heroku, in some cases, more sophisticated than normal capistrano scripts. 您可以使用Heroku执行回滚,备份,迁移等操作,在某些情况下,比普通的capistrano脚本更复杂。

Unless your setup is quite different, you can safely use Heroku for Rails (with only Git, of course) . 除非您的设置完全不同,否则您可以安全地使用Heroku for Rails(当然只使用Git)。 If not, AWS is better bet. 如果没有,AWS是更好的选择。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM