3

Why does my Rails application still work in Production mode?

 2 years ago
source link: https://www.codesd.com/item/why-does-my-rails-application-still-work-in-production-mode.html
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

Why does my Rails application still work in Production mode?

advertisements

This is Rails 3.0.3.

My deployment is Apache 2.0 with Phusion Passenger. My httpd.conf block looks like this:

<VirtualHost *:80>
   ServerName www.mycarparts.co
   DocumentRoot /projects/mcp5/public
   <Directory /projects/mcp5/public>
      AllowOverride all
      Options -MultiViews
      Allow from all
   </Directory>
  RailsEnv staging
</VirtualHost>

"Production" is also not specified in my config directory. A grep -i -r yields this:

config/application.rb:# you've limited to :test, :development, or :production. config/database.yml:# Do not set this db to the same as development or production. config/database.yml:production: config/database.yml: database: mcp_production config/database.yml: database: mcp_production config/environments/production.rb: # The production environment is meant for finished, "live" apps. config/environments/production.rb: # Use a different cache store in production config/environments/production.rb: # In production, Apache or nginx will already do this config/newrelic.yml: # capitalized RAILS_ENV (i.e., Production, Staging, etc) config/newrelic.yml: # Do not use for production or load testing.
config/newrelic.yml:# Turn on the agent in production for 24x7 monitoring. NewRelic config/newrelic.yml:production: config/newrelic.yml:# identically to production. Support for that environment is provided

These little surprises with the Apache/Passenger/Rails stack are beginning to become irritating. Can anybody help me run my application in the correct mode?

EDIT: I can put:

RailsEnv peeweeeffingherman

in there and the app still comes up in production mode, which I know is the default. Obviously, the setting is not being read. Why would that be?


If you are on Phusion Passenger < 3.0.2 then RailsEnv only has effect on Rails 1 and Rails 2 apps; Rails 3 apps are considered Rack apps and need RackEnv.

This is a potential source of user confusion so since Phusion Passenger 3, RailsEnv and RackEnv have been made equivalent, and Phusion Passenger sets both RAILS_ENV and RACK_ENV. The Nginx version of Phusion Passenger has always worked like that.


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK