Re: FCGI / Dreamhost

Nicholas Van Weerdenburg
Thu, 24 Nov 2005 18:11:33 -0000

As far as I can tell, Dreamhost overrides RAILS_ENV in it''s fast-cgi
dispatcher. Hard-code environment.rb to development (replace the
ENV[''RAILS_ENV''] || development bit with production).

To test production quickly, without doing this, first check development:
ruby script/console
Article.find :first

Then:
ruby script/console production
Article.find :first
(where Article is a business object that has records)

Finally, dispatch.fcgi is a ruby program that you can run standalone to
debug
ruby -r debug dispatch.fcgi

to use ruby debugger to step throught it.  I found an issue by playing with
console, whereas a coworker did the more clever debug trick and found the
problem at the same time.

Regards,
Nick

On 11/7/05, patrick kranzlmüller
<patrick-KzucmO8QuWNZ0wkgCNX5VF6hYfS7NtTn@public.gmane.org>
wrote:
>
> i tried that before and it didn´t work.
> tried it again now and ... surprise, everything´s fine (though, my
> application is still slow - a little bit faster than with CGI).
>
> thanks.
>
>
> Am 07.11.2005 um 16:16 schrieb Paul Welty:
>
> > It took me a while (a while back) but I successfully implemented FCGI
> > on
> > Dreamhost after getting seemingly perpetual "Application
Errors".
> >
> > I did all the steps you outline below and nothing worked.
> >
> > Here''s what I found out...
> >
> > No matter what, rails will use the production database for fcgi, even
> > if you
> > set it to use development database. What happened to me was that rails
> > was
> > trying to get the data using the production configuration in
> > database.yml.
> > And for me, this wasn''t setup (because I didn''t
think it would be
> > used).
> >
> > When I set the production database configuration correctly in
> > database.yml
> > (actually, I just matched all the values to the development
> > configuration),
> > everything worked fine.
> >
> > Try that and see if it helps,
> >
> > Paul
> >
> >
> >
> > On 11/7/05 6:45 AM, "patrick kranzlmüller"
<patrick-KzucmO8QuWNZ0wkgCNX5VF6hYfS7NtTn@public.gmane.org>
> > wrote:
> >
> >> no errors (i guess):
> >>
> >> => Rails application started on http://0.0.0.0:3000
> >> => Ctrl-C to shutdown server; call with --help for options
> >> [2005-11-07 03:34:17] INFO  WEBrick 1.3.1
> >> [2005-11-07 03:34:17] INFO  ruby 1.8.2 (2005-04-11) [i386-linux]
> >> [2005-11-07 03:34:17] INFO  WEBrick::HTTPServer#start: pid=6119
> >> port=3000
> >>
> >>
> >> Am 07.11.2005 um 11:47 schrieb PJ Hyett:
> >>
> >>> Startup ./script/server to see what errors webrick throws to
get a
> >>> better idea of the problem. (I just dealt with the same issues
> >>> tonight
> >>> on Dreamhost)
> >>>
> >>> -PJ
> >>> http://pjhyett.com
> >>>
> >>> On 11/7/05, patrick k
<patrick-KzucmO8QuWNZ0wkgCNX5VF6hYfS7NtTn@public.gmane.org> wrote:
> >>>> i know that this issue has been discussed before. i still
hope to
> >>>> get
> >>>> some
> >>>> help here.
> >>>>
> >>>> i´m on dreamhost, using FCGI and did the following setup:
> >>>>
> >>>> - using a subdomain (pointing to /public)
> >>>> - fcgi enabled
> >>>> - fcgi-handler in /lib
> >>>> - changed .htaccess
> >>>> - chmod 755 /public and /public/dispatch*
> >>>> - changed the shebang-line of dispatch.fcgi to
#!/usr/bin/ruby
> >>>> - environment.rb: RAILS_ENV =
ENV[''RAILS_ENV''] || ''development''
> >>>>
> >>>> now, i do get an "Application Error (Rails)" -
it´s strange, but
> >>>> when
> >>>> i try
> >>>> to use my application, the "production.log"
gives me a "mysql error"
> >>>> (although, i´m using development in environment.rb).
> >>>>
> >>>> any help is really appreciated.
> >>>>
> >>>> regards,
> >>>> patrick
> >>>>
> >>>>
> >>>> _______________________________________________
> >>>> Rails mailing list
> >>>> Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org
> >>>> http://lists.rubyonrails.org/mailman/listinfo/rails
> >>>>
> >>> _______________________________________________
> >>> Rails mailing list
> >>> Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org
> >>> http://lists.rubyonrails.org/mailman/listinfo/rails
> >>>
> >>
> >> _______________________________________________
> >> Rails mailing list
> >> Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org
> >> http://lists.rubyonrails.org/mailman/listinfo/rails
> >
> >
> > _______________________________________________
> > Rails mailing list
> > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org
> > http://lists.rubyonrails.org/mailman/listinfo/rails
> >
>
> _______________________________________________
> Rails mailing list
> Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org
> http://lists.rubyonrails.org/mailman/listinfo/rails
>


_______________________________________________
Rails mailing list
Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org