Follow up from here.
In this post I’ll show how a Ruby-on-Rails (RoR) application, talking to MySQL database, can be deployed as a WAR file on GlassFish V2. Here are the steps I followed:
- Create a HelloWorld RoR app talking to MySQL database as described here.
- Expand NetBeans project, expand ‘
Configuration‘ and open ‘
database.yml‘. Change production database entry from:
Notice, even though this is production setting we are using a "development" database.
- In ‘
Rails::Initializer.run do |config|
On some platforms, this syntax has caused problems. In that case, it may alternatively be specified (step 9) as:
if RUBY_PLATFORM =~ /java/ require 'rubygems' RAILS_CONNECTION_ADAPTERS = %w(jdbc) end
- Recreate the WAR file by invoking the command ‘
rake war:standalone:create‘ from your application directory.
- Drop this WAR file in "
domains/domain1/autodeploy" directory of your GlassFish instance and you are done!
With this, you’ve deployed a Ruby-on-Rails application accessing MySQL database as a WAR file on GlassFish V2.