This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 160108 - cant configure mongrel to use prefix
Summary: cant configure mongrel to use prefix
Status: NEW
Alias: None
Product: ruby
Classification: Unclassified
Component: Rails (show other bugs)
Version: 6.x
Hardware: PC Linux
: P2 blocker (vote)
Assignee: issues@ruby
URL: http://wiki.netbeans.org/FaqRailsMongrel
Keywords:
Depends on:
Blocks:
 
Reported: 2009-03-11 13:57 UTC by bobanj
Modified: 2011-01-28 20:13 UTC (History)
0 users

See Also:
Issue Type: ENHANCEMENT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description bobanj 2009-03-11 13:57:52 UTC
I've found in http://wiki.netbeans.org/FaqRailsMongrel that mongrel can be configured to use parameters, however it
didnt work, the server starts without prefix
this is how looks my changed script/server file in my rails project

#!/usr/bin/env ruby
ARGV+=%w(mongrel_rails start --prefix /myprefix)
require File.dirname(__FILE__) + '/../config/boot'
require 'commands/server'
Comment 1 Erno Mononen 2009-03-11 14:04:03 UTC
Thanks for the report. What is the error you get? Can you please turn on detailed logging
(http://wiki.netbeans.org/FaqRubyNBLogging), reproduce the issue and and attach the log file here then? Thanks.
Comment 2 bobanj 2009-03-11 14:17:15 UTC
The server starts, but when I open localhost:3000 in my browser I see that the --prefix /myprefix was not initiated. 
When I start my app from console with mongrel_rails start --prefix /myprefix Everything works just fine. I would like to
be able to do this in netbeans too (Just switched from Aptana to Netbeans and so far netbeans kicks ass...except when i
try to start mongrel server with prefix :S ).
Here is what I get in netbeans console

script/server:2: warning: already initialized constant ARGV
=> Booting Mongrel (use 'script/server webrick' to force WEBrick)
=> Rails 2.2.2 application starting on http://0.0.0.0:3000
=> Call with -d to detach
=> Ctrl-C to shutdown server
server: invalid option: --prefix
** Starting Mongrel listening at 0.0.0.0:3000
** Starting Rails with development environment...

I see that server: invalid option: --prefix (this is propably because netbeans executes script/server and does not
mongrel_rails -- just a guess)
Comment 3 Erno Mononen 2009-03-11 14:23:07 UTC
Thanks for the clarification, I'll fix this for 6.7.
Comment 4 Erno Mononen 2009-03-13 11:20:14 UTC
I was a bit too fast in my evaluation. Indeed we run script/server, which doesn't support the prefix option. There are 
a couple of workarounds for this:

- Apply http://dev.rubyonrails.org/attachment/ticket/10674/add_prefix_option_to_script_server_for_mongrel.patch which 
adds the support for script/server

- Modify script/server to run mongrel_rails directly, for example:

#!/usr/bin/env ruby
require File.dirname(__FILE__) + '/../config/boot'
`mongrel_rails start --prefix /myprefix`

Let me know if neither of the workarounds doesn't work for you. I'm changing this to an enhancement for now, we should 
either add direct support for mongrel_rails or let the use to specify the executable to run for starting the server. 
Best would be if they just accept the mentioned patch to Rails.
Comment 5 bobanj 2009-03-15 16:25:05 UTC
Results:
<b>Workaround 1</b>
- Apply http://dev.rubyonrails.org/attachment/ticket/10674/add_prefix_option_to_script_server_for_mongrel.patch which 
adds the support for script/server
After the patch, script/server supported --prefix option from console as expected and was OK,
but I couldn't pass the --prefix argument from netbeans, I've tried to add --prefix in the server properties where port
num is specifid and I've got this err msg ava.lang.NumberFormatException: For input string: "3000 --prefix /boban"
	at java.lang.NumberFormatException.forInputString(NumberFormatException.java:48)
So OK, I can't pass arguments in the port num field...expected. :)
Step 2. I've added ARGV+=%w(--prefix /myprefix) and NetBeans successfully started mongrel with prefix and got this

script/server:2: warning: already initialized constant ARGV
=> Booting Mongrel (use 'script/server webrick' to force WEBrick)
=> Rails 2.2.2 application starting on http://0.0.0.0:3000
=> Call with -d to detach
=> Ctrl-C to shutdown server
** Starting Mongrel listening at 0.0.0.0:3000
** Starting Rails with development environment...
** Mounting Rails at /myprefix...
** Rails loaded.
** Loading any Rails specific GemPlugins
** Signals ready.  TERM => stop.  USR2 => restart.  INT => stop (no restart).
** Rails signals registered.  HUP => reload (without restart).  It might not work well.
** Mongrel 1.1.5 available at 0.0.0.0:3000
** Use CTRL-C to stop.
DEPRECATION WARNING: ActionController::AbstractRequest.relative_url_root= has been renamed.You can now set it with
config.action_controller.relative_url_root=. (called from rails at
/usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/bin/../lib/mongrel/rails.rb:151)

However, when I've tried to use debugging mode in netbeas with this configuration I got the message: Problem occured
during debugging start: Unable to read catchpoint set in the specified timeout [15s]</html>
I've added --debug in the ARGV parameters and mongrel server started in debugging mode, but i could't manipulate all the
good stuff in netbeans because debugging mode didnt work with this workaround.

<b>Workaround 1 Conclusion:</b> Netbeans can start a rails project(rails patch for --prefix support for mongrel, and
script/server patch for the --prefix /myprefix arguments), but only in normal start server mode and not in debugging mode.


<b>Workaround 2</b>
I've added 
`mongrel_rails start --debug --prefix /myprefix` 
in script/server and got the same results, netbeans could't run the server in debug mode.

I hope this helps