VirtualHost like in the Apache-PHP world

How to make virtual hosts in mongrel?

::how to serve example1.tld, example2.tld, … exampleN.tld's
different ruby apps?

thanks in advence
frikazojd.

________________________________________________________
Újdonság!
Megérkezett a RIGHT GUARD férfi testápolási termékcsalád! Most 25%
kedvezménnyel!
Akár 48 órás hatásos védelem a testszag ellen!

You do it all in Apache. Typical way to deploy mongrel is fronted with
an Apache reverse proxy. You need to set up everything in Apache, and
have the right requests proxied to the right mongrel. It’s all about
apache, no config in Mongrel.

You may also want to consider mod_rails/passenger instead of mongrel, it
seems to be more popular these days for Rails deployment, and you may
find it easier to set up the way you want.

Jonathan

2010/3/24 Nagy Tamás [email protected]:

but i’d like to try out Mongrel…
so, I set the apache with mod_proxy… i think it should forward the request
to mongrel, localhost:3000… but how will the mongrel figure out where are
the ruby apps? it will get a request for example.tld or example6.tld and
example4.tld at the same time… … ??

You need to have at least one mongrel instance per domain, and set
up your httpd proxy accordingly.

Thank you, Jonathan! but i'd like to try out Mongrel…so, I set the
apache with mod_proxy… i think it should forward the request to
mongrel, localhost:3000… but how will the mongrel figure out where are
the ruby apps? it will get a request for example.tld or example6.tld and
example4.tld at the same time… … ??

Jonathan R. [email protected] írta:

________________________________________________________
Újdonság!
Megérkezett a RIGHT GUARD férfi testápolási termékcsalád! Most 25%
kedvezménnyel!
Akár 48 órás hatásos védelem a testszag ellen!

Thank you Hassan, James!

So i will need one mongrel per domain. I think I can't carry out
this because I have a thousands of domains.

I think i will try the rack-thing James mentioned. I assume i can't
run individual ruby script files but whole apps, one app for one domain.

ooohh so hard… :slight_smile:

________________________________________________________
Újdonság!
Megérkezett a RIGHT GUARD férfi testápolási termékcsalád! Most 25%
kedvezménnyel!
Akár 48 órás hatásos védelem a testszag ellen!

On 25 Mar 2010, at 14:34, Nagy Tamás wrote:

Thank you Hassan, James!

So i will need one mongrel per domain. I think I can’t carry out this because I have a thousands of domains.

That sounds like a recipe for out of memory errors and cross-application
errors taking down the whole set at the same time. It also sounds like
it’s better suited to passenger.

I think i will try the rack-thing James mentioned. I assume i can’t run individual ruby script files but whole apps, one app for one domain.

You can load whatever you like, and run anything that responds to #call,
in the standard rack manner. What you won’t be able to do, is load
different versions of dependencies into the same process and expect to
be bug free.

Do you want a seperate app per domain, or do you want one app handling
multiple domains?

If you want a seperate app per domain, I think you’d need a mongrel per
domain too, I don’t see any other way to do it.

If you want one app that handles multiple domains, than it’s up to you
to write an app that can do that, and it’s not a mongrel issue.

Jonathan

On 25 Mar 2010, at 14:52, Jonathan R. wrote:

Do you want a seperate app per domain, or do you want one app handling multiple domains?

If you want a seperate app per domain, I think you’d need a mongrel per domain too, I don’t see any other way to do it.

map “http://domain1.com/” do
run App1.new
end

map “http://domain2.com/” do
run App2.new
end

I see a way to do it.

On Thu, Mar 25, 2010 at 2:04 PM, James T. [email protected]
wrote:

map “http://domain1.com/” do
run App1.new
end

map “http://domain2.com/” do
run App2.new
end

I see a way to do it.

OK, I’ve never used Rack as a standalone entity; how exactly does
this work in a Rails context?

Say, I have a directory structure like

/webapps/app1
/webapps/app2

where both app1 and app2 are Rails apps.

Where does the above code go, and what exactly would I be invoking?

Ok, then it will be Rack. anyway, i want to use the whole ruby as php:
example.tld/rubyscript1.rbexample.tld/rubyscript2.rbexample2.tld/rubyappexample2.tld/rubyapp/rubyscript.rb
where also works any Rails app…

________________________________________________________
Újdonság!
Megérkezett a RIGHT GUARD férfi testápolási termékcsalád! Most 25%
kedvezménnyel!
Akár 48 órás hatásos védelem a testszag ellen!

On 24 Mar 2010, at 22:13, Hassan S. wrote:

2010/3/24 Nagy Tamás [email protected]:

but i’d like to try out Mongrel…
so, I set the apache with mod_proxy… i think it should forward the request
to mongrel, localhost:3000… but how will the mongrel figure out where are
the ruby apps? it will get a request for example.tld or example6.tld and
example4.tld at the same time… … ??

You need to have at least one mongrel instance per domain, and set
up your httpd proxy accordingly.

Actually, you can use rack to do it:

map “http://domain1/” do
run App1
end

map “http://domain2/” do
run App2
end

Then specify multiple vhost aliases in the apache proxy configuration