Help getting rails application working on fastcgi on dreamho

Hi,

I’ve previously had a rails application up and running on dreamhost
using
fastcgi, however have just recently performed a “cap deploy” but have
had
problems:

  • I get a long wait period after browsing to the application and
    finially it
    returns “Application Error - Rails application failed to start properly”
  • No entries in the rails production (or development) logs
  • No fastcgi.crash.log entries
  • In the /log/http error.log I see "FastCGI: incomplete headers (0
    bytes)
    received from server "
  • If I run dispatch.rb
    [skybar]$ ruby dispatch.rb
    ./…/config/environment.rb:3: uninitialized constant RAILS_ROOT
    (NameError)
    from dispatch.rb:4:in `require’
    from dispatch.rb:4

Can anyone help with some fault finding tips re how to track down whats
going wrong?

Note that I have made sure:

  • log/temp & dispatch.fcgi are writeable
  • have issued “killall -9 ruby”
  • etc

Thanks in advance
Greg

Greg H. wrote:

Can anyone help with some fault finding tips re how to track down whats
going wrong?

Have you made certain the hashbang lines on your dispatch scripts are
correct for the host?

These need to be absolute paths to the copy of ruby you’re running,
“#!/usr/bin/env ruby” can’t be relied on because there is no useful
environment when they are called by Apache.

After you try to access your site, are there any copies of dispatch.fcgi
running on the host (pa aux in an ssh window will tell you)? If not,
they’re not getting started up, for one reason or another.

–Al Evans

PS. I did not that in ~/logs//http/error.log there are the
follow 2
entries that show up after a timeout period of the browser not returning
correctly:

  • FastCGI: comm with (dynamic) server “/public/dispatch.fcgi”
    aborted: (first read) idle timeout (120 sec)

  • FastCGI: incomplete headers (0 bytes) received from server "
    /public/dispatch.fcgi"

Does this help? Anyone know how to fix this?

hi Bharat

  • Checked for hidden ^M’s but none were there so this should be ok?
  • database credentials are fine (tried a "mysql -h asdf -u …etc)

Any other ideas re getting fastcgi working again on dream host. Again
there
are no rails or fcgicrash logs that appear. I’ve got no real idea how
to
try to track it down?

Tks

PS - I wonder if it could be something to do with copying in the full
set of
directories for my rails application upsetting something to do with the
dreamhost setting for my site? For example whether I have to reforce my
site to be “fastcgi” enabled or something like that? (even though on the
dreamhost panel if I look it is still showing this subdomain to be
fastcgi
enabled)

Greg H. wrote:

PS - I wonder if it could be something to do with copying in the full
set of
directories for my rails application upsetting something to do with the
dreamhost setting for my site? For example whether I have to reforce my
site to be “fastcgi” enabled or something like that? (even though on the
dreamhost panel if I look it is still showing this subdomain to be
fastcgi
enabled)

Do you have the “web directory” field in the setup panel pointed to your
public directory, e.g., /home//<rails_directory>/public?

–Al Evans

did u upload the files created in windows? if so, make sure that you do
not have an extra line break at the end of the first lines of
dispatch.cgi/fcgi. Run ‘cat -v public/dispatch.fcgi | head -1’ and see
if there is a hidden ‘^M’ at the end of the line. If this is ok, then
check your database.yml to ensure that you have given the right
credentials.

I have written a small write up on my experience setting up typo on
bluehost. See if that helps.

Bharat
http://blog.publishedperspectives.com

Al - thanks a million - I believed the other posts about the hashbang
and there was a wailing and gnashing of teeth for a couple of hours
last night!

#!/usr/bin/ruby at the top of dispatch.fcgi capistranoised my app. on
Dreamhost.

Thanks again.

Mr Grumpy is somewhat less so.