Thursday November 15, 2007
Mephisto with GlassFish v3 Gem
In an Earlier Post, I described how Mephisto (a popular web publishing system based on Ruby on Rails) can be deployed on GlassFish V3. Both JRuby and GlassFish has matured since then and this post will provide the updated instructions to deploy Mephisto using GlassFish v3 Gem.
Here are the exact steps:
JRUBY_HOME/bin' in your environment PATH.C:\workspaces\jruby-trunk>bin\jruby -S gem install rails
--include-dependencies --no-ri --no-rdoc
Bulk updating Gem source index for: http://gems.rubyforge.org
Successfully installed rails-1.2.5
Successfully installed activesupport-1.4.4
Successfully installed activerecord-1.15.5
Successfully installed actionpack-1.13.5
Successfully installed actionmailer-1.3.5
Successfully installed actionwebservice-1.2.5C:\workspaces\jruby-trunk>bin\jruby -S gem install
activerecord-jdbc -y --no-rdoc --no-ri
Need to update 1 gems from http://gems.rubyforge.org
.
complete
Successfully installed ActiveRecord-JDBC-0.5mysqld-nt --user root --console'
in MYSQL_HOME/bin directory on Windows or './bin/mysqld_safe'
from MYSQL_HOME directory on Unix flavors.C:\Program Files\MySQL\MySQL Server 5.0\bin>mysqladmin --u root
create mephisto_development
C:\Program Files\MySQL\MySQL Server 5.0\bin>mysql -u root
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 2
Server version: 5.0.45-community-nt MySQL Community Edition (GPL)
Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
mysql> grant all on mephisto_development.* 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;
ByeMEPHISTO_HOME/config/database.example.yml'
to 'MEPHISTO_HOME/config/database.yml'. There is no need to
specify the JDBC adapter
ActiveRecord 0.5 onwards and that allows to use the default
database configuration file.C:\testbed\mephisto-0.7.3>jruby -S rake db:bootstrap -J-DRAILS_ENV=development
(in C:/testbed/mephisto-0.7.3)
mkdir -p C:/testbed/mephisto-0.7.3/config/../log
-- create_table("assets", {:force=>true})
-> 0.3330s
-- create_table("assigned_sections", {:force=>true})
-> 0.2000s
-- create_table("cached_pages", {:force=>true})
-> 0.2980s
-- create_table("content_versions", {:force=>true})
-> 0.2130s
-- create_table("contents", {:force=>true})
-> 0.2190s
-- create_table("events", {:force=>true})
-> 0.2680s
-- create_table("memberships", {:force=>true})
-> 0.1890s
-- create_table("sections", {:force=>true})
-> 0.1500s
-- create_table("sessions", {:force=>true})
-> 0.1200s
-- add_index("sessions", ["session_id"], {:name=>"sessions_session_id_index"})
-> 0.3220s
-- create_table("sites", {:force=>true})
-> 1.1240s
-- add_index("sites", ["host"], {:name=>"index_sites_on_host"})
-> 0.3490s
-- create_table("taggings", {:force=>true})
-> 0.1950s
-- create_table("tags", {:force=>true})
-> 0.1840s
-- create_table("users", {:force=>true})
-> 0.2750s
-- initialize_schema_information()
-> 0.2740s
-- columns("schema_info")
-> 0.0170s
copied default theme to C:/testbed/mephisto-0.7.3/config/../themes/site-1...
================================================================================
Thank you for trying out Mephisto 0.7.3: Noh-Varr Edition!
Now you can start the application with script/server, visit
http://mydomain.com/admin, and log in with admin / test.
For help, visit the following:
Official Mephisto Site - http://mephistoblog.com
The Mephisto Community Wiki - http://mephisto.stikipad.com/
The Mephisto Google Group - http://groups.google.com/group/MephistoBlogC:\testbed>\workspaces\jruby-trunk\bin\jruby -S glassfish_rails
mephisto-0.7.3
And that shows the following output in the console:
Nov 14, 2007 6:37:51 PM com.sun.enterprise.v3.services.impl.GrizzlyAdapter
postConstruct
INFO: Listening on port 8080
Nov 14, 2007 6:37:51 PM
com.sun.enterprise.v3.services.impl.DeploymentService postConstruct
INFO: Supported containers : php,phobos,jruby,web
Nov 14, 2007 6:37:52 PM com.sun.grizzly.standalone.StaticResourcesAdapter
<init>
INFO: New Servicing page from: C:\testbed\mephisto-0.7.3\public
Nov 14, 2007 6:38:00 PM com.sun.enterprise.v3.server.AppServerStartup run
INFO: Glassfish v3 started in 9054 mshttp://localhost:8080/mephisto-0.7.3

