Thursday, March 25, 2010

rails won't run in production

I've been working on a Rails app (2.3.5).

I'm hosting on modest hardware and chose Nginx and Thin to hopefully get the most performance out of my app.

My problem was that my app wouldn't run in production. It worked fine in development, but not in production.

There were a couple of problems:
  1. I was using a legacy database, and like non-pluralised table names, development picked up 'ActiveRecord::Base.pluralize_table_names = false' in my config/environment.rb, but I didn't seem to propagate to production. I added in 'ActiveRecord::Base.pluralize_table_names = false' into ./config/environments/production.rb
  2. Thin wouldn't start. Starting thin with -D allowed me to start it not daemonized, and then I could see the problem: 'Missing the Rails  gem. Please `gem install -v= rails`, update your RAILS_GEM_VERSION'.
    This is Thin reacting against rack version 1.1.0 apparently.
    gem uninstall --version '> 1.0.1' rack fixed that.
One less thing on my todo list.

No comments: