Wednesday June 18, 2008
Rails 2.1 on GlassFish - it works!
Rails 2.1 was released
earlier this month. GlassFish
provides a complete development/deployment
environment for Rails applications. Some of the main reasons
for using GlassFish (instead of WEBrick or Mongrel)
are:
| ~/testbed/rails21/jruby-1.1.2
>bin/jruby -S gem
install rails --no-ri --no-rdoc JRuby limited openssl loaded. gem install jruby-openssl for full support. http://wiki.jruby.org/wiki/JRuby_Builtin_OpenSSL Updating metadata for 253 gems from http://gems.rubyforge.org/ ............................................................................... ............................................................................... ............................................................................... ................ complete Bulk updating Gem source index for: http://gems.rubyforge.org/ Successfully installed activesupport-2.1.0 Successfully installed activerecord-2.1.0 Successfully installed actionpack-2.1.0 Successfully installed actionmailer-2.1.0 Successfully installed activeresource-2.1.0 Successfully installed rails-2.1.0 6 gems installed |
| ~/testbed/rails21/jruby-1.1.2/samples/rails
>../../bin/jruby
-S rails -d mysql runner create create app/controllers create app/helpers create app/models create app/views/layouts create config/environments create config/initializers create db create doc create lib create lib/tasks create log create public/images create public/javascripts create public/stylesheets create script/performance create script/process create test/fixtures create test/functional create test/integration create test/unit create vendor create vendor/plugins create tmp/sessions create tmp/sockets create tmp/cache create tmp/pids create Rakefile create README create app/controllers/application.rb create app/helpers/application_helper.rb create test/test_helper.rb create config/database.yml create config/routes.rb create config/initializers/inflections.rb create config/initializers/mime_types.rb create config/initializers/new_rails_defaults.rb create config/boot.rb create config/environment.rb create config/environments/production.rb create config/environments/development.rb create config/environments/test.rb create script/about create script/console create script/dbconsole create script/destroy create script/generate create script/performance/benchmarker create script/performance/profiler create script/performance/request create script/process/reaper create script/process/spawner create script/process/inspector create script/runner create script/server create script/plugin create public/dispatch.rb create public/dispatch.cgi create public/dispatch.fcgi create public/404.html create public/422.html create public/500.html create public/index.html create public/favicon.ico create public/robots.txt create public/images/rails.png create public/javascripts/prototype.js create public/javascripts/effects.js create public/javascripts/dragdrop.js create public/javascripts/controls.js create public/javascripts/application.js create doc/README_FOR_APP create log/server.log create log/production.log create log/development.log create log/test.log |
| ~/testbed/glassfish/v3/tp2/glassfishv3-tp2/glassfish
>java
-DJRUBY_HOME=/Users/arungupta/testbed/rails21/jruby-1.1.2 -jar
modules/glassfish-10.0-tp-2-SNAPSHOT.jar Jun 17, 2008 6:14:21 PM com.sun.enterprise.glassfish.bootstrap.ASMain main INFO: Launching GlassFish on HK2 platform Jun 17, 2008 6:14:22 PM com.sun.enterprise.v3.services.impl.GrizzlyProxy start INFO: Listening on port 8080 Jun 17, 2008 6:14:22 PM com.sun.enterprise.v3.services.impl.GrizzlyProxy start INFO: Listening on port 8181 Jun 17, 2008 6:14:22 PM com.sun.enterprise.v3.services.impl.GrizzlyProxy start INFO: Listening on port 4848 Jun 17, 2008 6:14:22 PM com.sun.enterprise.v3.admin.adapter.AdminConsoleAdapter setContextRoot INFO: Admin Console Adapter: context root: /admin Jun 17, 2008 6:14:22 PM com.sun.enterprise.v3.server.AppServerStartup run INFO: Glassfish v3 started in 974 ms |
| ~/testbed/rails21/jruby-1.1.2/samples/rails
>~/testbed/glassfish/v3/tp2/glassfishv3-tp2/glassfish/bin/asadmin
deploy runner Command deploy executed successfully. |
| Jun
17, 2008 6:14:41 PM com.sun.enterprise.rails.RailsDeployer
registerAdapter INFO: Loading application runner at /runner Jun 17, 2008 6:14:41 PM INFO: Starting Rails instances Jun 17, 2008 6:14:49 PM SEVERE: JRuby limited openssl loaded. gem install jruby-openssl for full support. http://wiki.jruby.org/wiki/JRuby_Builtin_OpenSSL Jun 17, 2008 6:14:51 PM com.sun.grizzly.jruby.RubyObjectPool$1 run INFO: Rails instance instantiation took : 9066ms Jun 17, 2008 6:14:51 PM com.sun.enterprise.v3.deployment.DeployCommand execute INFO: Deployment of runner done is 9168 ms |

