Re: FCGI / Dreamhost

Tom Wilcoxen
Thu, 24 Nov 2005 18:46:06 -0000

First, you should really run in production at DreamHost. Your development
should generally be on your own machine. You can read why here:

http://weblog.textdrive.com/article/175/rails-optimizing-resource-usage

Some of this post applies at DreamHost and some doesn''t, but
it''s pretty
useful. Point #3 talks about running with FastCGI in development mode.

As far as setting to ''development'', you''d have to
change this line:

RAILS_ENV = ENV[''RAILS_ENV''] ||
''development''

to:

RAILS_ENV = ''development''

Because DreamHost does set the environment to ''production'' by
default. What
the line above (first version) says is, ''if ENV[RAILS_ENV] is set, use
that
value, otherwise set it to ''default''. Changing it to the
second version will
force it to ''development''.

-Tom

On 11/24/05, Nicholas Van Weerdenburg
<vanweerd-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
wrote:
>
> 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@vonautomatisch.at>
> > > 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
> http://lists.rubyonrails.org/mailman/listinfo/rails
>
>
>


--
Tom Wilcoxen
http://convergentarts.com


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