Dreamhost and mod_rails for your tiny Rails application

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.

Mod_Rails(aka Passenger) is an Apache module developed by Phusion, a small Dutch IT consultancy, that makes it easy to deploy Rails applications on Apache-based stacks.

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.

  1. copy using FTP your rails app folder somewhere in your user folder; so you’d have something like ~/my_user/my_rails_app
  2. 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)
  3. check the Ruby on Rails Passenger (mod_rails)? checkbox
  4. 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)

I’m ending this small tutorial by reminding you that, if you are not a Dreamhost user yet and would like to, you can use the promo code discount BRIEPROMOCODE to shave 70$ off your bill. Trust me, it’s the best you can get for the money.

Similar Posts:

Leave a Reply +

Leave a Reply