| ~/testbed/rails21/jruby-1.1.2/samples/rails/runner
>../../../bin/jruby
-S rake db:create (in /Users/arungupta/testbed/rails21/jruby-1.1.2/samples/rails/runner) ~/testbed/rails21/jruby-1.1.2/samples/rails/runner >../../../bin/jruby script/generate scaffold distance miles:float run_at:datetime JRuby limited openssl loaded. gem install jruby-openssl for full support. http://wiki.jruby.org/wiki/JRuby_Builtin_OpenSSL exists app/models/ exists app/controllers/ exists app/helpers/ create app/views/distances exists app/views/layouts/ exists test/functional/ exists test/unit/ exists public/stylesheets/ create app/views/distances/index.html.erb create app/views/distances/show.html.erb create app/views/distances/new.html.erb create app/views/distances/edit.html.erb create app/views/layouts/distances.html.erb create public/stylesheets/scaffold.css create app/controllers/distances_controller.rb create test/functional/distances_controller_test.rb create app/helpers/distances_helper.rb route map.resources :distances dependency model exists app/models/ exists test/unit/ exists test/fixtures/ create app/models/distance.rb create test/unit/distance_test.rb create test/fixtures/distances.yml create db/migrate create db/migrate/20080618012326_create_distances.rb ~/testbed/rails21/jruby-1.1.2/samples/rails/runner >../../../bin/jruby -S rake db:migrate (in /Users/arungupta/testbed/rails21/jruby-1.1.2/samples/rails/runner) == 20080618012326 CreateDistances: migrating ================================== -- create_table(:distances) -> 0.0080s == 20080618012326 CreateDistances: migrated (0.0090s) ========================= |
| config.time_zone = 'Pacific Time (US & Canada)' |


| ~/testbed/rails21/jruby-1.1.2
>bin/jruby -S gem
install glassfish JRuby limited openssl loaded. gem install jruby-openssl for full support. http://wiki.jruby.org/wiki/JRuby_Builtin_OpenSSL Updating metadata for 13 gems from http://gems.rubyforge.org/ ............. complete Successfully installed glassfish-0.2.0-universal-java 1 gem installed |
| ~/testbed/rails21/jruby-1.1.2/samples/rails
>../../bin/jruby
-S glassfish_rails runner Jun 17, 2008 6:39:37 PM com.sun.enterprise.glassfish.bootstrap.ASMain main INFO: Launching GlassFish on HK2 platform Jun 17, 2008 6:39:37 PM com.sun.enterprise.glassfish.bootstrap.ASMainHK2 findDerbyClient INFO: Cannot find javadb client jar file, jdbc driver not available Jun 17, 2008 6:39:38 PM com.sun.enterprise.v3.services.impl.GrizzlyProxy start INFO: Listening on port 3000 Jun 17, 2008 6:39:38 PM com.sun.enterprise.v3.services.impl.GrizzlyEmbeddedHttpConfigurator configureSSL WARNING: pewebcontainer.all_ssl_protocols_disabled Jun 17, 2008 6:39:38 PM com.sun.enterprise.v3.services.impl.GrizzlyEmbeddedHttpConfigurator configureSSL WARNING: pewebcontainer.all_ssl_ciphers_disabled Jun 17, 2008 6:39:38 PM com.sun.enterprise.v3.services.impl.GrizzlyProxy start INFO: Listening on port 3131 Jun 17, 2008 6:39:38 PM com.sun.enterprise.v3.services.impl.GrizzlyProxy start INFO: Listening on port 3838 Jun 17, 2008 6:39:39 PM com.sun.enterprise.v3.admin.adapter.AdminConsoleAdapter setContextRoot INFO: Admin Console Adapter: context root: /admin Jun 17, 2008 6:39:39 PM com.sun.enterprise.rails.RailsDeployer registerAdapter INFO: Loading application runner at / Jun 17, 2008 6:39:39 PM INFO: Starting Rails instances Jun 17, 2008 6:39:44 PM SEVERE: JRuby limited openssl loaded. gem install jruby-openssl for full support. http://wiki.jruby.org/wiki/JRuby_Builtin_OpenSSL Jun 17, 2008 6:39:45 PM com.sun.grizzly.jruby.RubyObjectPool$1 run INFO: Rails instance instantiation took : 6710ms Jun 17, 2008 6:39:45 PM com.sun.enterprise.v3.server.AppServerStartup run INFO: Glassfish v3 started in 8053 ms |

Posted by Arun Gupta in web2.0 | Comments[6]
|
|
|
|
I was wondering how you would recommend deployment configuration to be made, for say a glassfish/rails application.
Like, how do you handle install-specific configuration (smtp server, symlinks to dirs with resources, etc).
I guess glassfish has excellent ways to monitor it, but being a rails developer, I am not that knowledgeable about this.
Any pointers are immensely appreciated.
Posted by albert ramstedt on June 22, 2008 at 03:42 PM PDT #
Posted by Arun Gupta's Blog on June 24, 2008 at 06:22 AM PDT #
Posted by Arun Gupta's Blog on June 25, 2008 at 06:42 AM PDT #
Albert, The beauty of Rails on GlassFish is that your application can be deployed as is. If it does not, that's a bug! If you provide more details then I can help you better.
Posted by Arun Gupta on June 25, 2008 at 05:21 PM PDT #
Well, I know it can be deployed. Only what I dont know is what java people use instead of capistrano. Say an application install needs specific configuration like mail server config, symlinks to networked drived mounts.. etc.
What I would want is to run a script post-war unpack that copies files and creates the symlinks. Maybe you could write capistrano deployment recipes for it though. But maybe there is a convention for deploying java-apps?
Posted by albert on June 26, 2008 at 01:12 AM PDT #
Albert,
I don't think there is an equivalent. Part of this stems from the fact that in the Java world, it's more likely the case that mainstream Java developers just throw the war file over the wall to the operations team, who handle all the server setup.
Capistrano comes from this new world where everybody is part of the ops team. I think the best answer to date is to continue to use cap. In the meanwhile we will make sure there are a solid set of deployment recipes for deploying war files and doing the couple Java-y things that are different than a regular Ruby deployment.
Posted by Arun Gupta on June 30, 2008 at 10:58 AM PDT #