Substruct on GlassFish v3 - Ruby-on-Rails E-Commerce Application


Substruct is an open-source E-Commerce project written using Ruby-on-Rails framework. It provides a simple e-commerce platform, content management system and customer response system - all in one.


I found out about this application from Sang "Passion" Shin's Lab 5542 (part of FREE 20-week course on Ruby-on-Rails starting on Jul 15, 2008). But instead of using standard WEBrick/Mongrel deployment, I describe the steps to deploy this application using GlassFish v3 Gem. The GlassFish Gem installation is described here.
  1. Download and install Substruct

    ~/samples/jruby >gunzip -c substruct_rel_1-0-a3.tar.gz  | tar xvf -
    substruct_rel_1-0-a3/
    substruct_rel_1-0-a3/app/
    substruct_rel_1-0-a3/app/controllers/
    substruct_rel_1-0-a3/app/controllers/application.rb
    . . .
    substruct_rel_1-0-a3/vendor/rails/railties/test/rails_info_test.rb
    substruct_rel_1-0-a3/vendor/rails/railties/test/secret_key_generation_test.rb
    substruct_rel_1-0-a3/vendor/rails/Rakefile
    substruct_rel_1-0-a3/vendor/rails/release.rb
  2. Install the required gems for Substruct

    ~/samples/jruby >~/testbed/jruby-1.1.2/bin/jruby -S gem install RedCloth fastercsv mime-types mini_magick ezcrypto jruby-openssl --no-ri --no-rdoc
    JRuby limited openssl loaded. gem install jruby-openssl for full support.
    http://wiki.jruby.org/wiki/JRuby_Builtin_OpenSSL
    Bulk updating Gem source index for: http://gems.rubyforge.org/
    Successfully installed RedCloth-3.0.4
    Successfully installed fastercsv-1.2.3
    Successfully installed mime-types-1.15
    Successfully installed rubyforge-1.0.0
    Successfully installed hoe-1.5.3
    Successfully installed mini_magick-1.2.3
    Successfully installed ezcrypto-0.7
    Successfully installed jruby-openssl-0.2.3
    8 gems installed
  3. Create the database

    ~/samples/jruby/substruct_rel_1-0-a3 >~/testbed/jruby-1.1.2/bin/jruby -S rake db:create
    (in /Users/arungupta/samples/jruby/substruct_rel_1-0-a3)
    [SUBSTRUCT WARNING]
    Mail server settings have not been initialized.
    Check to make sure they've been set in the admin panel.
  4. And bootstrap it as

    ~/samples/jruby/substruct_rel_1-0-a3 >~/tesbted/jruby-1.1.2/bin/jruby -S rake substruct:db:bootstrap
    (in /Users/arungupta/samples/jruby/substruct_rel_1-0-a3)
    Checking requirements...
    Initializing database...
    [SUBSTRUCT WARNING]
    Mail server settings have not been initialized.
    Check to make sure they've been set in the admin panel.
    -- create_table("content_nodes", {:force=>true})
       -> 0.3020s
    -- add_index("content_nodes", ["name"], {:name=>"name"})
       -> 0.0140s
    -- add_index("content_nodes", ["type", "id"], {:name=>"type"})
    . . .
    -- initialize_schema_information()
       -> 0.0200s
    -- columns("schema_info")
       -> 0.0650s
    Clearing previous data...
    Removing all sessions...
    Loading default data...
    ...done.
    ================================================================================

    Thanks for trying Substruct 1.0.a3

    Now you can start the application with 'script/server'
    visit: http://localhost:3000/admin, and log in with admin / admin.

    For help, visit the following:
      Official Substruct Sites
        - http://substruct.subimage.com
        - http://code.google.com/p/substruct/
      Substruct Google Group - http://groups.google.com/group/substruct

    - Subimage LLC - http://www.subimage.com
  5. And finally run it on the GlassFish as:

    ~/samples/jruby >~/testbed/jruby-1.1.2/bin/jruby -S glassfish_rails substruct_rel_1-0-a3
    May 28, 2008 1:47:46 PM com.sun.enterprise.glassfish.bootstrap.ASMain main
    INFO: Launching GlassFish on HK2 platform
    May 28, 2008 1:47:46 PM com.sun.enterprise.glassfish.bootstrap.ASMainHK2 findDerbyClient
    INFO: Cannot find javadb client jar file, jdbc driver not available
    May 28, 2008 1:47:47 PM com.sun.enterprise.v3.services.impl.GrizzlyProxy start
    INFO: Listening on port 3000
    May 28, 2008 1:47:47 PM com.sun.enterprise.v3.services.impl.GrizzlyEmbeddedHttpConfigurator configureSSL
    WARNING: pewebcontainer.all_ssl_protocols_disabled
    May 28, 2008 1:47:47 PM com.sun.enterprise.v3.services.impl.GrizzlyEmbeddedHttpConfigurator configureSSL
    WARNING: pewebcontainer.all_ssl_ciphers_disabled
    May 28, 2008 1:47:47 PM com.sun.enterprise.v3.services.impl.GrizzlyProxy start
    INFO: Listening on port 3131
    May 28, 2008 1:47:47 PM com.sun.enterprise.v3.services.impl.GrizzlyProxy start
    INFO: Listening on port 3838
    May 28, 2008 1:47:48 PM com.sun.enterprise.v3.admin.adapter.AdminConsoleAdapter setContextRoot
    INFO: Admin Console Adapter: context root: /admin
    May 28, 2008 1:47:48 PM com.sun.enterprise.rails.RailsDeployer registerAdapter
    INFO: Loading application substruct_rel_1-0-a3 at /
    May 28, 2008 1:47:48 PM 
    INFO: Starting Rails instances
    May 28, 2008 1:47:56 PM com.sun.grizzly.jruby.RubyObjectPool$1 run
    INFO: Rails instance instantiation took : 8800ms
    May 28, 2008 1:47:56 PM com.sun.enterprise.v3.server.AppServerStartup run
    INFO: Glassfish v3 started in 10403 ms

