Perfect Rails Server

What is the ideal rails server? Suppose it is on a VPS, for example Linode. Suppose that any of the sites does not become another twitter, but they should scale well. It must also support multiple sites, and all sites are rails 3. And the database must be on the same server (for now).

Should i use apache or nginx?

Ruby Enterprise Edition or just plain Ruby?

The ideal Linux distribution

MySQL, PostgreSQL or something else?

How should directories be laid out (where to place your rail sites or something else)?

Deployment Options?

Anything else?

+7
linux ruby-on-rails ruby-on-rails-3
source share
2 answers

Should i use apache or nginx? Nginx seems to be the preferred route here if you don't need specific Apache features. If you use Passenger, both Apache and Nginx are supported. Read more about the passenger here .

Ruby Enterprise Edition or just plain Ruby? I'm sure REE is only available for Ruby 1.8, which is no longer the preferred version for Rails 3. Rails 3 had some problems with 1.8, but they may have fixed them by now. Typically, Ruby 1.9.2 runs Rails 3 well.

The perfect Linux distribution. It really doesn't matter. If you're not sure, Ubuntu is a good choice, as there is a lot of knowledge, and it's pretty easy to use. Slicehost has tons of great articles about getting started with VPS, and many of them focus specifically on Ubuntu: http://articles.slicehost.com/ .

MySQL, PostgreSQL or something else? This is definitely subjective. MySQL is definitely the most common there, and if you're really unsure, this is a good starting point. However, people often claim that PostgreSQL is cleaner and easier to use MySQL. If you are just starting out, I would recommend MySQL just because there was already a lot of information.

How should directories be laid out (where to place your rail sites or something else)? You can put your rails anywhere, so I like to just put it in my home directory. Just make sure your web server has access to your static assets.

Capistrano's deployment options are popular. You just commit your changes and cap deploy and you will work.

Anything else? If this all seems overwhelming, look at a simpler solution like Heroku . They set everything up for you, and although you are losing some flexibility, you donโ€™t have to worry about it. Their prices are not so bad and they offer a free option.

+14
source share

I think kyl summed up. But I decided that I would let you know exactly what I used with rails beta4 (and now with RC). This setup worked well for me:

Rackspace Cloud Servers - Gives you full control of the server. You can resize your servers on the fly. You can also take snapshots if you want to duplicate settings for another site. Its cheap and, in my opinion, better than the Amazon cloud.

CentOS 5.4 is solid, but as kyl said, probably any distribution will work fine.

Ruby 1.9.2RC 2 - No problem so far on Rails 3 for me. Will definitely use Ruby Enterprise when they port it to 1.9.2 (not sure if this works, though?)

Nginx is fast and easy. I like it a lot better than Apache. It works well in front of the Passenger, the palace and the subtle.

MySQL is a personal preference. I have been using it for many years. Easy to configure master / slave or master / master configuration if you need to scale. Some people are successful just using sqlite, but I prefer something more robust.

Github is my source control. Bundler works great with github

Application server I am still discussing what to do about it. I was pleased with Passenger 2.2.15 until I saw how long it took to create new ruby โ€‹โ€‹processes to handle concurrency. It takes up to 30 seconds to create a new process for me, and the application is blocked, so no requests can go through while it spawns. Iโ€™m investigating right now if this is my application or Rails 3, which takes so long to load. However, this problem has been fixed with Passenger 3. Hopefully this will be released soon. As a result of this, I'm probably going to use Thin or Mongrel until Passenger 3 comes out.

Capistrano - Works great for Rails 3. I would recommend finding some cap recipes for the version of your application with git tags ... or just write your own.

Anything else? Not related to the server, but I would recommend using the new plugin API for any part of your application that can be reused. Read about rails and engines. Its easy to create a gem with Jeweler and version it with github using the task of a rake jeweler. You can then expand the github tag or the wizard by adding the gem and github source to your Gemfile and package, installing or updating it. I recently ported all of my common application code (blog, authentication, etc.) to Rails 3, and it works great. And anytime I need to reuse this code, I just drop it into a new Gemfile application.

+3
source share

All Articles