Turn to Your Left at the End of the Sky

Starting a Rails Project with Bort

I highly recommend Bort when you’re starting a new Ruby on Rails project. Assuming you’re using MySQL, the following steps are all that are necessary to get started:

  1. Download and unzip Bort into project folder
  2. Edit the database.yml and the settings.yml files
  3. Create the database: mysqladmin -u <username> -p create <db_name_development>
  4. If you’re using Dreamhost: add ‘host: mysql.<dbhostname>.com’ to your database.yml file
  5. rake db:migrate

February 8, 2009 Posted by | Ruby on Rails | , , | Leave a comment

New Relic RPM & Mod_Rails

Unfortunately, the New Relic performance monitor for Ruby on Rails doesn’t work with mod_rails (Passenger). According to a support email from them it currently “only supports mongrel and thin (without sockets)”. They plan to support Passenger in the future. That’s great news because they provide an excellent performance monitoring tool which is very easy to install and use.

Update: New Relic has added support for mod_rails. I received this email from their excellent customer support:

I was just digging through my support emails and found a few people who had inquired about RPM supporting Phusion Passenger, aka mod_rails.

 

I wanted to let you know that we released a version of the agent with ‘beta’ support for Passenger.

 

If you’re interested, check it out and let us know how it works for you!

 

To try it out, just do:

 

script/install –force http://svn.newrelic.com/rpm/agent/newrelic_rpm

 

Bill Kayser

New Relic RPM Developer

 

August 1, 2008 Posted by | Computers & Internet, Internet, Ruby on Rails, Technology | , , , , | 1 Comment

Why Does Mod_Rails Start Slowly?

If you’re running your low-volume Ruby on Rails app on mod_rails (Passenger) and have wondered why the first page takes 5 seconds or more to load, there is an excellent explanation here.

July 1, 2008 Posted by | Computers & Internet, Ruby on Rails | , , , , | Leave a comment

Migrating Rails App to Dreamhost using mod_rails

Over Memorial Day weekend I migrated my Rails Application to Dreamhost using mod_rails (Passenger). It was not an entirely smooth process but I was also upgrading from Rails 1.8.x at the same time. That was compounded by making the foolish mistake of trying to rebuild my database using Rake migrations. (That’s a bad idea. I could have saved many hours by just uploading the schema)

Here is the procedure I followed (hat tip to Nock):

  1. cd ~/
  2. rails your_app_name -d mysql
  3. Copy app/, database.yml, routes.rb, db/
  4. Change public/.htaccess from .cgi to .fcgi
  5. put your app into production mode (uncomment line 5 in environment.rb)
  6. run rake db:migrate RAILS_ENV=production
  7. chmod -R 755 ~/your_app_name/app
  8. rm your_app_name/public/index.html
  9. killall -USR1 dispatch.fcgi
  10. killall -USR1 ruby

One comment on step 4. For some reason none of my stylesheets would load. Much of the advice gleaned from endless Google searches seemed to suggest that the problem would be fixed by setting the RewriteBase in /public/.htaccess. That turned out to not be the case.

My stylesheet problem was caused by having this line twice in my .htaccess file

RewriteRule ^(.*)$ dispatch.fcgi[QSA,L]

DO NOT uncomment the one before RewriteEngine On , as all the tutorials seem to imply, just change the .cgi to .fcgi in the block below it.

Thanks to Dreamhost for their stellar support over a frustrating (for me!) Memorial Day weekend. In the end, (as is so often the case), very little of the frustration was caused by Dreamhost or mod_rails but, rather, by some of the vagaries of Rails. I’m guessing that future deployments would be much smoother as this was my first time deploying to a shared hosting environment.

May 27, 2008 Posted by | Computers & Internet, Internet, Ruby on Rails, Technology | , , , , , | 3 Comments

Dreamhost Supports Passenger and mod_rails

I use Dreamhost to host my websites and they have now added support for Passenger (a.k.a mod_rails). Ruby on Rails deployment hassles should be a distant memory soon!

If you’re looking for a cheap and cheerful hosting company for your Rails app, I highly recommend Dreamhost. It’s great for the solo developer (or small team) because for a small amount per year you can launch your site on a shared hosting service and then later easily migrate it to a virtual private server as your needs change. 

Dream in Rails

May 26, 2008 Posted by | Computers & Internet, Internet, Ruby on Rails, Technology | , , , , | Leave a comment