简体   繁体   English

将Rails应用程序部署到EC2

[英]Deploy Rails app to EC2

My setup: Rails 2.3.10, Ruby 1.8.7 on Windows 我的设置:Windows上的Rails 2.3.10,Ruby 1.8.7

The last time I deployed a Rails app from Windows to Linux on Slicehost, I used Capistrano, Nginx, Mongrel, and SVN. 我最后一次在Slicehost上从Windows部署到Rails应用程序,我使用了Capistrano,Nginx,Mongrel和SVN。 That was 3 years ago, fast forward to now, I'm still on Windows for development and is now looking to deploy to EC2. 那是3年前,快进到现在,我仍然在Windows上进行开发,现在正在寻求部署到EC2。 A quick search turns up tools like Rubber and Chef which aren't easy to grasp with a quick read. 快速搜索会出现像Rubber和Chef这样的工具,这些工具不易于快速阅读。 It seems like Rubber and Chef are designed for multi-EC2 instances deployment which will be useful when I need to scale. 看起来Rubber和Chef是为多EC2实例部署而设计的,这在我需要扩展时非常有用。

I'm also new to Passenger but it seems to be the default way to deploy Rails app nowadays, one thing that isn't so clear to me is whether Passenger is a replacement for Mongrel? 我也是Passenger的新手,但它现在似乎是部署Rails应用程序的默认方式,我不清楚的一件事是乘客是否是Mongrel的替代品? In my old setup, I configured Nginx to forward the Rails requests to a cluster of Mongrel processes but I don't see anything like that for Passenger. 在我的旧设置中,我配置了Nginx以将Rails请求转发到Mongrel进程的集群,但我没有看到类似于Passenger的任何内容。

Any insights are much appreciated. 任何见解都非常感谢。

We use something like what you're describing for our production server: EC2 + Apache + Passenger. 我们使用类似于您为我们的生产服务器描述的内容:EC2 + Apache + Passenger。 We haven't had any need to use the fancy deployment tools you describe - plain old Capistrano (plus capistrano-ext so we can use it for multiple environments) does the job just fine. 我们没有任何需要使用您描述的花哨的部署工具 - 普通的旧Capistrano(加上capistrano-ext所以我们可以在多个环境中使用它)完成工作就好了。 I've looked at Rubber (not Chef), but deemed it needlessly automagical and too poorly documented, and I'm really not sure what it offers that can't be done just as well with roles in Capistrano. 我看过橡胶(不是厨师),但认为它是不必要的自动化和太糟糕的文件记录,我真的不确定它提供的是什么,不能与Capistrano的角色一样好。

Passenger has been great. 乘客很棒。 It's an "overseer" that manages a collection of Mongrel-like workers (I had thought that the workers were Mongrels, but upon further reading, I don't think they are. The Passenger comparisons page even compares its RPS to a Mongrel cluster, so...), starting them up as needed, culling them under low loads, restarting them if they crash, etc. It's actually very similar to the Server + Mongrel Cluster you described, but probably a bit better, as Passenger has an understanding of the underlying workers that Nginx / Apache don't. 这是一个“监督者”, 管理着一群类似Mongrel的工人 (我曾经认为工人是Mongrels,但经过进一步阅读,我认为不是。 乘客比较页面甚至将其RPS与Mongrel集群进行比较,所以...),根据需要启动它们,在低负载下剔除它们,如果它们崩溃就重新启动它们等等。它实际上与你描述的Server + Mongrel Cluster非常相似,但可能更好一些,因为Passenger有一个理解Nginx / Apache没有的基础工作者。 And you'll have to make a few minor tweaks to get Capistrano playing nicely with Passenger. 而且你必须做一些小的调整才能让Capistrano与Passenger一起玩得很好。

And if possible, pair Passenger with Ruby Enterprise Edition (from the same guys who made Passenger). 如果可能的话,将Passenger与Ruby Enterprise Edition (来自制作Passenger的同一个人)配对。 It's a much faster version of Ruby, mostly due to a rewritten, configurable garbage collector. 这是一个更快的Ruby版本,主要是由于重写的,可配置的垃圾收集器。 You'll have to tune your GC settings to get the most out of it. 您必须调整GC设置才能充分利用它。

Hope this helps! 希望这可以帮助!

Rubystack allows you to have the same Rails environment for development on Windows and for deployment on Linux. Rubystack允许您拥有相同的Rails环境,以便在Windows上进行开发并在Linux上进行部署。 We also have EC2 images (scroll to the bottom) and it is completely free, so you may want to give it a try. 我们还有EC2图像(滚动到底部),它是完全免费的,所以你可能想尝试一下。

Also, this may not work for you, but depending on your requirements, you may want to go for a PaaS solution like Heroku 此外,这可能对您不起作用,但根据您的要求,您可能希望选择像Heroku这样的PaaS解决方案

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

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