To my shame as a rubyist, it was only a couple of hours ago that I found out, while reading Ruby Inside about mod_rails and the wonders it does for the Rails community.
Several performance tests show it to be pretty fast, and it uses shared memory in a better way than mongrel, making it the best choice for shared server Rails hosting. For dedicated or VPS, mongrel is still the right choice being slightly faster and using less RAM (see this for reference).
What’s the best part about mod_rails ? Dreamhost included it on their standard setup, which means all of us can finally use Dreamhost for our casual Ruby on Rails apps. The nightmare is over for Rails developers on a budget.
How do you set up a Rails app on Dreamhost? Pretty darn easy.
- copy using FTP your rails app folder somewhere in your user folder; so you’d have something like ~/my_user/my_rails_app
- set up a new domain/subdomain from your Dreamhost control panel (see the Manage Domains button). Make sure to use the same FTP user, and under “Specify your web directory:” fill in my_rails_app/public (where my_rails_app was the folder with your Rails application)
- check the Ruby on Rails Passenger (mod_rails)? checkbox
- you are done (off course, provided you have configured your rails app’s config/environment.rb and database.yml with the required specifics – your Dreamhost database name, user name and password; also, Dreamhost supports for now two Rails versions: 1.2.6 and 2.0.2, so make sure you’re using that specific one)
When you edit your Rails code and would like your app to take the changes into account, Passenger(mod_rails) must be notified for restarting/reloading. You’ll do this by changing(updating) a file called restart.txt under my_rails_app/tmp/ folder. The simplest command for this is touch tmp/restart.txt from the ssh console(i’m assuming you’re located within my_rails_app)