Setup for running Rails in Liferay portlets
So far, the minimum setup and versions known to work:
- Ruby 1.8.7 or 1.9, Rails 2.x
- Liferay 5.1.1 or 5.2.x (5.1.2 does NOT work, see LPE-44)
- Git
gem install caterpillar
git clone git://github.com/lamikae/rails-portlet.git
cd rails-portlet/
git submodule init
git submodule update
Further commands and filenames refer to the rails-portlet directory.
If you do want to use a (PostgreSQL) database connection, edit the configuration file example/config/environment.rb. ActiveRecord is disabled by default.
Also set up the database connection; file example/config/database.yml. You may check the examples in that directory.
# enable ActiveRecord
- config.frameworks -= [:active_record, :active_resource, :action_mailer ]
+ #config.frameworks -= [:active_record, :active_resource, :action_mailer ]
Start the example application server at example.
./script/server
Rails is now running. Now, the Liferay setup:
Download the Liferay 5.2.3 Tomcat 6 bundle from liferay.com.
unzip liferay-portal-tomcat-6.0-5.2.3.zip
sudo chown -R `whoami` liferay-portal-5.2.3 # give yourself proper privileges
If you chose another installation directory, check the configuration file example/config/portlets.rb with your settings.
Install the required JAR (recommended with each Caterpillar update) by returning to the example Rails directory:
caterpillar jar:install
caterpillar deploy:xml
Then you're ready to boot up Liferay.
cd /usr/local/liferay-portal-5.2.3/tomcat-6.0.18
bin/startup.sh && sleep 4 && tail -f logs/catalina.out
Starting Liferay Portal Standard Edition 5.2.3 (Augustine / Build 5203 / May 20, 2009)
...
19:19:36,655 INFO [Rails286Portlet:?] Initializing Rails-portlet portlet_test_bench (version 0.10.0)
...
INFO: Server startup in 46419 ms
Finally, restart the example application server in production mode..
RAILS_ENV=production ./script/server