Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

like image 769
tristanm Avatar asked Jul 24 '13 06:07

tristanm


1 Answers

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.

like image 137
tristanm Avatar answered Sep 23 '22 02:09

tristanm