Ciaos Creations

jRuby Radiant CMS installation on Tomcat Server

Posted in Projects by Steven on July 12, 2009

For the past month, all the Radiant-jRuby installation instructions that I have found did not perform as advised. From what I have determined, the root of the issue was Radiant-jRuby was unable to create cache files.  Thus disabling cache allowed Radiant to function properly with jRuby.

To disable caching, comment the config.middle.use argument in environment.rb file.

# config.middleware.use ::Radiant::Cache

If caching is incredibly important, the Rack::Cache module seems to function without any errors, however I haven’t figure out where the cache files are saved.  To enable caching with Rack just update the config.middleware.use argument in environment.rb file.

config.middleware.use ::Rack::Cache

Here below are the instructions I used to enable Radiant on jRuby and Tomcat based on the Radiant CMS instructions at http://kenai.com/projects/jruby/pages/Radiant_CMS

Obtaining Gems

The command below is under the assumption all the required jdbc mysql adapters have been installed. If not please include activerecord-jdbcmysql-adapter gem.

jruby -S gem install –no-ri –no-rdoc radiant radius rack-cache warbler

Create Project and Configuration

Lets create a Radiant mysql application in a directory.

jruby -S radiant –database=mysql radiantblog

Before the application data is created, the database.yml needs to be configured. Simply update the adapter to “jdbcmysql” instead of “mysql”. Here is what the production configuration would look like.

production:
adapter: jdbcmysql
database: radiant
username: username
password: password
host: localhost

With the database.yml configured, the database can now be bootstrapped.

jruby -S rake production db:bootstrap

Lets run the server to test the app and check it at localhost:3000

jruby -S script/server -e production

Deployment

The only deployment that I utilize is with Tomcat using the warbler gem.  Here is the minimum configurations I used starting off with the command to generate the warbler configuration file

jruby -S warble config

warble.rb configuration:

Warbler::Config.new do |config|
config.dirs = %w(cache config db log public script vendor tmp)
config.gems += ["activerecord-jdbcmysql-adapter", "radiant",
"jruby-openssl", "radius", "rack-cache"]
config.gem_dependencies = true
config.war_name = “ROOT”
end

The reason why the config.war_name is ROOT is to avoid any potential Radiant Routing issues. Next build the war file with the following command.

jruby -S warble war

After running the above command, move the newly created file, ROOT.war, to the Tomcat web directory. The URL, localhost:8080, should now render your newly created Radiant blog.


2 Responses

Subscribe to comments with RSS.

  1. Mario Arias said, on November 20, 2009 at 9:19 pm

    Thanks for sharing, although the Rack-Cache don,t work:).

    • Steven said, on November 24, 2009 at 9:39 am

      Mario, Thanks for the feedback. I still haven’t figured out how the Rack-Caching worked with jRuby and Radiant. The demo project Radiant was used for hasn’t moved forward from the initial exploration.

      I have also found out Rack initiated HTTP Auth doesn’t work when a Rack project is deployed on Tomcat. With that in mind, I don’t find Rack-Cache failing all to surprising. :(


Leave a Reply