English 中文(简体)
Ruby (off the Rails) Hosting
原标题:
  • 时间:2009-11-23 18:50:19
  •  标签:
  • ruby
  • hosting

Many people have asked about Rails hosting on this site, but I m not familiar enough with the back end of things to know if there s a difference.

I want to host some Ruby CGI webservices , basically just ruby methods that take parameters from a POST request, access a MySQL db and return data.

I ve looked at RoR and it seems like overkill for this, from what I can tell it s for speeding up the development of data baesd CRUD sites, which is not at all what I m doing.

So my question is, does this affect the hosting provider I choose? Does anyone recommend a good Ruby host for CGI operations? I m not familiar with FastCGI, mod_ruby, Passenger, Mongrel etc. and what they mean for performance, scalability etc. I just want to host my ruby scripts with reasonably good performance, and all the info out there(and here) seems to be focused on rails.

最佳回答

First, if you want lightweight, Sinatra is usually my first pick. Pair it up with rack and Passenger for best results. It s not CGI, but realistically speaking, CGI is rarely a good match-up with Ruby.

Here s the "Hello World!" Sinatra app from the main page:

require  rubygems 
require  sinatra 
get  /hi  do
  "Hello World!"
end

Hard to get more lightweight than that.

As for providers, anybody that supports Passenger (mod_rack) should be able to handle Sinatra. I m a big fan of Slicehost personally, but they re a VPS host, which means you need to be able to install and manage the entire stack yourself. If you don t mind paying a tiny bit extra for the infrastructure, Heroku makes installation and deployment dead simple, so long as your needs don t exceed what they provide (sounds like they won t). In the unlikely event that you re only using 5MB or if you re using an external storage mechanism like Amazon RDS, Heroku may actually be free for you.

Update:

  • Passenger is an Apache module that allows Rack applications to be run inside of Apache.
  • Rack is a middleware layer that separates the web server and the web framework from each other. This allows web frameworks to run on any web server for which there is an adapter.
  • Sinatra is a lightweight web framework that runs on top of Rack.

Once Passenger and Rack are installed (gem install rack, gem install passenger) you just need to edit the Apache vhost to point at the config.ru file for your Sinatra app and create the required directories as per the Passenger docs and you ll be good to go.

问题回答

I think you might want to look into Rack. It allows you to do the kinds of things you re talking about and shrugs off the weight of frameworks like Rails or Merb. Rack applications can be hosted at a place like Heroku.





相关问题
Ruby parser in Java

The project I m doing is written in Java and parsers source code files. (Java src up to now). Now I d like to enable parsing Ruby code as well. Therefore I am looking for a parser in Java that parses ...

rails collection_select vs. select

collection_select and select Rails helpers: Which one should I use? I can t see a difference in both ways. Both helpers take a collection and generates options tags inside a select tag. Is there a ...

RubyCAS-Client question: Rails

I ve installed RubyCAS-Client version 2.1.0 as a plugin within a rails app. It s working, but I d like to remove the ?ticket= in the url. Is this possible?

Ordering a hash to xml: Rails

I m building an xml document from a hash. The xml attributes need to be in order. How can this be accomplished? hash.to_xml

multiple ruby extension modules under one directory

Can sources for discrete ruby extension modules live in the same directory, controlled by the same extconf.rb script? Background: I ve a project with two extension modules, foo.so and bar.so which ...

Text Editor for Ruby-on-Rails

guys which text editor is good for Rubyonrails? i m using Windows and i was using E-Texteditor but its not free n its expired now can anyone plese tell me any free texteditor? n which one is best an ...

热门标签