Running the same application multiple times with different e


#1

Hi!

I have an application that needs to be run on multiple virtual hosts
(Apache2) with each instance having it’s own environment / database.
Using dispatch.cgi I simply configure two virtual hosts pointing to the
same application path and just add a “SetEnv RAILS_ENV
<environment_name>” to each virtual host section in the Apache
configuration. But with FastCGI / dispatch.fcgi this doesn’t work.

Any ideas how to run multiple instances (each having a different
database) of the same application with Apache and FastCGI?

Regards,

Tobias


#2

Tobias G. wrote:

Hi!

I have an application that needs to be run on multiple virtual hosts
(Apache2) with each instance having it’s own environment / database.
Using dispatch.cgi I simply configure two virtual hosts pointing to the
same application path and just add a “SetEnv RAILS_ENV
<environment_name>” to each virtual host section in the Apache
configuration. But with FastCGI / dispatch.fcgi this doesn’t work.

Any ideas how to run multiple instances (each having a different
database) of the same application with Apache and FastCGI?

Regards,

Tobias

I am doing something similar, but with lighttpd. Rails automatically
handles different environments with different databases. Just set them
up in database.yml.

The basic config looks like:

$HTTP[“host”] == “www.mydomain.com” {
server.document-root = “/home/mydomain/public/”
fastcgi.server = (
“.fcgi” =>
( “localhost” =>
(
“socket” =>
“/home/lighttpd/var/run/lighttpd-fcgi-mwprod.socket”,
“bin-path” => “/home/magneticworld/public/dispatch.fcgi”,
“bin-environment” => ( “RAILS_ENV” => “production” ),
“max-load-per-proc” => 25,
“min-procs” => 1,
“max-procs” => 4,
“idle-timeout” => 30
)
)
)
}

$HTTP[“host”] == “dev.mydomain.com” {
server.document-root = “/home/mydomain/public/”
fastcgi.server = (
“.fcgi” =>
( “localhost” =>
(
“socket” =>
“/home/lighttpd/var/run/lighttpd-fcgi-mwdev.socket”,
“bin-path” => “/home/magneticworld/public/dispatch.fcgi”,
“bin-environment” => ( “RAILS_ENV” => “development” ),
“max-load-per-proc” => 25,
“min-procs” => 1,
“max-procs” => 4,
“idle-timeout” => 30
)
)
)
}

2 sites, 2 environments, 2 dbs, running from the same root.


#3

Alex W. wrote:

2 sites, 2 environments, 2 dbs, running from the same root.

Thanks! That’s exactly what I want to do. It’s just, that I want to do
it with Apache2. It seems I can’t set different fcgi servers with
different environments for each virtual host in Apache.

No Apache-Rails-Guru around?

Tobias