I have to say. JRuby on Rails is very cool. It is so easy now to deploy to Tomcat and JBoss. I tried and did it on both server and it ran like a champ. Here is the steps (Mac OS X):’
- sudo port install jruby
- sudo chmod a+w /opt/local/share/java/jruby/lib/ruby/gems/ and all the directory underneath it
- sudo chmod a+w /opt/local/share/java/jruby/bin
- jruby -S gem install rails mongrel jdbc-mysql activerecord-jdbcmysql-adapter activerecord-jdbc-adapter jruby-openssl warbler –no-rdoc –no-ri
- sudo port tomcat5 (or you can install jboss. Just download and unpack it to a directory)
- jruby -S rails your_rails_project
- cd your_rails_project
- generate a simple model: jruby script/generate scaffold car model:string
- create a development database:my_own_development in mysql
- change config/database.yml:
- development:
adapter: jdbcmysql
database: my_own_devevelopment
pool: 5
timeout: 5000
host: localhost
username: root
password: - jruby rake db:migrate
- jruby -S warble config
- change config/warble.rb file:
- make sure: config.gems += [”activerecord-jdbcmysql-adapter”, “jruby-openssl”,”activerecord-jdbc-adapter”,”jdbc-mysql”] #include all the gems you need
- make sure: config.webxml.rails.env = ENV[’RAILS_ENV’] || ‘production’ # point to the environment you want. By default it is production
- make sure you are on your rails project’s root directory
- jruby -S warble war
- that will create war file like your_rails_project.war
- cp your_rails_project.war to your tomcat_home/webapps directory or your jboss_home/server/default/deploy directory
- start tomcat or start jboss
- go http://localhost:8080/your_rails_project/ to check if your project has deployed. To see the scaffold car go http://localhost:8080/your_rails_project/cars