I want to set up a shared server at my company where people can run their Rails app under apache with mod_ruby. Each would get their own virtual host etc. The problem I''m running into is that by default all the apps share the ActiveRecord::Base.connection, so they don''t talk to the proper database. Is there a way around this without making each app have a base subclass of ActiveRecord with it''s own db connection and the have each model subclass this base model? Ideally I could have each virtual host have their own namespace, but I don''t think mod_ruby can do this. Has anyone else solved this? -- Daniel Hobe daniel-Rb441GAJvreWkzVdRvz7FA@public.gmane.org
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Daniel Hobe wrote: | Has anyone else solved this? Yes! Use FastCGI :) jeremy -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.6 (Darwin) Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org iD8DBQFBmmUVAQHALep9HFYRAndgAJ9OuwdvH0nqSWO56lQvx5ZN4FWQXwCgvQ5D Vz3kMyN7R/ez2jdOMSZtegI=SeaC -----END PGP SIGNATURE-----
Jeremy Kemper wrote:> Daniel Hobe wrote: > | Has anyone else solved this? > > Yes! Use FastCGI :)Seconded. FastCGI is much more suited to a shared hosting environment than mod_ruby, simply because it uses a separate Ruby interpreter per application, rather than per server process. Tim. -- Tim Bates tim-kZbwfhiKUx26c6uEtOJ/EA@public.gmane.org
David Heinemeier Hansson
2004-Nov-16 21:11 UTC
Re: Hosting multiple rails apps under mod_ruby
> Ideally I could have each virtual host have their own namespace, but I > don''t think mod_ruby can do this.It''s not safe to run multiple Rails applications in the same mod_ruby space. Your options are: 1) Run a different Apache for each Rails application 2) Switch to Fast CGI The latter is probably the easiest. Fast CGI is faster than mod_ruby in my tests as well. And Fast CGI processes can be accessed by many Apache processes and can be restarted independently of Apache. -- David Heinemeier Hansson, http://www.basecamphq.com/ -- Web-based Project Management http://www.rubyonrails.org/ -- Web-application framework for Ruby http://macromates.com/ -- TextMate: Code and markup editor (OS X) http://www.loudthinking.com/ -- Broadcasting Brain
On Wednesday, November 17, 2004, 8:11:48 AM, David wrote:>> Ideally I could have each virtual host have their own namespace, but I >> don''t think mod_ruby can do this.> It''s not safe to run multiple Rails applications in the same mod_ruby > space. Your options are:> 1) Run a different Apache for each Rails application > 2) Switch to Fast CGI> The latter is probably the easiest. Fast CGI is faster than mod_ruby in > my tests as well. And Fast CGI processes can be accessed by many Apache > processes and can be restarted independently of Apache.Does anyone have pointers for setting up FastCGI under Windows? Gavin