As common as Ruby and Rails are, it appears such as this problem would be solved. JRuby and mod_rails are good, why is not there an Apache mod just for straight Ruby?
There's Phusion Passenger, a strong Apache module that may run Rack programs with minimum configuration. It's becoming attractive to shared hosts, and turning any program right into a Rack application is absurdly easy:
A Rack application is definitely an Ruby object (not really a class) that responds to
call. It requires exactly one argument, the atmosphere and returns a range of exactly three values: The status, the headers, and the entire body.
The fundamental issue is this: for any very long time, MRI was the only real achievable Ruby Implementation. MRI has numerous problems making it tough to embed it into another application (that is essentially what mod_ruby does: it embeds MRI in Apache), especially a multi-threaded one (which Apache is). It's not particularly thread-safe and contains a great deal of worldwide condition.
This global condition means for instance when one Rails application modifies some class, then other Rails programs running on a single Apache server, will also check this out modified class.
One other issue would be that the MRI source code isn't easily hackable. MRI has become a lot more than fifteen years old, and it is beginning to exhibit.
Consequently of those problems, mod_ruby hasn't really correctly labored, and sooner or later the maintainers simply threw in the towel.
The C based PHP interpreter, however, was created from the first day to become run as mod_php inside Apache. Indeed, for that initial few versions, there wasn't a commandline version from the interpreter, mod_php was the only method to run PHP.
Phusion Passenger (also known as mod_rack also known as mod_rails) solves this issue by essentially quitting and avoiding the issue: they just operate a seperate copy of MRI inside a seperate process for each application. It really works great, and never just for Ruby. It supports WSGI (standard interface for Python Web Frameworks), Rack (standard interface for Ruby Web Frameworks) and direct support for Ruby on Rails.
My hopes take presctiption mod_rubinius, which regrettably does not exist yet. Rubinius was created right from the start to become thread-safe, embeddable, free from global condition, not make use of the C stack and so forth. It had been made to have the ability to run multiple Rubinius VMs inside one Rubinius process. This will make mod_rubinius infinitely simpler to implement and keep than mod_ruby. Regrettably, obviously, Rubinius isn't launched yet, and also the real focus on mod_rubinius cannot even begin until Rubinius is launched. The good thing is that mod_rubinius already has more manpower behind it than mod_ruby ever endured, since it has compensated designers focusing on it with a Rails webhost that frantically really wants to utilize it themselves.
It's possibly worth double-making clear mislav's point that mod_rails is not really restricted to Rails code whatsoever. The brand new title, mod_rack, is more preferable. Trivially small applications could be rackable -- their example being:
class HelloWorld def call(env) [200, , ["Hello world!"]] finish finish
There's one: mod_ruby, however it has not been maintained within 24 months.
You mean, like this?