Skip to main content

Redmine on GlassFish - Ruby-on-Rails Project Management Application

Posted by arungupta on May 23, 2008 at 9:08 AM EDT


Redmine
is a flexible project management web application written using Ruby on Rails framework. The feature list is pretty comprehensive from the usual suspects like multiple projects, role-based control, forums/wikis/SCM for each project to enterprise level features such as LDAP-authentication and multiple languages. It is cross-platform and cross-database and deploys very nicely on GlassFish v3.

GlassFish v3 modularity and extensibility allows Rails applications to be deployed without any modification (no WARing). This blog explains the steps on how to deploy Redmine on GlassFish and shows some screenshots later. More documentation is available in Redmine Guide.
  1. Check out the most stable release of Redmine by giving the command:

    ~/testbed/redmine >svn co http://redmine.rubyforge.org/svn/branches/0.7-stable redmine-0.7
  2. Configure the database
    1. Start your MySQL server 

      ~/testbed/redmine >sudo mysqld_safe --user root
      Starting mysqld daemon with databases from /usr/local/mysql/data
    2. Create the database as:

      ~/testbed/redmine/redmine-0.7 >../jruby-1.1.1/bin/jruby -S rake db:create
      (in /Users/arungupta/testbed/redmine/redmine-0.7)
    3. Migrate the database as:

      ~/testbed/redmine/redmine-0.7 >../jruby-1.1.1/bin/jruby -S rake db:migrate
      (in /Users/arungupta/testbed/redmine/redmine-0.7)
      == 1 Setup: migrating =========================================================
      -- create_table("attachments", {:force=>true})
         -> 0.2840s
      -- create_table("auth_sources", {:force=>true})
         -> 0.0540s
      -- create_table("custom_fields", {:force=>true})
         -> 0.0430s
      -- create_table("custom_fields_projects", {:id=>false, :force=>true})
         -> 0.0080s
      -- create_table("custom_fields_trackers", {:id=>false, :force=>true})
         -> 0.0500s

      . . .

      == 90 ChangeVersionsNameLimit: migrating ======================================
      -- change_column(:versions, :name, :string, {:limit=>nil})
         -> 0.0220s
      == 90 ChangeVersionsNameLimit: migrated (0.0220s) =============================

      == 91 ChangeChangesetsRevisionToString: migrating =============================
      -- change_column(:changesets, :revision, :string, {:null=>false})
         -> 0.0210s
      == 91 ChangeChangesetsRevisionToString: migrated (0.0230s) ====================

      == 92 ChangeChangesFromRevisionToString: migrating ============================
      -- change_column(:changes, :from_revision, :string)
         -> 0.0130s
      == 92 ChangeChangesFromRevisionToString: migrated (0.0150s) ===================
  3. Download, Install and Configure GlassFish v3
    1. Download GlassFish v3 from here.
    2. Unzip the downloaded bundle.
    3. Add the following fragment as the last line in "glassfishv3-tp2/glassfish/config/asenv.conf" file:

      JRUBY_HOME="/Users/arungupta/testbed/redmine/jruby-1.1.1"
  4. Deploy Redmine as:

    ~/testbed/redmine >./glassfishv3-tp2/glassfish/bin/asadmin deploy redmine-0.7
    Command deploy executed successfully.

    ... and the GlassFish console shows:

    May 21, 2008 4:58:30 PM com.sun.enterprise.rails.RailsDeployer registerAdapter
    INFO: Loading application redmine-0.7 at /redmine-0.7
    May 21, 2008 4:58:30 PM 
    INFO: Starting Rails instances
    May 21, 2008 4:58:37 PM 
    SEVERE: JRuby limited openssl loaded. gem install jruby-openssl for full support.
    http://wiki.jruby.org/wiki/JRuby_Builtin_OpenSSL
    May 21, 2008 4:58:42 PM com.sun.grizzly.jruby.RubyObjectPool$1 run
    INFO: Rails instance instantiation took : 11979ms
    May 21, 2008 4:58:42 PM com.sun.enterprise.v3.deployment.DeployCommand execute
    INFO: Deployment of redmine-0.7 done is 12091 ms
