Posted by
arungupta on June 30, 2008 at 11:03 AM PDT
 |
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.
- 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 |
- 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 |
- 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. |
- 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 |
- 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