Nov 14, 2007 6:24:08 PM sun.reflect.NativeMethodAccessorImpl invoke0
INFO:
Processing MephistoController#dispatch (for 127.0.0.1 at 2007-11-14
18:24:08) [GET]
Nov 14, 2007 6:24:08 PM sun.reflect.NativeMethodAccessorImpl invoke0
INFO: Parameters: {"action"=>"dispatch", "controller"=>"mephisto",
"path"=>[]}
Nov 14, 2007 6:24:09 PM sun.reflect.NativeMethodAccessorImpl invoke0
INFO: ←[4;36;1mSQL (0.001000)←[0m ←[0;1mSET SQL_AUTO_IS_NULL=0←[0m
Nov 14, 2007 6:24:09 PM sun.reflect.NativeMethodAccessorImpl invoke0
INFO: ←[4;35;1mSite Columns (0.046000)←[0m ←[0mSHOW FIELDS FROM sites←[0m
Nov 14, 2007 6:24:09 PM sun.reflect.NativeMethodAccessorImpl invoke0
INFO: ←[4;36;1mSite Load (0.010000)←[0m ←[0;1mSELECT * FROM sites WHERE (sites.`host`
= 'localhost') LIMIT 1←[0m
Nov 14, 2007 6:24:09 PM sun.reflect.NativeMethodAccessorImpl invoke0
INFO: ←[4;35;1mSite Load (0.017000)←[0m ←[0mSELECT * FROM sites ORDER BY id
LIMIT 1←[0m
Nov 14, 2007 6:24:09 PM sun.reflect.NativeMethodAccessorImpl invoke0
INFO: ←[4;36;1mSection Columns (0.010000)←[0m ←[0;1mSHOW FIELDS FROM
sections←[0m
Nov 14, 2007 6:24:09 PM sun.reflect.NativeMethodAccessorImpl invoke0
INFO: ←[4;35;1mSection Load (0.005000)←[0m ←[0mSELECT * FROM sections WHERE
(sections.site_id =1) AND (sections.`path` = '') LIMIT 1←[0m
Nov 14, 2007 6:24:09 PM sun.reflect.NativeMethodAccessorImpl invoke0
INFO: ←[4;36;1mArticle Columns (0.024000)←[0m ←[0;1mSHOW FIELDS FROM
contents←[0m
Nov 14, 2007 6:24:09 PM sun.reflect.NativeMethodAccessorImpl invoke0
INFO: ←[4;35;1mUser Columns (0.013000)←[0m ←[0mSHOW FIELDS FROM users←[0m
Nov 14, 2007 6:24:09 PM sun.reflect.NativeMethodAccessorImpl invoke0
INFO: ←[4;36;1mArticle Load Including Associations (0.027000)←[0m
←[0;1mSELECT contents.`id` AS t0_r0, contents.`article_id` AS t0_r1,
contents.`user_id` AS t0_r2, contents.`title` AS t0_r3, contents.`permalink`
AS t0_r4, contents.`excerpt` AS t0_r5, contents.`body` AS t0_r6,
contents.`excerpt_html` AS t0_r7, contents.`body_html` AS t0_r8,
contents.`created_at` AS t0_r9, contents.`updated_at` AS t0_r10,
contents.`published_at` AS t0_r11, contents.`type` AS t0_r12,
contents.`author` AS t0_r13, contents.`author_url` AS t0_r14,
contents.`author_email` AS t0_r15, contents.`author_ip` AS t0_r16,
contents.`comments_count` AS t0_r17, contents.`updater_id` AS t0_r18,
contents.`version` AS t0_r19, contents.`site_id` AS t0_r20,
contents.`approved` AS t0_r21, contents.`comment_age` AS t0_r22,
contents.`filter` AS t0_r23, contents.`user_agent` AS t0_r24,
contents.`referrer` AS t0_r25, users.`id` AS t1_r0, users.`login` AS t1_r1,
users.`email` AS t1_r2, users.`crypted_password` AS t1_r3, users.`salt` AS
t1_r4, users.`activation_code` AS t1_r5, users.`activated_at` AS t1_r6,
users.`created_at` AS t1_r7, users.`updated_at` AS t1_r8, users.`deleted_at`
AS t1_r9, users.`token` AS t1_r10, users.`token_expires_at` AS t1_r11,
users.`filter` AS t1_r12, users.`admin` AS t1_r13 FROM contents LEFT O
UTER JOIN users ON users.id = contents.user_id INNER JOIN assigned_sections
ON contents.id = assigned_sections.article_id WHERE ((assigned_sections.section_id
= 1)) AND (contents.published_at <= '2007-11-15 02:24:09' AND
contents.published_at IS NOT NULL) AND ( (contents.`type` = 'Article' ) )
ORDER BY contents.published_at desc LIMIT 15←[0m
Nov 14, 2007 6:24:09 PM sun.reflect.NativeMethodAccessorImpl invoke0
INFO: ←[4;35;1mSection Load (0.009000)←[0m ←[0mSELECT * FROM sections WHERE
(sections.site_id =1) ORDER BY position←[0m
Nov 14, 2007 6:24:09 PM sun.reflect.NativeMethodAccessorImpl invoke0
INFO: Completed in 1.12200 (0 reqs/sec) | Rendering: 0.00100 (0%) | DB:
0.16200 (14%) | 200 OK [http://localhost/mephisto-0.7.3]
Nov 14, 2007 6:24:11 PM sun.reflect.NativeMethodAccessorImpl invoke0
INFO:
Processing AssetsController#show (for 127.0.0.1 at 2007-11-14 18:24:11)
[GET]
Nov 14, 2007 6:24:11 PM sun.reflect.NativeMethodAccessorImpl invoke0
INFO: Parameters: {"ext"=>"css", "dir"=>"stylesheets", "action"=>"show",
"controller"=>"assets", "path"=>"main"}
Nov 14, 2007 6:24:11 PM sun.reflect.NativeMethodAccessorImpl invoke0
INFO: ←[4;36;1mSite Columns (0.030000)←[0m ←[0;1mSHOW FIELDS FROM sites←[0m
Nov 14, 2007 6:24:11 PM sun.reflect.GeneratedMethodAccessor5 invoke
INFO: ←[4;35;1mSite Load (0.018000)←[0m ←[0mSELECT * FROM sites WHERE (sites.`host`
= 'localhost') LIMIT 1←[0m
Nov 14, 2007 6:24:11 PM sun.reflect.GeneratedMethodAccessor5 invoke
INFO: ←[4;36;1mSite Load (0.011000)←[0m ←[0;1mSELECT * FROM sites ORDER BY
id LIMIT 1←[0m
Nov 14, 2007 6:24:12 PM sun.reflect.GeneratedMethodAccessor5 invoke
INFO: Completed in 0.33500 (2 reqs/sec) | Rendering: 0.00100 (0%) | DB:
0.05900 (17%) | 200 OK [http://localhost/mephisto-0.7.3/stylesheets/main.css]
Nov 14, 2007 6:24:14 PM sun.reflect.GeneratedMethodAccessor5 invoke
INFO:
Processing AssetsController#show (for 127.0.0.1 at 2007-11-14 18:24:14)
[GET]
Nov 14, 2007 6:24:14 PM sun.reflect.GeneratedMethodAccessor5 invoke
INFO: Parameters: {"ext"=>"png", "dir"=>"images", "action"=>"show",
"controller"=>"assets", "path"=>"bg"}
Nov 14, 2007 6:24:14 PM sun.reflect.GeneratedMethodAccessor5 invoke
INFO: ←[4;35;1mSite Columns (0.009000)←[0m ←[0mSHOW FIELDS FROM sites←[0m
Nov 14, 2007 6:24:14 PM sun.reflect.GeneratedMethodAccessor5 invoke
INFO: ←[4;36;1mSite Load (0.017000)←[0m ←[0;1mSELECT * FROM sites WHERE (sites.`host`
= 'localhost') LIMIT 1←[0m
Nov 14, 2007 6:24:14 PM sun.reflect.GeneratedMethodAccessor5 invoke
INFO: ←[4;35;1mSite Load (0.007000)←[0m ←[0mSELECT * FROM sites ORDER BY id
LIMIT 1←[0m
Nov 14, 2007 6:24:14 PM sun.reflect.GeneratedMethodAccessor5 invoke
INFO: Sending data bg.png
Nov 14, 2007 6:24:14 PM sun.reflect.GeneratedMethodAccessor5 invoke
INFO: Completed in 0.27900 (3 reqs/sec) | Rendering: 0.00000 (0%) | DB:
0.03300 (11%) | 200 OK [http://localhost/mephisto-0.7.3/images/bg.png]C:\testbed\mephisto-0.7.3>\testbed\ruby\jruby-1.0.2\bin\jruby
script\server
=> Booting WEBrick...
=> Rails application started on http://0.0.0.0:3000
=> Ctrl-C to shutdown server; call with --help for options
[2007-11-14 18:17:57] INFO WEBrick 1.3.1
[2007-11-14 18:17:57] INFO ruby 1.8.5 (2007-11-01) [java]
[2007-11-14 18:17:58] INFO WEBrick::HTTPServer#start: pid=11245030 port=3000
127.0.0.1 - - [14/Nov/2007:18:18:11 PST] "GET / HTTP/1.1" 200 1326
In this case, Mephisto gets deployed at http://localhost:3000
and WEBrick console shows the following:
- -> /
127.0.0.1 - - [14/Nov/2007:18:18:14 PST] "GET /stylesheets/main.css
HTTP/1.1" 200 3168
http://localhost:3000/ -> /stylesheets/main.css
127.0.0.1 - - [14/Nov/2007:18:18:17 PST] "GET /favicon.ico HTTP/1.1" 200 0
- -> /favicon.ico
127.0.0.1 - - [14/Nov/2007:18:18:16 PST] "GET /images/bg.png HTTP/1.1" 200
142
http://localhost:3000/stylesheets/main.css -> /images/bg.pngThis shows how a popular Ruby application can be deployed on WEBrick or GlassFish V3 Gem without any change.
Let us know if you have tried other Rails applications on GlassFish v3 by leaving a comment.
Technorati: glassfish mephisto rubyonrails ror jrubyonglassfish v3 gem ruby jruby
Posted by Arun Gupta in web2.0 | Comments[3]
|
|
|
|
|
Today's Page Hits: 1366
Total # blog entries: 931
Posted by Arun Gupta's Blog on November 19, 2007 at 06:55 AM PST #
Posted by Arun Gupta's Blog on April 09, 2008 at 09:02 AM PDT #
This shows how a popular Ruby application can be deployed on WEBrick or GlassFish V3 Gem without any change.
Posted by LAPTOP BATTERY on November 26, 2008 at 08:55 PM PST #