Miles to go ...

Arun Gupta is a Technology Evangelist for Web Services and Web 2.0 Apps at Sun. He was the spec lead for APIs in the Java platform, committer in multiple Open Source projects, participated in standard bodies and contributed to Java EE and SE releases.
Main | Next page »

http://blogs.sun.com/arungupta/date/20080927 Saturday September 27, 2008

LOTD #9: Advantages of JRuby over MRI


Andreas blogged about why he likes JRuby even though he dislikes Java.

JRuby is "It's just Ruby" with more than 50,000 tests to ensure MRI compliance. The blog highlights that there is no need to know Java, at all, to run JRuby. Here are some advantages that are described in the blog:

  1. JVM runtime optimization
  2. Efficient memory usage
  3. Native threads to spread work on multiple cores
  4. Great garbage collection to make memory usage more efficient
  5. JIT and AOT compilation
  6. Inegration with Java libraries
  7. Running Rails applications on existing Java application servers
  8. Documentation and specs
Read more details here.

Do you know Rails applications can be deployed (without any packaging) on GlassFish v3 ? Check out more details here.

Technorati: lotd jruby ruby rubyonrails glassfish

del.icio.us | furl | simpy | slashdot | technorati | digg

http://blogs.sun.com/arungupta/date/20080923 Tuesday September 23, 2008

LOTD #9: Slides for Deploying and Monitoring Ruby on Rails Tutorial @ Rails Conf Europe 2008


During Rails Conf Europe 2008 Day 1 I attended an excellent tutorial on Deploying and Monitoring Ruby on Rails. The session very clearly explained the several deployment options with Rails. My notes from the session are here and the slides are now available

Here are couple of snapshots from the slide:





The complete set of slides from Rails Conf Europe 2008 are available here.

Technorati: conf railsconf glassfish deployment rubyonrails berlin

del.icio.us | furl | simpy | slashdot | technorati | digg

http://blogs.sun.com/arungupta/date/20080911 Thursday September 11, 2008

Kenai - High Throughput and Scalable Rails on GlassFish



Kenai (pronounced 'keen-eye') is a fictional character from Disney's Brother Bear series. It's also a river, mountain range, national park, peninsula and a city in the southern coast of Alaska in the United States. But that's got nothing to do (as much as I know) with either Rails or GlassFish.




But Project Kenai was announced last week. It's a developer hub with SCM, issue tracking, forums and similar stuff you need for hosting your open source projects. And it is a Rails application deployed on GlassFish v2. 

Read all about it in an interview with the lead developer Nick Sieger. Fernando gave a great overview (slides here), with excellent tuning tips for Rails on GlassFish, in Rails Conf Europe last week.

Other Rails on GlassFish success stories are described here.

And if you want, enjoy this beautiful video of Kenai National Wildlife Refuge.



Technorati: rubyonrails jruby ruby glassfish stories kenai

del.icio.us | furl | simpy | slashdot | technorati | digg

http://blogs.sun.com/arungupta/date/20080908 Monday September 08, 2008

TOTD #44: JDBC Connection Pooling for Rails on GlassFish v3


TOTD #9 explained how to configure JDBC connection pooling for Rails application deployed on GlassFish v2. There are several benefits of using using the JDBC connection pools:

  • No need to create a new database connection for each Rails instance.
  • No need to specify your password in database.yml or create a hack to hide it.
  • No garbage collection of connection after each use.
