Search code examples
ruby-on-railsrackunicorn

config.ru file for Rails 2.3.18 app


Does anyone know what the contents of config.ru should be for a Rails 2.3.18 app in production to run on Passenger/Unicorn/Puma?

So far I've got:

# Require your environment file to bootstrap Rails
require ::File.dirname(__FILE__) + '/config/environment'

# Dispatch the request
run ActionController::Dispatcher.new

but it's loading development instead of the correct production environment.


Solution

  • It turns out this is a perfect config.ru.

    The real problem is that Unicorn's -E parameter sets RACK_ENV and Rails 2.3.18 needs RAILS_ENV in order to correctly detect the environment.

    So, at the top of config/environment.rb, I've set ENV["RAILS_ENV"] ||= ENV["RACK_ENV"] and this is working just great.