Wednesday, August 26, 2009

Redmine 0.8.4 Deployment on GlassFish 2.1 using JRuby 1.3.1

Introduction

In this tutorial I will explain how to install Redmine 0.8.4 on GlassFish 2.1 using JRuby 1.3.1 with MySQL.

Required Software

  • Redmine 0.8.4

  • GlassFish 2.1

  • NetBeans 6.7

  • MySQL 5.1

Instructions


  1. First we will need to download and install JRuby 1.3.1. The binaries can be found on the Kenai site.

  2. Make sure that your PATH is set to point to your JRuby installation. You can check your install by typing jruby -v at the command prompt. You should see something similar to the listing below.
    dev:~ jyeary$ jruby -v
    jruby 1.3.1 (ruby 1.8.6p287) (2009-06-15 2fd6c3d) (Java HotSpot(TM) 64-Bit Server VM 1.6.0_15) [x86_64-java]

  3. Run from the command line
    jruby -S gem update
    This will update all of the gems required to run our application.

  4. Run from the command line
    jruby -S gem install jruby-openssl rails mongrel jdbc-mysql activerecord-jdbcmysql-adapter warbler
    This will install all of the gems required to run our application.

  5. Download a copy of Redmine 0.8.4 and unzip it.

  6. Using NetBeans 6.7.1, check the Tools --> Ruby Platform Manager to make sure that you install the JRuby 1.3.1 platform.



  7. In NetBeans, create a new Ruby on Rails Application with Existing Sources. Next



  8. Select the unzipped RoR Redmine application as the project folder.

  9. Select the JRuby 1.3.1 Platform from the combo-box menu.

  10. Select Mongrel for the server from the combo-box menu. Click Finish. NetBeans will create the RoR project and install Warbler which will create our war file for deployment on GlassFish.



  11. We are now ready to configure the application. Follow the instructions for configuring the application here.

  12. In the redmine-0.8.4 directory run the following command
    jruby -S warble config
    This will create the configuration file for warbler to build our war file for deployment on GlassFish.

  13. Edit the warble.rb file and modify the config.dirs line to the following:
    config.dirs = %w(app config lib log vendor tmp files lang)
    This will make sure that we deploy all of the application relevant files in our war file.

  14. Edit the warble.rb file and add the following line:
    config.gems = ["activerecord-jdbcmysql-adapter"]
    This will make sure that when we convert the application to a war file that the appropriate ActiveRecord JDBC drivers for MySQL are added to it.

  15. Run the application to make sure that it runs correctly on Mongrel.

  16. Run the following commands to create the war file
    jruby -S rake war:clean
    jruby -S rake war



  17. Go to the Administrative Console on GlassFish. Select Web Applications and deploy the new redmine-0.8.4.war file.




Popular Posts