Webrick mount app

Hi All,

I am currently developing against webrick and as such my application
appears under http://localhost:3000/ but in my continuous integration
environment (jruby war deployed to tomcat) the application appears
under http://localhost:8080/myapp
This is a pain when writing Selenium tests because in development I
can use commands such as…
open /foo
… but the ci needs to use …
open /myapp/foo

Note that I think this is a deficiency in the SeleneseAntTask which
accepts a startURL, but … “Note that only the hostname part of this
URL will really be used.”
So… instead I’m wanting a “quick” solution by setting an application
context on webrick.

I thought this was possible just by using …
server.mount( ‘/myapp’, … )
… but when I do this Rails gives me a routing error… eg,

No route matches “/myapp/foo” with {:method=>:get}

So, I’m assuming I’m missing something in my webrick config in order
to mount myapp? … or do I need to add something to routes.rb?

ps. I originally posted this to
http://lists.rubyonrails.org/mailman/listinfo/rails but had no reply
from anyone… even after mailing [email protected] to
find out what was going on … so is that list defunct?

So, no one can help me with this? … have I posted to the wrong forum?
… should I have posted to Rails Deployment?

What do you need help with? No, sure!

On Fri, Sep 19, 2008 at 9:17 AM, Sam R. <

On Sep 18, 9:36 pm, Sam R. [email protected]
wrote:

How do I deploy an application to webrick that can then be found under a
specified application context such as localhost:3000/myapp rather than
the default localhost:3000

Add it into config/routes.rb:
map.connect ‘myapp/:controller/:action/:id’
map.connect ‘myapp/:controller/:action/:id.:format’

For mapped resources, use the namespace. Here’s the example in my
routes.rb:

Sample resource route within a namespace:

map.namespace :admin do |admin|

# Directs /admin/products/* to Admin::ProductsController (app/

controllers/admin/products_controller.rb)

admin.resources :products

end

This probably isn’t the “right” way. Another option would be to use
apache to proxy the requests, either proxying and reverse proxying /
myapp to / to webbrick, or proxying and reverse proxying / to /myapp
for tomcat.

Kevin

How do I deploy an application to webrick that can then be found under a
specified application context such as localhost:3000/myapp rather than
the default localhost:3000

Thanks Kevin, that indeed works on webrick but it does kill the tomcat
version.
No matther though because it can be reconfigured based on environment.
So … Thanks!