That's it, your application is ready to be used! Here are some screen snapshots from my trial run:


















Rails powered by the GlassFish Application Server provides all the good reasons on why you should consider using GlassFish instead of the traditional deployment models for Ruby-on-Rails applications.

This application is also covered in LAB 5539 as part of FREE 20-week Ruby-on-Rails course by Sang "with Passion" Shin.

Technorati: web2.0 rubyonrails jruby ruby glassfish redmine
Related Topics >>

Comments

I've not tried setting up the subversion repository. You might consider asking that question on users@glassfish.dev.java.net.

I've installed Redmine using Apache and Thin, and successfully set up integration with Subversion. So, Redmine can create a new subversion repository for a project and can browse the repository. The repository creation works via mod_perl. Does the integration with Subversion work when using Glassfish? If so, what steps are required to set that up?

BTW, I tried with JRuby 1.1.3, Rails 2.0.2, MySQL and it worked! Do you have a public facing website for your deployment ?

Thanks pasi, did you file an JIRA issue for JRuby ?

Hi, Just a quick update: It's jruby that's the problem. With jruby-1.1.4 it works! Thanks again for a great tutorial.

Hi Arun, Thanks for the awesome tutorial. Have you possibly tried it with the following combination of software: glassfishv3-prelude jruby-1.1.5 redmine-0.7.3 postgresql-8.2 When accessing the website (remote-address:8080/redmine-0.7.3) the browser just sits a while (around 5 minutes) and then shows a blank page and the following exception is printed in the Glassfish log: [#|2008-12-02T17:45:30.366+0200|SEVERE|glassfish|javax.enterprise.system.core|_ThreadID=29;_ThreadName=Thread-3;|service exception java.lang.IllegalStateException: No Rails Instances available to satisfy the current request at com.sun.grizzly.jruby.RailsAdapter.service(RailsAdapter.java:272) at com.sun.grizzly.tcp.http11.GrizzlyAdapter.service(GrizzlyAdapter.java:147) at org.glassfish.scripting.rails.RailsApplication.service(RailsApplication.java:165) at com.sun.enterprise.v3.server.HK2Dispatcher.dispath(HK2Dispatcher.java:100) at com.sun.enterprise.v3.services.impl.VsAdapter.service(VsAdapter.java:136) at com.sun.enterprise.v3.services.impl.VirtualHostMapper.service(VirtualHostMapper.java:121) at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:180) at com.sun.grizzly.http.DefaultProcessorTask.invokeAdapter(DefaultProcessorTask.java:633) at com.sun.grizzly.http.DefaultProcessorTask.doProcess(DefaultProcessorTask.java:570) at com.sun.grizzly.http.DefaultProcessorTask.process(DefaultProcessorTask.java:827) at com.sun.grizzly.http.DefaultProtocolFilter.execute(DefaultProtocolFilter.java:152) at com.sun.enterprise.v3.services.impl.GlassfishProtocolChain.executeProtocolFilter(GlassfishProtocolChain.java:71) at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:103) at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:89) at com.sun.grizzly.http.HttpProtocolChain.execute(HttpProtocolChain.java:76) at com.sun.grizzly.ProtocolChainContextTask.doCall(ProtocolChainContextTask.java:67) at com.sun.grizzly.SelectionKeyContextTask.call(SelectionKeyContextTask.java:56) at com.sun.grizzly.util.WorkerThreadImpl.processTask(WorkerThreadImpl.java:325) at com.sun.grizzly.util.WorkerThreadImpl.run(WorkerThreadImpl.java:184) |#] Do you have any idea what might be the issue? Thanks!

Firstly, I'd like to thank you for your great tutorial. Everything was very simple to get started! However, when I attempted to deploy a second application to the Glassfish v3 server, using the applications led to unexplained routing errors. I made sure to use all the same software versions as you, to make sure my applications were created with the same version of Rails/JRuby, etc. I was just curious if you had any experience with deploying multiple applications to a single instance of Glassfish, or any ideas as to what the problem might be. Thanks!

This is a known problem as described at: https://glassfish.dev.java.net/issues/show_bug.cgi?id=5046 Please follow the workaround mentioned in the bug report.