Mephisto on GlassFish V3
Posted by arungupta on May 22, 2007 at 9:16 PM EDT
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
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
RC2 in '
- 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
mysql> create database mephisto character set utf8;
Query OK, 1 row affected (0.00 sec)
mysql> grant all on mephisto.* to arun@localhost identified by 'noway';
Query OK, 0 rows affected (0.00 sec)
mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)
mysql> quit;
Bye
- 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:
adapter: mysql
database: mephisto_development
username: root
password:
host: localhost
to
development:
adapter: jdbc
driver: com.mysql.jdbc.Driver
url: jdbc:mysql://localhost:3306/mephisto
username: arun
password: noway - Edit '
MEPHISTO_HOME/config/environment.rb', add the following fragment before "Rails::Initializer.run" statement.
if RUBY_PLATFORM =~ /java/
require 'rubygems'
RAILS_CONNECTION_ADAPTERS = %w(jdbc)
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
Mephisto 0.7.3.
Rename the installation directory to '
- 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
Related Topics >>
Blog Links >>
- Login or register to post comments
- Printer-friendly version
- arungupta's blog
- 1372 reads





