Deploying a JRuby on Rails application should be pretty easy thanks to Warbler. Simply package up your Rails app into a WAR file, place the .war file on the server, and you’re done.
Unfortunately, it’s not really quite that easy if you have any database migrations to perform. Thankfully, we can use the .war file itself to run the migrations, without needing to transfer another copy of the rails app specifically for this purpose. We’ll accomplish this using warbler-exec.
Step 1: Configure Warbler
In order to run our migrations, we use bundler to create scripts in
./bin/ for warbler-exec to launch:
bundle install --binstubs
Then edit config/warble.rb
config.dirs = %w(app db config lib log vendor tmp bin)
config.includes = FileList["Rakefile"]
config.bundle_without = 
This ensures that warble includes the stubs generated by bundler, as well as the Rakefile. The last line is used to make sure that all our gems are packaged in the .war.
Step 2: Install warbler-exec on the Server
There’s no need to add warbler-exec to your Gemfile, as it will only be used on the server, and needs to be installed outside of the .war file in order to be used. Make sure that you install warbler-exec using a Ruby version that will be accessible by your deployment scripts.
Step 3: Update Your Deployment Scripts
Now that everything is in order, the last step is to update your deploy script to run the migration on the server. For an example:
jruby -S warbler-exec /path/to/my-app.war bin/rake db:migrate
And that’s it! Your migrations will now run on the server, right from within the .war file itself.