This post originated from an RSS feed registered with Ruby Buzz
by Guy Naor.
Original Post: Solving Tough Deploy Problems with FastCGI and Rails
Feed Title: Famundo - The Dev Blog
Feed URL: http://devblog.famundo.com/xml/rss/feed.xml
Feed Description: A blog describing the development and related technologies involved in creating famundo.com - a family management sytem written using Ruby On Rails and postgres
Sometimes you deploy a new rails app with fastcgi and it just doesn't work. No errors, no logs, nothing! Usually it's some permission problems, or a missing file. But it also might be some odd problems like a wrong shebang line somewhere.
The problem with those is that you get no error and no indication of what went wrong. When using the spawner script you might see the actual appication being launched again and again by the spawner, only to die immediately.
I found a neat trick to see what's really going on when this happens. On the deployment directory (on the server you deploy to) edit the file:
vi vendor/rails/railties/lib/commands/process/spawner.rb
And look for the lines that redirect STDIN, STDOUT and STDERR to /dev/null. Comment those lines, and launch the spawner from the command line. The errors will start flowing into the console. Just look at them and you should be on your way to solving the problem.
Here is some code from the spawner file with the lines commented out:
def daemonize#:nodoc:exitiffork# Parent exits, child continues.Process.setsid# Become session leader.exitiffork# Zap session leader. See [1].Dir.chdir"/"# Release old working directory.File.umask0000# Ensure sensible umask. Adjust as needed.# STDIN.reopen "/dev/null" # Free file descriptors and# STDOUT.reopen "/dev/null", "a" # point them somewhere sensible.# STDERR.reopen STDOUT # STDOUT/ERR should better go to a logfile.end