Friday October 12, 2007
TOTD #13: Setup Mongrel for JRuby-on-Rails applications on Windows
In a previous entry, I posted instructions on how to setup Mongrel cluster for JRuby-on-Rails applications on Unix-based systems. The instructions specified there do not work on Windows-based systems because of the following reasons:
So if you want JRuby-on-Rails applications to deploy on Mongrel on Windows, then the workaround is to checkout the JRuby trunk and use Rails 1.2.3. This blog explains the instructions on how to do that. The Mongrel cluster cannot be configured on JRuby yet though.
As a side note, repeated invocation of "jruby" command will
encounter JRUBY-1350.
The workaround is to exit out of the current command prompt and execute the
commands in a new one.
mkdir jruby-trunk
cd jruby-trunk
svn co http://svn.codehaus.org/jruby/trunk/jruby
antjruby-trunk/bin to your PATH.C:\workspaces\jruby-trunk\bin>jruby -J-Xmx384m -S gem install
rails --version 1.2.3 --include-dependencies --no-ri --no-rdoc
Bulk updating Gem source index for: http://gems.rubyforge.org
Successfully installed rails-1.2.3
Successfully installed rake-0.7.3
Successfully installed activesupport-1.4.2
Successfully installed activerecord-1.15.3
Successfully installed actionpack-1.13.3
Successfully installed actionmailer-1.3.3
Successfully installed actionwebservice-1.2.3C:\workspaces\jruby-trunk\bin>jruby -S gem install gem_plugin
--no-ri --no-rdoc
Successfully installed gem_plugin-0.2.2C:\workspaces\jruby-trunk\bin>jruby -S gem install
cgi_multipart_eof_fix --no-ri --no-rdoc
Successfully installed cgi_multipart_eof_fix-2.3C:\workspaces\jruby-trunk\bin>jruby -S gem install
mongrel-1.0.1-jruby.gem --no-ri --no-rdoc
Successfully installed mongrel, version 1.0.1
Make sure to invoke the command from the directory where the
gem is downloaded.mongrel_cluster
does not work with JRuby and
mongrel_jcluster does not work on Windows. So Mongrel
clusters cannot be configured on a Windows machine.
jruby-trunk\samples\rails and
create a new Rails application as shown below:C:\workspaces\jruby-trunk\samples\rails>..\..\bin\jruby -S rails
hello
create
create app/controllers
create app/helpers
create app/models
...
create log/production.log
create log/development.log
create log/test.logC:\workspaces\jruby-trunk\samples\rails\hello>..\..\..\bin\jruby
script\server
=> Booting Mongrel (use 'script/server webrick' to force WEBrick)
=> Rails application starting on http://0.0.0.0:3000
=> Call with -d to detach
=> Ctrl-C to shutdown server
** Ruby version is not up-to-date; loading cgi_multipart_eof_fix
** Starting Mongrel listening at 0.0.0.0:3000
** Starting Rails with development environment...
** 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 available at 0.0.0.0:3000
** Use CTRL-C to stop.http://localhost:3000
and shows the default "Welcome Aboard You're riding the Rails!" page.
Hit Ctrl-C to stop Mongrel as shown below:** INT signal received.
Exiting
C:/workspaces/jruby-trunk/lib/ruby/gems/1.8/gems/activesupport-1.4.2/lib/active_support/dependencies.rb:452:in
`const_missing': Mongrel::StopServer (Mongrel::StopServer)
from C:/workspaces/jruby-trunk/lib/ruby/gems/1.8/gems/mongrel-1.0.1-jruby/lib/mongrel.rb:723:in
`run'
from C:/workspaces/jruby-trunk/lib/ruby/gems/1.8/gems/mongrel-1.0.1-jruby/lib/mongrel/configurator.rb:271:in
`initialize'
Terminate batch job (Y/N)? yAn alternative to this behemoth configuration and lack of Mongrel cluster on Windows is to create a Web ARchive (WAR) of your JRuby-on-Rails application and deploy on GlassFish. A complete screencast of how this can be achieved using NetBeans IDE is shown here. A comprehensive list of JRuby on GlassFish documentation is available here.
Technorati: totd rubyonrails jruby ruby mongrel windows jrubyonglassfish glassfish netbeans
Posted by Arun Gupta in web2.0 | Comments[2]
|
|
|
|
|
Today's Page Hits: 503
Total # blog entries: 1002
Posted by Arun Gupta's Blog on November 09, 2007 at 07:17 AM PST #
THANK YOU ADMIN
Posted by koçluk on August 26, 2009 at 01:58 PM PDT #