Hello, I am trying to put a rails app I development into production. When I alter my apache config like so: SetEnv RAILS_ENV production (used to be SetEnv RAILS_ENV development) and reload apache, the site still stays in development mode. I do the following on my homepage to check what environment I''m using: <%= RAILS_ENV %> However, if I add this line to my environment.rb: ENV[''RAILS_ENV''] ||= ''production'' The application successfully switches into production mode. I do have complete control over my server, so I''m trying to "properly" put the application in production mode, vs. editing the environment.rb file. Any suggestions? Let me know if posting more code / commands would be helpful. Thanks, Sean --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Russell Norris
2007-Mar-27 17:02 UTC
Re: Trouble putting Rails App into Production with apache2
What does SetEnv ENV[''RAILS_ENV''] production get you? I noticed this weekend that Apache2 seems to define ENV in some kind of weird way. If it at all does. ENV == {} in environment.rb for me. I''m curious what the deal is. RSL On 3/26/07, Sean Lerner <lerner.sean-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > > Hello, > > I am trying to put a rails app I development into production. When I > alter my apache config like so: > > SetEnv RAILS_ENV production > (used to be SetEnv RAILS_ENV development) > > and reload apache, the site still stays in development mode. I do the > following on my homepage to check what environment I''m using: > <%= RAILS_ENV %> > > However, if I add this line to my environment.rb: > ENV[''RAILS_ENV''] ||= ''production'' > > The application successfully switches into production mode. > > I do have complete control over my server, so I''m trying to "properly" > put the application in production mode, vs. editing the environment.rb > file. > > Any suggestions? Let me know if posting more code / commands would be > helpful. > > Thanks, > > Sean > > > > >--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Sean Lerner
2007-Mar-28 19:23 UTC
Re: Trouble putting Rails App into Production with apache2
Hi Russell, I tried as you suggested, but it doesn''t work. I found this though: http://lists.radiantcms.org/pipermail/radiant/2006-October/002105.html which states "SetEnv happens on a per-request basis, but your Rails process starts in the context of Apache not that of a request." and that statement leads me to believe that it doesn''t matter what I have configured in my site-specific configuration. Where''s the right spot to configure for a Rails/Apache2/fcgi setup to switch from development to production? thanks, Sean On Mar 27, 1:02 pm, "Russell Norris" <sco...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> What does > > SetEnv ENV[''RAILS_ENV''] production > > get you? I noticed this weekend that Apache2 seems to define ENV in some > kind of weird way. If it at all does. ENV == {} in environment.rb for me. > I''m curious what the deal is. > > RSL > > On 3/26/07, Sean Lerner <lerner.s...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > > Hello, > > > I am trying to put a rails app I development into production. When I > > alter my apache config like so: > > > SetEnv RAILS_ENV production > > (used to be SetEnv RAILS_ENV development) > > > and reload apache, the site still stays in development mode. I do the > > following on my homepage to check what environment I''m using: > > <%= RAILS_ENV %> > > > However, if I add this line to my environment.rb: > > ENV[''RAILS_ENV''] ||= ''production'' > > > The application successfully switches into production mode. > > > I do have complete control over my server, so I''m trying to "properly" > > put the application in production mode, vs. editing the environment.rb > > file. > > > Any suggestions? Let me know if posting more code / commands would be > > helpful. > > > Thanks, > > > Sean--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Russell Norris
2007-Mar-28 20:07 UTC
Re: Trouble putting Rails App into Production with apache2
Anyone? This is puzzling me too. RSL On 3/28/07, Sean Lerner <lerner.sean-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > > Hi Russell, > > I tried as you suggested, but it doesn''t work. I found this though: > > http://lists.radiantcms.org/pipermail/radiant/2006-October/002105.html > > which states > > "SetEnv happens on a per-request basis, but your Rails process starts > in the > context of Apache not that of a request." > > and that statement leads me to believe that it doesn''t matter what I > have configured in my site-specific configuration. > > Where''s the right spot to configure for a Rails/Apache2/fcgi setup to > switch from development to production? > > thanks, > > Sean > > > On Mar 27, 1:02 pm, "Russell Norris" <sco...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > What does > > > > SetEnv ENV[''RAILS_ENV''] production > > > > get you? I noticed this weekend that Apache2 seems to define ENV in some > > kind of weird way. If it at all does. ENV == {} in environment.rb for > me. > > I''m curious what the deal is. > > > > RSL > > > > On 3/26/07, Sean Lerner <lerner.s...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > > > > > > Hello, > > > > > I am trying to put a rails app I development into production. When I > > > alter my apache config like so: > > > > > SetEnv RAILS_ENV production > > > (used to be SetEnv RAILS_ENV development) > > > > > and reload apache, the site still stays in development mode. I do the > > > following on my homepage to check what environment I''m using: > > > <%= RAILS_ENV %> > > > > > However, if I add this line to my environment.rb: > > > ENV[''RAILS_ENV''] ||= ''production'' > > > > > The application successfully switches into production mode. > > > > > I do have complete control over my server, so I''m trying to "properly" > > > put the application in production mode, vs. editing the environment.rb > > > file. > > > > > Any suggestions? Let me know if posting more code / commands would be > > > helpful. > > > > > Thanks, > > > > > Sean > > > > >--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
If you are using Apache2 to proxy to Mongrel, then the Mongrel processes need to be running in Rails production mode, and nothing you do in Apache config will help. mongrel_rails -e production -p <port> ... On Mar 28, 1:07 pm, "Russell Norris" <r...-ftMzyaTR+bHNyFkoKTPOtdi2O/JbrIOy@public.gmane.org> wrote:> Anyone? This is puzzling me too. > > RSL > > On 3/28/07, Sean Lerner <lerner.s...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > > Hi Russell, > > > I tried as you suggested, but it doesn''t work. I found this though: > > >http://lists.radiantcms.org/pipermail/radiant/2006-October/002105.html > > > which states > > > "SetEnv happens on a per-request basis, but your Rails process starts > > in the > > context of Apache not that of a request." > > > and that statement leads me to believe that it doesn''t matter what I > > have configured in my site-specific configuration. > > > Where''s the right spot to configure for a Rails/Apache2/fcgi setup to > > switch from development to production? > > > thanks, > > > Sean > > > On Mar 27, 1:02 pm, "Russell Norris" <sco...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > What does > > > > SetEnv ENV[''RAILS_ENV''] production > > > > get you? I noticed this weekend that Apache2 seems to define ENV in some > > > kind of weird way. If it at all does. ENV == {} in environment.rb for > > me. > > > I''m curious what the deal is. > > > > RSL > > > > On 3/26/07, Sean Lerner <lerner.s...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > > Hello, > > > > > I am trying to put a rails app I development into production. When I > > > > alter my apache config like so: > > > > > SetEnv RAILS_ENV production > > > > (used to be SetEnv RAILS_ENV development) > > > > > and reload apache, the site still stays in development mode. I do the > > > > following on my homepage to check what environment I''m using: > > > > <%= RAILS_ENV %> > > > > > However, if I add this line to my environment.rb: > > > > ENV[''RAILS_ENV''] ||= ''production'' > > > > > The application successfully switches into production mode. > > > > > I do have complete control over my server, so I''m trying to "properly" > > > > put the application in production mode, vs. editing the environment.rb > > > > file. > > > > > Any suggestions? Let me know if posting more code / commands would be > > > > helpful. > > > > > Thanks, > > > > > Sean--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Russell Norris
2007-Mar-29 16:41 UTC
Re: Trouble putting Rails App into Production with apache2
What if we''re not using Mongrel? RSL On 3/28/07, CRAZ8 <tomfakes-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > > If you are using Apache2 to proxy to Mongrel, then the Mongrel > processes need to be running in Rails production mode, and nothing you > do in Apache config will help. > > mongrel_rails -e production -p <port> ... > > > On Mar 28, 1:07 pm, "Russell Norris" <r...-ftMzyaTR+bHNyFkoKTPOtdi2O/JbrIOy@public.gmane.org> wrote: > > Anyone? This is puzzling me too. > > > > RSL > > > > On 3/28/07, Sean Lerner <lerner.s...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > > > > > > Hi Russell, > > > > > I tried as you suggested, but it doesn''t work. I found this though: > > > > >http://lists.radiantcms.org/pipermail/radiant/2006-October/002105.html > > > > > which states > > > > > "SetEnv happens on a per-request basis, but your Rails process starts > > > in the > > > context of Apache not that of a request." > > > > > and that statement leads me to believe that it doesn''t matter what I > > > have configured in my site-specific configuration. > > > > > Where''s the right spot to configure for a Rails/Apache2/fcgi setup to > > > switch from development to production? > > > > > thanks, > > > > > Sean > > > > > On Mar 27, 1:02 pm, "Russell Norris" <sco...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > What does > > > > > > SetEnv ENV[''RAILS_ENV''] production > > > > > > get you? I noticed this weekend that Apache2 seems to define ENV in > some > > > > kind of weird way. If it at all does. ENV == {} in environment.rbfor > > > me. > > > > I''m curious what the deal is. > > > > > > RSL > > > > > > On 3/26/07, Sean Lerner <lerner.s...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > > > > Hello, > > > > > > > I am trying to put a rails app I development into production. When > I > > > > > alter my apache config like so: > > > > > > > SetEnv RAILS_ENV production > > > > > (used to be SetEnv RAILS_ENV development) > > > > > > > and reload apache, the site still stays in development mode. I do > the > > > > > following on my homepage to check what environment I''m using: > > > > > <%= RAILS_ENV %> > > > > > > > However, if I add this line to my environment.rb: > > > > > ENV[''RAILS_ENV''] ||= ''production'' > > > > > > > The application successfully switches into production mode. > > > > > > > I do have complete control over my server, so I''m trying to > "properly" > > > > > put the application in production mode, vs. editing the > environment.rb > > > > > file. > > > > > > > Any suggestions? Let me know if posting more code / commands would > be > > > > > helpful. > > > > > > > Thanks, > > > > > > > Sean > > > > >--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Tom Mornini
2007-Mar-29 17:13 UTC
Re: Trouble putting Rails App into Production with apache2
On Mar 29, 2007, at 9:41 AM, Russell Norris wrote:> What if we''re not using Mongrel?Perhaps you should be? :-) Try setting the environement variable: RAILS_ENV=production Before starting up your Rails instance and that should do the trick. -- -- Tom Mornini, CTO -- Engine Yard, Ruby on Rails Hosting -- Reliability, Ease of Use, Scalability -- (866) 518-YARD (9273) --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Russell Norris
2007-Mar-29 17:18 UTC
Re: Trouble putting Rails App into Production with apache2
Oh, I''m sure I should be but my budget has me on shared hosting at the moment and last time I looked Mongrel and shared hosting didn''t want to play well together. I do run Mongrel on my desktop to develop but even here when I use Apache[2] I don''t mongrelize because that''s not what the end host is. :/ RSL On 3/29/07, Tom Mornini <tmornini-W/9V78bTXriB+jHODAdFcQ@public.gmane.org> wrote:> > > On Mar 29, 2007, at 9:41 AM, Russell Norris wrote: > > > What if we''re not using Mongrel? > > Perhaps you should be? :-) > > Try setting the environement variable: > > RAILS_ENV=production > > Before starting up your Rails instance and that should do the trick. > > -- > -- Tom Mornini, CTO > -- Engine Yard, Ruby on Rails Hosting > -- Reliability, Ease of Use, Scalability > -- (866) 518-YARD (9273) > > > > >--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Are you on Dreamhost? I''ve had to add this to the top of my dispatch.fcgi files for Rails apps on Dreamhost: ENV[''RAILS_ENV''] = ''production'' I also have a cron that hits the site every 5 minutes to keep it in memory. On Mar 29, 10:18 am, "Russell Norris" <r...-ftMzyaTR+bHNyFkoKTPOtdi2O/JbrIOy@public.gmane.org> wrote:> Oh, I''m sure I should be but my budget has me on shared hosting at the > moment and last time I looked Mongrel and shared hosting didn''t want to play > well together. I do run Mongrel on my desktop to develop but even here when > I use Apache[2] I don''t mongrelize because that''s not what the end host is. > :/ > > RSL > > On 3/29/07, Tom Mornini <tmorn...-W/9V78bTXriB+jHODAdFcQ@public.gmane.org> wrote: > > > > > On Mar 29, 2007, at 9:41 AM, Russell Norris wrote: > > > > What if we''re not using Mongrel? > > > Perhaps you should be? :-) > > > Try setting the environement variable: > > > RAILS_ENV=production > > > Before starting up your Rails instance and that should do the trick. > > > -- > > -- Tom Mornini, CTO > > -- Engine Yard, Ruby on Rails Hosting > > -- Reliability, Ease of Use, Scalability > > -- (866) 518-YARD (9273)--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Russell Norris
2007-Mar-30 12:36 UTC
Re: Trouble putting Rails App into Production with apache2
Yeah. I am a DHer. There''s also the stopgap line like that you can uncomment in config/environment.rb [which for me was just as easy to uncomment via Capistrano on deploy] but I was curious about finding the real solution to Apache2''s problem. Which, I guess, we _did_ find with that whole request scope issue. :/ I _did_ discover the perfect reaper action though, for Apache2 [presuming you''re not using Mongrel] script/process/reaper -a graceful -d dispatcher.fcgi Seems like the default reaper task doesn''t actually restart the dispatcher. If you run it multiple times, watch the PID[s] it says it''s restarting. They never change because they''re never affected. Graceful works nicely though and actually stops the dispatcher. Just a tip. :) RSL On 3/30/07, CRAZ8 <tomfakes-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > > Are you on Dreamhost? I''ve had to add this to the top of my > dispatch.fcgi files for Rails apps on Dreamhost: > > ENV[''RAILS_ENV''] = ''production'' > > I also have a cron that hits the site every 5 minutes to keep it in > memory. > > > On Mar 29, 10:18 am, "Russell Norris" <r...-ftMzyaTR+bHNyFkoKTPOtdi2O/JbrIOy@public.gmane.org> wrote: > > Oh, I''m sure I should be but my budget has me on shared hosting at the > > moment and last time I looked Mongrel and shared hosting didn''t want to > play > > well together. I do run Mongrel on my desktop to develop but even here > when > > I use Apache[2] I don''t mongrelize because that''s not what the end host > is. > > :/ > > > > RSL > > > > On 3/29/07, Tom Mornini <tmorn...-W/9V78bTXriB+jHODAdFcQ@public.gmane.org> wrote: > > > > > > > > > On Mar 29, 2007, at 9:41 AM, Russell Norris wrote: > > > > > > What if we''re not using Mongrel? > > > > > Perhaps you should be? :-) > > > > > Try setting the environement variable: > > > > > RAILS_ENV=production > > > > > Before starting up your Rails instance and that should do the trick. > > > > > -- > > > -- Tom Mornini, CTO > > > -- Engine Yard, Ruby on Rails Hosting > > > -- Reliability, Ease of Use, Scalability > > > -- (866) 518-YARD (9273) > > > > >--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Sean Lerner
2007-Apr-05 14:54 UTC
Re: Trouble putting Rails App into Production with apache2
Hi Folks, I decided just to live with putting the application into production by modifying the environment.rb file. I appreciate all your suggestions. Thanks a lot. Sean --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---