Forum: Ruby on Rails using mongrel to serve 2 rails apps

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.
Bb97327d13788335cb459d10e3c3ce01?d=identicon&s=25 John Henderson (Guest)
on 2007-01-23 00:36
hi,

i'm using mongrel as my production webserver, and i want to serve 2
rails apps

e.g.

www.myapp.com
www.myapp.com/forums

i want in effect to connect the second app to /forums on the same url.

currently i have 2 mongrels running as follows:-

my main app on port 80 at www.myapp.com
my forums app on port 81 at www.myapp.com

rather than giving out the URL www.myapp,com:81 for my forums, I would
like to use www.myapp.com/forums and have this redirect invisibly to
www.my.com:81

i've looked on the mongrel website and I've come across mongrel clusters
and also mogrel configuration scripts - but this all quite complex and
i'm not sure if either is the answer.

any pointers?

cheers,

-john
36af61ea50e1720c96f04bf807c377e8?d=identicon&s=25 Randall Potter (Guest)
on 2007-01-23 01:05
(Received via mailing list)
John Henderson wrote:
>
> <snip/>
>
>
I'd suggest putting a web server with load balancing and proxying
support in front of your mongrels such as Apache or Lighty.  Then use
the prefix feature of mongrel to bind app2 to /forums/.

--R
Bb97327d13788335cb459d10e3c3ce01?d=identicon&s=25 John Henderson (Guest)
on 2007-01-23 01:11
Randall Potter wrote:
> John Henderson wrote:
>>
>> <snip/>
>>
>>
> I'd suggest putting a web server with load balancing and proxying
> support in front of your mongrels such as Apache or Lighty.  Then use
> the prefix feature of mongrel to bind app2 to /forums/.
>
> --R

thanks Randall - i have lighty installed but i'm not sure how to 'put in
in front' of the two mongrels...

presumably i start the 2 mongrels on some higher port numbers, say 8100
and 8101.
then run lighty on port 80.

then do i not then need to tell lighty to bind /forums/ to the 2nd
mongrel?
(or something like that....)

cheers,

-john
36af61ea50e1720c96f04bf807c377e8?d=identicon&s=25 Randall Potter (Guest)
on 2007-01-23 05:08
(Received via mailing list)
John Henderson wrote:
> (or something like that....)
>
> cheers,
>
> -john
>
>
You do need to tell Lighty where to find the mongrels it's forwarding
to.  Look into the documentation for Lighty's mod_proxy for the syntax.

Using your example; you want to forward / to your primary app at
http://localhost:8100 and forward /forums/ to http:localhost:8101.

When you start the mongrel(s) for the forum application you need to be
sure to pass the --prefix=/<name> option (e.g. mongrel_rails start
--prefix=/forums -e production -d ) otherwise, your link_to, button_to
et. al. will get confused and keep trying to send you back to app1.

--R
9c6cc262b3df5dca4315c9eab433a1b8?d=identicon&s=25 Alexander Flatter (aflatter)
on 2007-01-23 11:59
(Received via mailing list)
Hello,
You could also try the following:
Use 'mongrel_rails start' with '--script=/path/to/script.rb' and use
any options you like in this file, especially the uri[1] method.
You can then mount handlers to different mount points.
It should work, but I never tested it, so I've no idea concerning
performance issues.

Best regards


[1]
http://mongrel.rubyforge.org/rdoc/classes/Mongrel/...

John Henderson schrieb:
Bb97327d13788335cb459d10e3c3ce01?d=identicon&s=25 John Henderson (Guest)
on 2007-01-26 21:09
thanks Randall,

i'm getting close now... but still not quite there yet...

i have 2 mongrels on 8100 and 8101.

i'm trying to configure lighty to point / to 8100 and /forums to 8101.
so, just starting with the main site on 8100, i have this in my
lighttpd.conf file....


proxy.balance = "hash"
proxy.server = ( "/" => (( "host" => "127.0.0.1", "port" => 8100))



but all i get is a blank page - which is better than an error message i
guess...

does anyone have a working lighttpd.conf file i could learn from?

cheers,

-john
This topic is locked and can not be replied to.