Mephisto on GlassFish V3
This blog shows how Mephisto, a web
publishing system based on Ruby on Rails,
can be deployed on
GlassFish V3 with minimal changes. These detailed steps are derived from the
original instructions. Here are the exact steps that I followed:
- Download Install
GlassFish V3 Technology Preview 1 (lets say GLASSFISH_HOME). - Install and Configure JRuby
- Download and Install JRuby1.0
RC2 in 'GLASSFISH_HOME/lib' directory. Rename the installation directory
to 'jruby' (lets say JRUBY_HOME). - Include '
JRUBY_HOME/bin' in your environment PATH. - Install Rails and ActiveRecord gems in JRuby installation by giving the
command:
gem install rails -y --no-rdoc<br>
gem install activerecord-jdbc -y --no-rdoc - Download and Install
MySQL/J
Connector in a new directory. Copy the JAR file from the main installation directory to
'JRUBY_HOME/lib' directory.
- Download and Install JRuby1.0
- Install and Configure Database
- Download and install
MySQL Community
Server 5.0 (lets say MYSQL_HOME). - Start MySQL database by giving the command '
mysqld-nt --user root --console'
inMYSQL_HOME/bindirectory on Windows or './bin/mysqld_safe'
fromMYSQL_HOMEdirectory on Unix flavors. - Create a database and grant privileges by giving the following commands:
MYSQL_HOME/bin/mysql -u root<br>
mysql> create database mephisto character set utf8;<br>
Query OK, 1 row affected (0.00 sec)<br>
<br>
mysql> grant all on mephisto.* to arun@localhost identified by 'noway';<br>
Query OK, 0 rows affected (0.00 sec)<br>
<br>
mysql> flush privileges;<br>
Query OK, 0 rows affected (0.00 sec)<br>
<br>
mysql> quit;<br>
Bye
- Download and install
- Install and Configure Mephisto
- Download and unzip
Mephisto 0.7.3.
Rename the installation directory to 'mephisto' (lets say
MEPHISTO_HOME) for convenience. - Install Mephisto as described
here. The two steps are
summarized below for convenience:- Copy '
MEPHISTO_HOME/config/database.example.yml'
to 'MEPHISTO_HOME/config/database.yml'. Change database entries in the
file from:
development:<br>
adapter: mysql<br>
database: mephisto_development<br>
username: root<br>
password:<br>
host: localhost
to
development:<br>
adapter: jdbc<br>
driver: com.mysql.jdbc.Driver<br>
url: jdbc:mysql://localhost:3306/mephisto<br>
username: arun<br>
password: noway - Edit '
MEPHISTO_HOME/config/environment.rb', add the following
fragment before "Rails::Initializer.run" statement.
if RUBY_PLATFORM =~ /java/<br>
require 'rubygems'<br>
RAILS_CONNECTION_ADAPTERS = %w(jdbc)<br>
end - Run '
rake db:bootstrap' to bootstrap the
development database. On windows, you may have to invoke this
command as '
'.JRUBY_HOME\bin\jruby.bat JRUBY_HOME\bin\rake
db:bootstrap
- Copy '
- Download and unzip
- Start GlassFish V3 by invoking the following command in
:GLASSFISH_HOME
java -jar lib/glassfish-10.0-SNAPSHOT.jar - Deploy the application from '
GLASSFISH_HOME/bin' as:
asadmin deploy --path MEPHISTO_HOME - Mephisto is now deployed at '
http://localhost:8080/mephisto'.

This shows how a Ruby application, with minimal change, can be deployed on
GlassFish V3. This was also shown in the
JavaOne 2007
Technical keynote (start @ 8:29 and finish @ 10:50).
I encourage you to try other popular Rails applications on GlassFish and
leave your feedback here.
Technorati:
glassfish mephisto
rubyonrails
ror jrubyonglassfish
- Login or register to post comments
- Printer-friendly version
- arungupta's blog
- 1416 reads