And because of the above mentioned (and other reasons) an improved application performance, scalability and efficiency.
The only way to deploy a Rails application on GlassFish v2 is to create a WAR file using Warbler. That's a great option and is already used in production mode. GlassFish v3 takes that to the next level by allowing to deploy a Rails application without any further pacakging. This TOTD (Tip Of The Day explains how to achieve database connection pooling using GlassFish v3.
  1. Lets create a simple scaffold

    ~/samples/jruby >~/tools/jruby-1.1.3/bin/jruby -S rails jndi_rails2 -d mysql
    ~/samples/jruby/jndi_rails2 >~/tools/jruby-1.1.3/bin/jruby script/generate scaffold runner miles:float minutes:integer
    ~/samples/jruby/jndi_rails2 >~/tools/jruby-1.1.3/bin/jruby -S rake db:create
    ~/samples/jruby/jndi_rails2 >~/tools/jruby-1.1.3/bin/jruby -S rake db:migrate
  2. Install MySQL ActiveRecord JDBC adapter

    ~/samples/jruby/jndi_rails2 >~/tools/jruby-1.1.3/bin/jruby -S gem install activerecord-jdbcmysql-adapter
  3. Copy MySQL Connector/J jar to JAVA_HOME/lib/ext

    ~/samples/jruby/jndi_rails2 >sudo cp ~/tools/mysql-connector-java-5.1.6/mysql-connector-java-5.1.6-bin.jar /System/Library/Frameworks/JavaVM.framework/Versions/1.6/Home/lib/ext
  4. Start GlassFish v3 server as ...

    ~/tools/glassfish/v3/b23/glassfishv3-prelude/glassfish >java -Xmx512m -DJRUBY_HOME=/Users/arungupta/tools/jruby-1.1.3 -jar modules/glassfish-10.0-SNAPSHOT.jar
  5. Setup JDBC connection pool
    1. Create JDBC connection pool

      ~/samples/jruby/jndi_rails2 >~/tools/glassfish/v3/b23/glassfishv3-prelude/glassfish/bin/asadmin create-jdbc-connection-pool --datasourceclassname com.mysql.jdbc.jdbc2.optional.MysqlConnectionPoolDataSource --restype javax.sql.DataSource --property "User=duke:Password=duke:URL=jdbc\:mysql\://localhost/jndi_rails2_production" jdbc/jndi_rails2_pool 
    2. Create JDBC resource

      ~/samples/jruby/jndi_rails2 >~/tools/glassfish/v3/b23/glassfishv3-prelude/glassfish/bin/asadmin create-jdbc-resource --connectionpoolid jdbc/jndi_rails2_pool jdbc/jndi_rails2 
    3. Ping JDBC pool

      ~/samples/jruby >~/tools/glassfish/v3/b23/glassfishv3-prelude/glassfish/bin/asadmin ping-connection-pool jdbc/jndi_rails2_pool 
  6. Change the development database in config/database.yml to:

    development:
      adapter: jdbc
      jndi: jdbc/jndi_rails2
      driver: com.mysql.jdbc.Driver 
  7. Run your app as

    ~/samples/jruby >~/tools/glassfish/v3/b22/glassfishv3-prelude/glassfish/bin/asadmin deploy jndi_rails2
And chug along with your scaffold at http://localhost:8080/jndi_rails2/runners.

Technorati: totd rubyonrails jruby ruby glassfish v3 connectionpooling jndi jdbc mysql

del.icio.us | furl | simpy | slashdot | technorati | digg

http://blogs.sun.com/arungupta/date/20080901 Monday September 01, 2008

Rails Conf Europe 2008 and Bratwurst-on-Rails

I arrived Berlin yesterday on a non-adventurous United flight from San Francisco, just the way I like it! The flight from Frankfurt was delayed 30 minutes but that's normal these days :)

The venue of RailsConf Europe 2008 is same as last year so street names/geography are somewhat familiar. But the conference hotel was sold out so am instead staying across the street. Visited Brandenburger Tor for a short duration after checking into the hotel. Also stopped by the Peugeot showroom on Unter den Linden and saw popular bear figurines in a side street. The evening ended with a social gathering celebrating the popular German culture of Bratwurst-on-Rails.

It's always exciting to meet my blog readers, thank you! Let me know if I'm missing any of your expectations.

The tutorial starts today and the conference starts tomorrow. If you are in Berlin, don't forget to attend the joint JUG and TU-Berlin talk. And my talk on "Rails powered by GlassFish" is scheduled on Thursday, Sep 4 @ 1:40pm.

