Rails 2.3.3 - Setting to production mode
Asked Answered
A

3

6

How do I set the application to production mode?

Okay, this must be a no-brainer but I'm about to deploy my first Rails app and I've got everything setup properly: Ubuntu Hardy, Passenger, MySQL. However, it's still running in development mode. I've only been able to find documentation for older versions of Rails and want to make sure that I'm doing it right.

Thanks in advance.

Am answered 25/8, 2009 at 7:28 Comment(0)
D
7

You'll need to set the RackEnv instead of RailsEnv. Actually, I just do both (although I mightn't need to...?).

Example vhost for a Rails 2.3 app:

<VirtualHost *:80>

  ...
  RackEnv production
  RailsEnv production
  ...

</VirtualHost>
Dealate answered 25/8, 2009 at 7:53 Comment(2)
Thanks for the tip. I just figured out the error of my ways. It is running in production based on the RAILS_ENV in a view.Am
well that happened to me after upgrading passenger to 3. now i'm forced to use RackEnv don't know whyPiroshki
C
2

passenger by default runs everything in production mode unless you specify otherwise:

Passenger RailsEnv documentation

If you create a view that outputs RAILS_ENV, does it say 'development'?

  • If so, then you may have set the RAILS_ENV variable to 'development' somewhere in your environment.rb file.
  • If you're not seeing that, and are seeing other symptoms, then could you list the symptoms?
Colatitude answered 25/8, 2009 at 7:49 Comment(4)
I've recently started using Rails.env rather than RAILS_ENV. No difference at all, but it feels nicer. Goes well with Rails.root tooLaverne
Thank you, Andy and btelles. There is nothing in my environment.rb regarding the Rails_ENV. Thanks for confirming that Passenger runs in production mode by default. Here's another thing, I found out. The public/index.html loads, but I get a server 500 when trying to access any controllers. I'm stumped.Am
If this doesn't do it you might want to create a new question, but set config.action_controller.consider_all_requests_local = true in your production.rb so you can see error messages.Murrhine
Yup, Andy's on it. You can also check the log files and maybe post the last few requests if they're difficult to decipher.Colatitude
M
0

Based on the docs you can set RailEnv. By default Passenger runs in production mode so maybe you copied RailsEnv development into your config.

Murrhine answered 25/8, 2009 at 7:48 Comment(1)
Hehe...ooohhh, you got to it first!Colatitude

© 2022 - 2024 — McMap. All rights reserved.