Dispatch.fcgi not putting server into Production mode

I’m trying to get production set without changing the environment.rb
file.

I’m using Apache/fastcgi with the following
in /etc/httpd/conf.d/fastcgi.conf:

FastCgiConfig -idle-timeout 900 FastCgiIpcDir /tmp/fastcgi_ipc/ AddHandler fastcgi-script .fcgi .rb FastCgiServer /var/www/vhosts/kettlewell.net/subdomains/jr/httpdocs/dispatch.fcgi -idle-timeout 120 -initial-env RAILS_ENV=production -processes 1 FastCgiServer /var/www/vhosts/kettlewell.net/subdomains/bridal/httpdocs/dispatch.fcgi -idle-timeout 120 -initial-env RAILS_ENV=production -processes 1

I thought that ‘-initial-env RAILS_ENV=production’ was supposed to get
production working, but it’s still creating/generating development.log
and trying to use my development user/pass for MySQL.

I also tried adding:

SetEnv RAILS_ENV production in my httpd.conf file, with no luck

I can set it up in config/environment.rb , but that is purpose
defeating.

What am I missing?

rails: 1.1.6 , ruby 1.8.4, mod_fastcgi: 2.4.2

Matt

Hey Matt, I believe the apache setting is:

-initial-env production

Since you’re setting it incorrectly, it’s likely being set to the
default of Development - which is then overiding your environment.rb
setting.

Cheers,
Jodi
General Partner
The nNovation Group inc.
www.nnovation.ca/blog

On Sat, 2007-01-20 at 20:13 -0500, Jodi S. wrote:

Jodi
General Partner
The nNovation Group inc.
www.nnovation.ca/blog

I tried your suggestion to no avail.

The agile book and several online refs/tutorials put it as
-initial-env RAIL_ENV=production , but regardless, neither seems to be
working.

I did notice that a ps -ef on my server only shows that dispatch.fcgi is
called, but doesn’t show any arguments. Am I missing an escapement or
quoting somewhere?

If it matters, this is Apache 2.0.54 with FC4, ruby 1.8.4 and rails
1.1.6 with mod_fastcgi 2.4.2

Matt

On Jan 20, 2007, at 5:30 PM, matt wrote:

I tried your suggestion to no avail.
If it matters, this is Apache 2.0.54 with FC4, ruby 1.8.4 and rails
1.1.6 with mod_fastcgi 2.4.2

Howdy there.

Let me be the first to suggest you abandon fastcgi and proceed directly
to mongrel. I installed an application on a similar setup recently, and
used apache 2.0.x -> balance -> mongrels via mongrel_cluster and it was
a snap.

If you have the luxury of upgrading Apache to 2.2.3 or higher, you can
bypass balance as well.


– Tom M., CTO
– Engine Y., Ruby on Rails Hosting
– Reliability, Ease of Use, Scalability
– (866) 518-YARD (9273)

Howdy there.

Let me be the first to suggest you abandon fastcgi and proceed directly
to mongrel. I installed an application on a similar setup recently, and
used apache 2.0.x -> balance -> mongrels via mongrel_cluster and it was
a snap.

If you have the luxury of upgrading Apache to 2.2.3 or higher, you can
bypass balance as well.

It all sounds great, and Mongrel does seem to be the trend, so I think I
do need to look into it in more depth. My hesitation is that I have
some Lua apps that are using fastcgi as well. I really haven’t been
happy with the fastcgi/Lua connection anyhow, so I may look at Mongrel
for Ruby and find a Lua alternative. I suppose I could, in theory, run
both fastcgi and Mongrel, but I think that’s playing with fire.

On 20-Jan-07, at 8:30 PM, matt wrote:

working.

I did notice that a ps -ef on my server only shows that
dispatch.fcgi is
called, but doesn’t show any arguments. Am I missing an escapement or
quoting somewhere?

If it matters, this is Apache 2.0.54 with FC4, ruby 1.8.4 and rails
1.1.6 with mod_fastcgi 2.4.2

Matt

I stand corrected Matt. sigh.

For what it’s worth, here’s my syntax. Note I’ve not enclosed within
an if module

LoadModule fastcgi_module modules/mod_fastcgi.so
FastCgiIpcDir /tmp/fcgi_ipc/
FastCgiServer /var/www/html/tln/public/dispatch.fcgi -idle-timeout
6000
-initial-env RAILS_ENV=development -processes 1
AddHandler fastcgi-script .fcgi

  • it seems you’ve got two fastcgi startups on one line? Is that
    permissible?

