Creating a rails3 application with jruby
Dienstag, 19. April 2011, 12:15 Uhr | roberto@vasquez-angel.de |Create the application:
$> rails new [APP_NAME] -d [DB_ADAPTER] -m http://jruby.org/rails3.rb
Add warbler to your app. Edit Rails.root/Gemfile
:
group :development do platforms :jruby do gem 'warbler' end end
Install your bundle:
$> bundle install
Check the installation:
$> rails server
Open http://localhost:3000
.
Deploying to Tomcat
Using sqlite3
If you are using sqlite for production, you may want to include the Rails.root/db
to the war file. To do this, you’ll have to create a warble config file:
$> warble config
Then, edit Rails.root/config/warble.rb
:
Warbler::Config.new do |config| config.dirs = %w(app config db lib log vendor tmp) . . . end
Packiging and move to production
Convert the application to a .war file:
$> warble
Install Tomcat. Copy the .war file to the tomcat/webapps folder. Open a browser at http://localhost:8080/manager (admin:admin) and enable your application.
Open http://localhost:8080/[APP_NAME]
Gotchas
- The production log is written to [TOMCAT]/log/localhost.YYYY-MM-DD.log