Skip to main content

Typo on GlassFish v3 - Ruby-on-Rails Blogging Engine

Posted by arungupta on August 28, 2008 at 5:47 AM PDT


cellspacing="5">
style="border: 0px solid ;" alt=""
src="http://blogs.sun.com/arungupta/resource/ror/typologo.gif">
href="http://typosphere.org/">

Typo
is an open-source Blogging Engine written using href="http://rubyonrails.org/">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 href="http://javapassion.com/">Sang "Passion" Shin's
Lab
5543
(part of href="http://blogs.sun.com/arungupta/entry/free_20_week_ruby_on">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 href="http://glassfish.org/v3">GlassFish
v3 that supports native deployment of Rails
applications. 

  1. Typo can be installed as href="http://typosphere.org/wiki/typo/Install_Typo_with_Typo_installer">Gem
    or href="http://typosphere.org/wiki/typo/Install_Typo_from_sources">from
    Sources. Installing as gem
    gives the following error:


    style="text-align: left; width: 100%; font-family: monospace;"
    cellpadding="2" cellspacing="2">
    JRuby
    limited openssl loaded. gem install jruby-openssl for full support.

    http://wiki.jruby.org/wiki/JRuby_Builtin_OpenSSL

    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'

           
    from extconf.rb:1

    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 href="http://www.ruby-forum.com/topic/163945#719796">here.
    In the meanwhile, download and unzip href="http://rubyforge.org/frs/download.php/40368/typo-5.1.2.zip">Typo
    5.1.2 as:


    style="text-align: left; width: 100%; font-family: monospace;"
    cellpadding="2" cellspacing="2">
    ~/samples/jruby
    >unzip
    ~/Downloads/typo-5.1.2.zip


    Archive:  /Users/arungupta/Downloads/typo-5.1.2.zip

       creating: typo-5.1.2/

       creating: typo-5.1.2/app/

       creating: typo-5.1.2/app/apis/

       . . .

      inflating:
    typo-5.1.2/vendor/uuidtools/lib/uuidtools.rb 

      inflating: typo-5.1.2/vendor/uuidtools/rakefile 

      inflating: typo-5.1.2/vendor/uuidtools/README
  2. Create the database:


    cellpadding="2" cellspacing="2">
    ~/samples/jruby
    >sudo mysqladmin
    create typo_dev



    Typo 5.1.x works with Rails 2.0.x only and so migrate as shown below:


    style="text-align: left; width: 100%; font-family: monospace;"
    cellpadding="2" cellspacing="2">
    ~/samples/jruby/typo-5.1.2
    >~/tools/rails20/jruby-1.1.3/bin/jruby
    -S rake db:migrate


    (in /Users/arungupta/samples/jruby/typo-5.1.2)

    == 1 InitialSchema: migrating
    =================================================

    -- create_table(:users)

       -> 0.0377s

    -- create_table(:articles)

       -> 0.0189s

    -- add_index(:articles, :permalink)

       -> 0.0094s

    -- create_table(:categories)

       -> 0.0069s



     . . .



    == 69 AddModulesToProfile: migrating
    ==========================================

    -- add_column(:profiles, :modules, :text)

       -> 0.0072s

    == 69 AddModulesToProfile: migrated (0.0454s)
    =================================



    == 70 AddUsersToNonAdmins: migrating
    ==========================================

    == 70 AddUsersToNonAdmins: migrated (0.0488s)
    =================================


  3. Typo 5.2 (scheduled in 3 days) will work with Rails 2.1.

  4. Download GlassFish ( href="http://download.java.net/glassfish/v3/nightly/">nightly,
    promoted
    or href="http://blogs.sun.com/arungupta/entry/totd_33_building_glassfish_v3">build-your-own)
    and install by unzipping. I tried the nightly of href="http://download.java.net/glassfish/v3/nightly/glassfish-snapshot-v3-prelude-08_24_2008.zip">8/24
    as:


    cellpadding="2" cellspacing="2">
    ~/tools/glassfish/v3/8-24
    >unzip
    ~/Downloads/glassfish-snapshot-v3-prelude-08_24_2008.zip


    Archive: 
    /Users/arungupta/Downloads/glassfish-snapshot-v3-prelude-08_24_2008.zip

       creating: glassfish/

       creating: glassfish/docs/

       creating: glassfish/docs/css/

       creating: glassfish/docs/graphics/

    . . .

      inflating: glassfish/lib/templates/login.conf 

      inflating:
    glassfish/lib/templates/profile.properties 

      inflating: glassfish/lib/templates/server.policy
  5. Start GlassFish as:


    cellpadding="2" cellspacing="2">
    ~/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 [66] ]

    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
  6. And deploy Typo as:


    style="text-align: left; background-color: rgb(204, 204, 255); width: 100%;"
    cellpadding="2" cellspacing="2">
    ~/samples/jruby > style="font-weight: bold;">~/tools/glassfish/v3/8-24/glassfish/bin/asadmin
    deploy typo-5.1.2



    Command deploy executed successfully.

The application is available at "http://localhost:8080/typo-5.1.2" and
some of the screenshots follow:





style="width: 443px; height: 634px;" alt=""
src="http://blogs.sun.com/arungupta/resource/ror/typo512-account-signup.png">



src="http://blogs.sun.com/arungupta/resource/ror/typo512-settings-general-default.png">



src="http://blogs.sun.com/arungupta/resource/ror/typo512-settings-general-milestogo.png">



src="http://blogs.sun.com/arungupta/resource/ror/typo512-settings-write.png">



src="http://blogs.sun.com/arungupta/resource/ror/typo512-new-content.png">



src="http://blogs.sun.com/arungupta/resource/ror/typo512-manage-posts.png">



src="http://blogs.sun.com/arungupta/resource/ror/typo512-your-blog-page.png">





Also check out href="http://blogs.sun.com/arungupta/entry/redmine_on_glassfish_ruby_on">Redmine,
href="http://blogs.sun.com/arungupta/entry/substruct_on_glassfish_v3_ruby">Substruct
and href="http://blogs.sun.com/arungupta/entry/mephisto_on_glassfish_v3">Mephisto
on GlassFish v3. There are some performance issues when running Typo on
GlassFish and this is tracked at href="https://glassfish.dev.java.net/issues/show_bug.cgi?id=5662">Issue
#5662.



If your Rails application does not work on the gem, href="https://glassfish.dev.java.net/issues/enter_bug.cgi?issue_type=DEFECT">file
bugs here with "jruby" as "subcomponent" (default version is
"v3").



Technorati: href="http://technorati.com/tag/rubyonrails">rubyonrails
glassfish
v3 href="http://technorati.com/tag/jruby">jruby href="http://technorati.com/tag/ruby">ruby href="http://technorati.com/tag/typo">typo href="http://technorati.com/tag/blogging">blogging

Related Topics >>