Forum: Ruby on Rails Apache / FastCGI freak out in PRODUCTION mode on my new rail

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Efe398b3b5436b0a8d4430090e8f86ea?d=identicon&s=25 subimage interactive (Guest)
on 2005-12-13 04:23
(Received via mailing list)
Here I go again with another question. I've been banging my head for the
better part of a week against this one, so responses would be really
appreciated.

I have a Rails application that I've been developing under
Apache/FastCGI in
_development_ mode. All is well and works wonderfully, until I change my
httpd.conf from this:

<IfModule mod_fastcgi.c>
  FastCgiServer /var/www/genselect/public/dispatch.fcgi \
                -initial-env RAILS_ENV=development \
                -processes 2 \
                -idle-timeout 60
</IfModule>

To this:

<IfModule mod_fastcgi.c>
  FastCgiIpcDir /tmp/fcgi_ipc
  FastCgiServer /var/www/genselect/public/dispatch.fcgi \
                -initial-env RAILS_ENV=production \
                -processes 2 \
                -idle-timeout 60
</IfModule>

When I do that, the site won't come up at all in my browser and I get
this
in my apache error_log:

[Mon Dec 12 19:01:09 2005] [error] [client 192.169.1.1] FastCGI: comm
with
server "/var/www/genselect/public/dispatch.fcgi" aborted: idle timeout
(60
sec)
[Mon Dec 12 19:01:09 2005] [error] [client 192.169.1.1] FastCGI:
incomplete
headers (0 bytes) received from server
"/var/www/genselect/public/dispatch.fcgi"

I have another rails application running in production mode on the same
machine, and it works fine - so I know how to get it done. I've even
removed
my previous rails app from the httpd.conf to test if there is some sort
of
FCGI collision going on, but there's not - my new app still fails to
start
up in production mode.

My _old_ rails app is something I started on 0.13 (and I'm pretty sure I
haven't updated). I noticed the environment.rb files are very different
between the two, but the 0.13 one still works just fine. (My new rails
app
is 0.14.4)

My database settings are all kosher (I've even pointed production /
development mode to the same database with no luck), and I've cleared
sessions out of my DB between restarts.

I've commented everything out of production.rb, but still no luck. I'm
going
crazy here - does anyone have an idea what could be causing my problems?
Efe398b3b5436b0a8d4430090e8f86ea?d=identicon&s=25 subimage interactive (Guest)
on 2005-12-13 04:35
(Received via mailing list)
Alright - I feel really stupid, but I just solved it literally seconds
after
I posted the message.

Someone on the irc channel suggested that I run webrick in prodcution
mode.
It gave me this

/usr/lib/ruby/gems/1.8/gems/activerecord-1.13.1/lib/active_record/connection_adapters/abstract/connection_specification.rb:73:in
`establish_connection': production database is not configured
(ActiveRecord::AdapterNotSpecified)

So I checked out my database.yml file again and found out that I had a
SPACE
on the line between test and production mode, and THAT was causing the
problem.

Just in case someone else has the same problem one day - look at your
database.yml file really closely.
2dd4f0af6b0137e9a0798b1f1abb9b00?d=identicon&s=25 Mike Zornek (Guest)
on 2005-12-13 16:08
(Received via mailing list)
On 12/12/05 10:22 PM, "subimage interactive" <subimage@gmail.com> wrote:

> I've commented everything out of production.rb, but still no luck. I'm going
> crazy here - does anyone have an idea what could be causing my problems?

A few notes that might help...

I'm personally having an issue wherein I'm using a very similar FastCGI
config line, but it's not passing the production flag over to the app
properly -- and thus is was always trying to start in development. Mine
looks like:

<IfModule mod_fastcgi.c>
FastCgiIpcDir /tmp/fcgi_ipc
FastCgiServer /webserver/cbwebsite/releases/rel29/public/dispatch.fcgi \
    -initial-env RAILS_ENV=production -processes 5 -idle-timeout 120
</IfModule>

To fix it I've temporarily told Rails to run in production by hand in
the
environment.rb file but I'd really like to know why the above isn't
working.

Some issues I ran into before but are now solved:

For some reason the temp folder (/tmp/fcgi_ipc) was initially owned by
my
user, and then when I tried to boot the server www couldn't write into
it. I
deleted it, restarted apache and only then could it create a new folder
that
was owned by www and would work.

Finally, another issue I once has was the shebang line in dispatch.fcgi
--
it was pointed to a previous ruby install, and not my current one which
knew
where to find FastCGI.

Good luck.

~ Mike
--
http://MikeZornek.com
This topic is locked and can not be replied to.