Multiple JRuby-Rack apps in one WAR


#1

I want to package multiple apps (two sinatra apps and two rails apps) in
one
WAR, with rack URL mappings to determine which URL maps to which app.
How
who I go about doing that with Jruby-rack, warble?

Thanks!

Steve

View this message in context:
http://www.nabble.com/Multiple-JRuby-Rack-apps-in-one-WAR-tp22993731p22993731.html
Sent from the JRuby - User mailing list archive at Nabble.com.


To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email

#2

On Fri, Apr 10, 2009 at 3:26 PM, steve_molitor removed_email_address@domain.invalid
wrote:

I want to package multiple apps (two sinatra apps and two rails apps) in one
WAR, with rack URL mappings to determine which URL maps to which app. How
who I go about doing that with Jruby-rack, warble?

Should be do-able, though you’ll probably have to wire things up
yourself with a custom config.ru and using something like
Rack::Cascade. If you can make a rackup file that works outside of
jruby-rack, it should (with few to hopefully zero modifications) work
with it too.

/Nick


To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email

#3

Thanks, I got two sinatra apps WARed up in one war, running fine so far.
In
the ru file, for the sinatra apps, I just instantiate the app, which
extends
Sinatra::Base, and say ‘run app’. What’s the best way to start a Rails
app
in this situation?

Also, can I set things up such that each app gets its own JRuby runtime?
Requests for each app would be multithreaded within that runtime. I
worried
about two apps defining a class with the same name.

Thanks again!

Steve

Nick S.-2 wrote:

Should be do-able, though you’ll probably have to wire things up
http://xircles.codehaus.org/manage_email


View this message in context:
http://www.nabble.com/Multiple-JRuby-Rack-apps-in-one-WAR-tp22993731p22996707.html
Sent from the JRuby - User mailing list archive at Nabble.com.


To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email

#4

On Fri, Apr 10, 2009 at 7:37 PM, steve_molitor removed_email_address@domain.invalid
wrote:

Thanks, I got two sinatra apps WARed up in one war, running fine so far. In
the ru file, for the sinatra apps, I just instantiate the app, which extends
Sinatra::Base, and say ‘run app’. What’s the best way to start a Rails app
in this situation?

Also, can I set things up such that each app gets its own JRuby runtime?
Requests for each app would be multithreaded within that runtime. I worried
about two apps defining a class with the same name.

  1. That should be possible, but not without you rolling up your
    sleeves a bit. Right now the web app servlet context attributes
    expects only a single RackApplicationFactory per app; you’ll have to
    make it multi-app-factory-aware.

  2. You’ll probably also need to map several copies of the RackFilter,
    and make each filter use its own rack factory (see 1).

Hope that gives you enough of a hint to get started!

/Nick


To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email