The welcome screenshot looks like



Now copy GlassFish logo image file to "public/images" directory of your application and add the following line to "app/views/layouts/main.rhtml" file (on line 36):

<a href="http://glassfish.org"><%= image_tag('/images/glassfish-logo.gif', :alt => 'GlassFish') %></a>

The modified view looks like as shown below:



The updated output looks like:



I tried only the basic deployment and that seem to work. If you try slightly more advanced usecases then the functionality provided by RedCloth, fastercsv, mime-types, mini_magick and ezcrypto gems can be exercised as well. If you are running Substruct, try it and let us know.

If your Rails application does not work on the gem, file bugs here with "jruby" as "subcomponent" (default version is "v3").

Also check out Redmine on GlassFish v3.

Technorati: rubyonrails glassfish netbeans substruct webtier
Comments:

[Trackback] Typo is an open-source Blogging Engine written using Ruby-on-Rails framework. It provides a lean engine that makes blogging easy. It's main attribtues are ease of use, usability, beauty and excellent support of web standards. I found out about this...

Posted by Arun Gupta's Blog on August 27, 2008 at 10:50 PM PDT #

[Trackback] Typo is an open-source Blogging Engine written using Ruby-on-Rails framework. It provides a lean engine that makes blogging easy. It's main attribtues are ease of use, usability, beauty and excellent support of web standards. I found out about this...

Posted by Arun Gupta's Blog on August 27, 2008 at 10:57 PM PDT #

[Trackback] Last day of Rails Conf Europe 2008 (Day 1 &amp; Day 2), and it's finally over! David Black's opening session talked about Ruby and Rails Symposium: Versions, Implementations, and the Future. Here is a brief summary of MRI Ruby...

Posted by Arun Gupta's Blog on September 05, 2008 at 03:19 PM PDT #

[Trackback] GlassFish v3 Prelude is now available. It allows&nbsp;Rails applications to be deployed natively using JRuby and without the need of any WAR packaging or Servlet container. An integrated NetBeans tooling provides a comprehensive development and deploy...

Posted by Arun Gupta's Blog on November 06, 2008 at 09:52 PM PST #

[Trackback] GlassFish Gem 0.9.0 was recently released. It can run any Rack-compatible framework such as Rails and Merb. Support for another Rack-based framework&nbsp;Sinatra will be released in the near future. The gem is even extensible and allows to plug any of...

Posted by Arun Gupta's Blog on November 14, 2008 at 01:36 AM PST #

Post a Comment:
Comments are closed for this entry.
About

profile image
Arun Gupta is a technology enthusiast, a passionate runner, author, and a community guy who works for Oracle Corp.


Java EE 7 Samples

Stay Connected

Search

Archives
« April 2014
SunMonTueWedThuFriSat
  
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
   
       
Today