FastCgiServer /var/www/vhosts/kettlewell.net/subdomains/jr/
httpdocs/dispatch.fcgi -idle-timeout 120 -initial-env
RAILS_ENV=production -processes 1 FastCgiServer /var/www/vhosts/
kettlewell.net/subdomains/bridal/httpdocs/dispatch.fcgi -idle-
timeout 120 -initial-env RAILS_ENV=production -processes 1

You likely have, but I’d also double verify your paths and the write
perms on FastCgiIpcDir.

As another thought, be sure you kill the old ones - the apaches
restart doesn’t always cleanup up well.

good luck.
Jodi

Thanks for your reply.
See comments inline:

LoadModule fastcgi_module modules/mod_fastcgi.so
FastCgiIpcDir /tmp/fcgi_ipc/
FastCgiServer /var/www/html/tln/public/dispatch.fcgi -idle-timeout
6000
-initial-env RAILS_ENV=development -processes 1
AddHandler fastcgi-script .fcgi

I see that you have RAILS_ENV set to development. What happens if you
set it to production? Does it work?

  • it seems you’ve got two fastcgi startups on one line? Is that
    permissible?

This is an email formatting issue. They are actually on 2 separate
lines.

FastCgiServer /var/www/vhosts/kettlewell.net/subdomains/jr/
httpdocs/dispatch.fcgi -idle-timeout 120 -initial-env
RAILS_ENV=production -processes 1 FastCgiServer /var/www/vhosts/
kettlewell.net/subdomains/bridal/httpdocs/dispatch.fcgi -idle-
timeout 120 -initial-env RAILS_ENV=production -processes 1

You likely have, but I’d also double verify your paths and the write
perms on FastCgiIpcDir.

Yeah I double checked the permissions and path of /temp/fastcgi_ipc/
user and group apache and are 755

and the 2 dispatch.fcgi’s exist are owned by the domain owner and are
executable (755)

As another thought, be sure you kill the old ones - the apaches
restart doesn’t always cleanup up well.

I just tried that. killed all the dispatch.fcgis, changed my
environment.rb file back so that RAILS_ENV isn’t explicitly set,
restarted httpd, and checked site. No good, its in development mode
again.

good luck.
Jodi

Any other thoughts? I’m beginning to think I’m stuck with setting the
RAILS_ENV explicitly.
Matt

On Sat, 2007-01-20 at 22:09 -0800, Tom M. wrote:

setting.
quoting somewhere?

If you have the luxury of upgrading Apache to 2.2.3 or higher, you can
bypass balance as well.


are there any blogs / wiki pages that refer to setting up mongrel with
apache 2.0.x because I wouldn’t mind getting away from fcgi

Craig

On 21-Jan-07, at 11:46 AM, matt wrote:

I see that you have RAILS_ENV set to development. What happens if you

kettlewell.net/subdomains/bridal/httpdocs/dispatch.fcgi -idle-

Jodi

Any other thoughts? I’m beginning to think I’m stuck with setting the
RAILS_ENV explicitly.
Matt

hmm. Matt, that was a bad example! Yes I have many running on the
same box in production such as,

FastCgiServer /var/www/html/mephisto/public/dispatch.fcgi -idle-
timeout 6000
-initial-env RAILS_ENV=production -processes 4

Is is possible that you have the environment variable RAILS_ENV set
at the os level? Or is dispatch.fcgi doing something non-standard?
Those are my last thoughts I think Matt - I’ve run to the end of the
possibilities I can imagine.

But, to echo Tom’s thought, I will quick likely be deploying with
Mongrel down the road - so far in development it’s a dream.

Cheers,
Jodi
General Partner
The nNovation Group inc.
www.nnovation.ca/blog

General Partner
The nNovation Group inc.
www.nnovation.ca/blog

I’m beginning to think that either the apache binary has something funky
compiled in or I have some non-standard configuration hidden somewhere.
I am on a Plesk VPS, and they do some things off to the side, but who
knows… for now I’ll just edit my environment.rb file. Mongrel,
unfortunately, won’t help me because of my Lua projects. Maybe I’ll
have to use different servers… but I digress.

Jodi, Thanks so much for your help
Matt