Typo on GlassFish v3 - Ruby-on-Rails Blogging Engine
By arungupta on Aug 27, 2008
|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 application from Sang "Passion" Shin's Lab 5543 (part of FREE 20-week course on Ruby-on-Rails started on Jul 15, 2008). But instead of using standard WEBrick/Mongrel deployment, I describe the steps to deploy this application using GlassFish v3 that supports native deployment of Rails applications.
- Typo can be installed as Gem
Sources. Installing as gem
gives the following error:
JRuby limited openssl loaded. gem install jruby-openssl for full support.
Building native extensions. This could take a while...
/Users/arungupta/tools/rails20/jruby-1.1.3/lib/ruby/1.8/mkmf.rb:7: JRuby does not support native extensions. Check wiki.jruby.org for alternatives. (NotImplementedError)
from /Users/arungupta/tools/rails20/jruby-1.1.3/lib/ruby/1.8/mkmf.rb:1:in `require'
ERROR: Error installing typo:
ERROR: Failed to build gem native extension.
/Users/arungupta/tools/rails20/jruby-1.1.3/bin/jruby extconf.rb install typo
Gem files will remain installed in /Users/arungupta/tools/rails20/jruby-1.1.3/lib/ruby/gems/1.8/gems/mysql-2.7 for inspection.
Results logged to /Users/arungupta/tools/rails20/jruby-1.1.3/lib/ruby/gems/1.8/gems/mysql-2.7/gem_make.out
This is discussed here. In the meanwhile, download and unzip Typo 5.1.2 as:
~/samples/jruby >unzip ~/Downloads/typo-5.1.2.zip
. . .
- Create the database:
~/samples/jruby >sudo mysqladmin create typo_dev
Typo 5.1.x works with Rails 2.0.x only and so migrate as shown below:
~/samples/jruby/typo-5.1.2 >~/tools/rails20/jruby-1.1.3/bin/jruby -S rake db:migrate
== 1 InitialSchema: migrating =================================================
-- add_index(:articles, :permalink)
. . .
== 69 AddModulesToProfile: migrating ==========================================
-- add_column(:profiles, :modules, :text)
== 69 AddModulesToProfile: migrated (0.0454s) =================================
== 70 AddUsersToNonAdmins: migrating ==========================================
== 70 AddUsersToNonAdmins: migrated (0.0488s) =================================
- Download GlassFish (nightly,
and install by unzipping. I tried the nightly of 8/24
~/tools/glassfish/v3/8-24 >unzip ~/Downloads/glassfish-snapshot-v3-prelude-08_24_2008.zip
. . .
- Start GlassFish as:
~/tools/glassfish/v3/8-24/glassfish >java -DJRUBY_HOME=/Users/arungupta/tools/rails20/jruby-1.1.3 -jar modules/glassfish-10.0-SNAPSHOT.jar
Aug 26, 2008 5:56:10 PM com.sun.enterprise.glassfish.bootstrap.ASMain main
INFO: Launching GlassFish on Apache Felix OSGi platform
Welcome to Felix.
Aug 26, 2008 5:56:11 PM HK2Main start
INFO: contextRootDir = /Users/arungupta/tools/glassfish/v3/8-24/glassfish/modules
Aug 26, 2008 5:56:11 PM OSGiFactoryImpl initialize
. . .
INFO: APIClassLoader = Class Loader for Bundle [GlassFish-Application-Common-Module  ]
Aug 26, 2008 5:56:13 PM CommonClassLoaderManager Skipping creation of CommonClassLoader as there are no libraries available
INFO: urls = 
Aug 26, 2008 5:56:13 PM com.sun.enterprise.v3.server.AppServerStartup run
INFO: Glassfish v3 started in 2176 ms
- And deploy Typo as:
~/samples/jruby >~/tools/glassfish/v3/8-24/glassfish/bin/asadmin deploy typo-5.1.2
Command deploy executed successfully.
Typo 5.2 (scheduled in 3 days) will work with Rails 2.1.
Also check out Redmine, Substruct and Mephisto on GlassFish v3. There are some performance issues when running Typo on GlassFish and this is tracked at Issue #5662.
If your Rails application does not work on the gem, file bugs here with "jruby" as "subcomponent" (default version is "v3").
Technorati: rubyonrails glassfish v3 jruby ruby typo blogging