Forum: Ruby on Rails Running the same application multiple times with different e

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.
Tobias G. (Guest)
on 2006-06-08 22:30
(Received via mailing list)
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
Alex W. (Guest)
on 2006-06-08 22:40
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.
Tobias G. (Guest)
on 2006-06-09 02:33
(Received via mailing list)
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
This topic is locked and can not be replied to.