The evening really eneded with a 40 minutes run and dinner in room service. The Jolly Hotel is really nice, newer rooms, courteous staff, delicious and very neatly prepared Club Chicken sandwich and prompt room service, definitely a good recommendation. However the fitness center is minimal with one ultra-loud treadmill and 3 other basic machines. The hotel staff informed that they are working on furnishing the fitness center (known as Wellness Center here). And there is only one American channel which is only talking about Storm Gustav and Republican National Convetion, Juno of Juneau since my arrival  :(

Anyway, enjoy the pictures so far!


And the complete album:


Technorati: conf railsconf berlin glassfish netbeans rubyonrails

del.icio.us | furl | simpy | slashdot | technorati | digg

http://blogs.sun.com/arungupta/date/20080829 Friday August 29, 2008

FREE Ticket to Rails Conf Europe 2008

Are you a Start up company interested in jump starting and meets the following criteria ?

  • In business six years or less
  • A maximum of 150 employees, including any affiliates
  • Based in a country in which the program is offered
  • A verifiable company presence (website, company profile, etc.)
  • Agree to accept the program's terms and conditions

Sun Startup Essentials program provided discounted hardware, partner hosting & storage, FREE support & Training, even connects with over 200 investors and much more. What are you waiting for ? Apply Today!

We'll throw in a FREE ticket to Rails Conf Europe 2008 - FREE as in FREE beer :) Read more details here.

And then if you are using GlassFish for Rails deployment, then I can give you a FREE 30-second promo in my talk.

And if you are in Berlin, then you might as well attend Berlin JUG event - which is also FREE.

And if you are using GlassFish in your startup, then we even provide FREE cloud computing - partnering with Layered Technologies!

Read more about Sun @ Rails Conf Europe 2008.

See you there!

Technorati: conf glassfish netbeans railsconf rubyonrails berlin startupessentials sun

del.icio.us | furl | simpy | slashdot | technorati | digg

http://blogs.sun.com/arungupta/date/20080828 Thursday August 28, 2008

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



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. 
  1. Typo can be installed as Gem or from Sources. Installing as gem gives the following error:

    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 here. In the meanwhile, download and unzip Typo 5.1.2 as:

    ~/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:

    ~/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
    (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 (nightly, promoted or build-your-own) and install by unzipping. I tried the nightly of 8/24 as:

    ~/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:

    ~/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:

    ~/samples/jruby >~/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:

















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

del.icio.us | furl | simpy | slashdot | technorati | digg

http://blogs.sun.com/arungupta/date/20080827 Wednesday August 27, 2008

Interested in a 30 second promotion in Rails Conf Europe 2008 ?

RailsConf Europe 2008 Are you deploying Rails application on GlassFish  in any manner (WAR-based, Gem or Technology Preview 2) ?
Are you using Rails and GlassFish combination in a creative way ?
Having you been following Rails/GlassFish development/deployment options and have an opinion ?

If answer to any of the above questions is yes, then drop a comment on this blog or send me an email (arun dot gupta at sun dot com). I'll be happy to give you a 30-second promotion (at my discretion ;-) in my Rails Conf Europe talk next week. Here is the information I'm looking for:

Title:
Public URL:
Brief Description:
Credits (icon/logo if possible):

And if you are not aware of any of the options mentioned above, then Rails powered by the GlassFish Application Server provides all the details for you to get started!

Technorati: conf railsconf glassfish rubyonrails

del.icio.us | furl | simpy | slashdot | technorati | digg

http://blogs.sun.com/arungupta/date/20080826 Tuesday August 26, 2008

LOTD #6: Rails Deployment on GlassFish in 4 steps and 15 minutes

Charlie describes, in 4 easy steps, how to deploy any Rails application on GlassFish:



The main steps are:

Step 1: The App Server
Step 2: Package your App
Step 3: Deploy your application
Step 4: Tweaking (Optional)

And it should only take 15 minutes on GlassFish v2!

The conclusion of the blog is:

Hopefully this walkthrough clears up some confusion around JRuby on Rails deployment to an app server. It's really a simple process, despite the not-so-simple history surrounding Enterprise Application Servers, and GlassFish almost makes it fun :)

The next version, GlassFish v3, allows Rails application to be deployed natively, i.e. no packaging is required. You create a Rails application and run it - just the way you are used to! Read all about it here.

All previous entries in this series are archived at LOTD.

Technorati: lotd rubyonrails jruby ruby glassfish

del.icio.us | furl | simpy | slashdot | technorati | digg

http://blogs.sun.com/arungupta/date/20080822 Friday August 22, 2008

GlassFish @ Berlin-Brandenburg JUG and TU Berlin


I'll be providing an overview of GlassFish - engineering update on v2 and v3, adoption & success stories, and the vibrant community around it at a joint Berlin-Brandenburg JUG and TU-Berlin meet on Sep 3, 2008.

The coordinates are:

Wednesday, September 3rd
17:30-ca. 19:30
Room FR5516, Technical University of Berlin
Franklinstrasse 28/29
10587 Berlin

The directions are available and please register here.

Thanks to Daniel Freund (Sun's Campus Ambassador in Berlin) & Ralph Bergman for coordinating this! And many thanks to ever-energetic and highly-connected Aaron Houston (JUG Program Coordinator) for initiating the link :)

And of course, I'll also be speaking at Rails Conf Europe 2008 on Rails Powered by GlassFish.

Anybody knows good running trails around Jolly Hotel ?

UPDATE: The venue has changed to a different room. The new room now is FR3003 in the same building.

Technorati: conf glassfish netbeans railsconf rubyonrails jug berlin tuberlin

del.icio.us | furl | simpy | slashdot | technorati | digg

http://blogs.sun.com/arungupta/date/20080821 Thursday August 21, 2008

LOTD #4: Rails running on GlassFish @ LinkedIn


Light Engineering team (BumperSticker fame) at LinkedIn has chosen GlassFish for running their Rails application. One of the developers on the team reports:

Using Warbler, we successfully wrapped our Rails applications into WAR files and deployed on Glassfish (we’ll probably write a more detailed tutorial of this at a future date). A WAR file is completely self contained application that can be deployed simply by copying to an autodeploy directory. No more Apache/Nginx reverse proxy, no more Capistrano, no more installing gems on a production container, no more of any of that madness. This was a huge win, and we broke out the champagne bottles.

Read the complete entry at:

JDBC Connection Pooling for Rails on GlassFish

Stay tuned for more details!

NetBeans development and GlassFish deployment already provide an ideal environment for Rails deployment. You can read about successful deployments of Rails and GlassFish here.

All previous entries in this series are archived at LOTD.

Technorati: lotd rubyonrails jruby ruby netbeans glassfish stories

del.icio.us | furl | simpy | slashdot | technorati | digg

http://blogs.sun.com/arungupta/date/20080819 Tuesday August 19, 2008

Welcome Jacob to blogsphere!

Jacob Kessler is a new hire in GlassFish Scripting team and is blogging, welcome Jacob!

Read how he will apply Aritificial Intelligence prinicples for dynamic configuration of JRuby runtime pools in GlassFish :)

Technorati: glassfish rubyonrails dynamiclanguages

del.icio.us | furl | simpy | slashdot | technorati | digg

LOTD #3: Rails 2.2 going multi-threaded


Rails 2.2 is slated to become multi-threaded. What does it mean for JRuby users ? Charles Nutter explains it:

Q/A: What Thread-Safe Rails Means

One of the key points from the blog is:

Rails deployments on JRuby will use 1/Nth the amount of memory they use now, where N is the number of thread-unsafe Rails instances currently required to handle concurrent requests. Even compared to green-threaded implementations running thread-safe Rails, it willl likely use 1/Mth the memory where M is the number of cores, since it can parallelize happily across cores with only "one" instance.

NetBeans development and GlassFish deployment already provide an ideal environment for Rails deployment.

All previous entries in this series are archived at LOTD.

Technorati: lotd rubyonrails jruby ruby netbeans glassfish

del.icio.us | furl | simpy | slashdot | technorati | digg

http://blogs.sun.com/arungupta/date/20080814 Thursday August 14, 2008

GlassFish @ Rails Conf Europe 2008


RailsConf Europe 2008

Sun Microsystems
is a diamond sponsor of Rails Conf Europe 2008 and we'll be there!

Here is the list of Sun sessions:

You can also meet us in the Exhibit Hall.

Here are some quick pointers:
And here are some references to get started with GlassFish and NetBeans:
And I have 92 blog entries, just on Rails!

Rails Conf Berlin 2007 sure was lot of fun (Day 1, 2 and 3) and now looking forward to a "Sun"tastic conference ahead :)

Drop a comment if any JUGs or Ruby Meetups would like to meet during that time.

Technorati: conf rubyonrails railsconf railsconfeurope glassfish netbeans

del.icio.us | furl | simpy | slashdot | technorati | digg

http://blogs.sun.com/arungupta/date/20080805 Tuesday August 05, 2008

JRuby on GlassFish v2 - screencast from community


Here is a (year old) community contributed video showing how to deploy a Ruby-on-Rails application on GlassFish v2 application server:


The presenter is not speaking and typing really fast, I wish there was a slower playback available :)

Anyway, thanks to Angsuman for the tip!

Screencast #Web9 shows how to deploy a Rails application as WAR in GlassFish v2. Some other relevant entries are:

And a lot more entries available here. Complete details about are available at JRuby in GlassFish wiki.

Let us know if you have published any artifacts related to GlassFish.

Technorati: rubyonrails jruby ruby glassfish youtube

del.icio.us | furl | simpy | slashdot | technorati | digg
Main | Next page »

Valid HTML! Valid CSS!

This is a personal weblog, I do not speak for my employer.

-->
ajax ajaxworld berlin brazil conf eclipse fitness gem glassfish glassfishday hyderabad india indigo interoperability javaone javaone2008 jax-ws jmaki jpa jruby jug lotd mac marathon metro microsoft mysql netbeans phobos photography presos railsconf ruby rubyonrails running runninglog runsfm screencast siliconvalleymarathon sun suntechdays swdp tango theserverside totd training traveltips v3 vista wcf web2.0 webservices webtier windows wsaddressing wsit youtube (all)