What's the best way to deploy a JRuby on Rails application to Tomcat?
I don't have much experience on this, so I don't know if I can give you the BEST way, but if Capistrano doesn't work, and you can't have a separate MRI install just to run it, you have just a few alternatives left:
Try running plain Rake and write your own deployment target:
http://www.gra2.com/article.php/deploy-ruby-on-rails-applications-rake
Or use Ant or Maven.
Or if it just ONE server you have to deploy to, you could just hack together two Ruby scripts - one that listens on the server for shutdown/startup requests, and one local that you run to: Send shutdown, scp over the file, send startup.
By the way, have you submitted any integration bugs you find with Capistrano to the JRuby team? I'm sure they'd be happy to have any contribution.
:)
Automated deployment of JRuby on Rails to Tomcat on Windows?
If you are building your application using Hudson/Jenkins, then it's as easy as adding an extra step to the build process itself.
I added an after-build step:
[X] Deploy war/ear to a container
- WAR/EAR files: target/myapp.war
- Container : Tomcat 6.x
- Manager user name: admin
- Manager password: passwordhere
- Tomcat URL: http://ip.address.here:8080/ (note: don't add any path)
Everytime my build runs successfully, Jenkins deploys (or re-deploys) the new WAR file.
Deploy jruby project to tomcat in windows platform
Did you precompile your assets before warbling?
You need to run rake assets:precompile
to generate static content before running warble
jRuby deployment into a subfolder in Tomcat
There is code in JRuby-Rack to deal with this. Depending on the version of Tomcat and/or Rails, it may not be detecting the extra context path correctly.
The environment variable that is supposed to take effect is called ENV['RAILS_RELATIVE_URL_ROOT']
. You might print out the value of that expression during boot time and see whether it's getting set when you run in Tomcat.
The code in question is here:
https://github.com/nicksieger/jruby-rack/blob/master/src/main/ruby/jruby/rack/rails.rb#L32-38
The versions of Tomcat, Rails and JRuby-Rack you're using would help diagnose the problem further.
JRuby Rails 3.1.6 deploy WAR on Tomcat 7 in subdirectory (redirects and links don't use the subdirectory)
Sounds like a Devise thing, have you checked how it's issuing the redirect ?
It should have worked, assuming you do something like the following from an action :
def index
redirect_to :action => "hello"
end
jruby-rack (gets included when you warble
) correctly handles cases when an application is running within a servlet context path different than /. I suggest to reverse the "hacks" you did trying to make things work and look into the code that redirected you ... e.g. code such as redirect_to "/home/goodbye"
won't "work" (prefix the context path) as its assumed to be a complete URL path.
As for the config.ru
for a Rails application Warbler does not copy it - thus it can distinguish a Rails from a plain Rack application (as jruby-rack does more hooks into Rails to provide a seamless experience with servlet containers such as Tomcat).
Step by step guide about how to make Apache Tomcat work with Ruby on Rails application?
Tomcat is for Java applications, which allows you to run Java Servlet and JavaServer Pages. You do not need a full Apache Tomcat server, a normal Apache or Nginx webserver is enough. With the help of Phusion Passenger, deployment of Rails applications is really easy. Just follow the Phusion Passenger users guide. If you must use Tomcat, though, you can connect the Apache Tomcat server with an Apache web server. This requires the mod_jk module, a Tomcat-Apache plug-in that handles the communication between Tomcat and Apache.
Related Topics
How to Generate a Random Number Between a and B in Ruby
How to Run Shell Commands on Server in Capistrano V3
Rake VS. Thor for Automation Scripts
Rails: Good Rspec2 Example Usage? (Also: Cucumber, Pickle, Capybara)
Convert String with Hex Ascii Codes to Characters
Rails 3/Ruby: Activerecord Find Method in Condition Array to Parameters Single Quote Issue
Ruby Working on Array Elements in Groups of Four
Find Out If an Ip Is Within a Range of Ips
Error Installing Gem Capybara-Webkit
Raise Custom Exception with Arguments
Break and Return in Ruby, How to Use Them
Rails Mapping Array of Hashes Onto Single Hash
Finding What Is Common to Two Arrays