Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Ruby (off the Rails) Hosting

Tags:

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.

like image 977
LoveMeSomeCode Avatar asked Nov 23 '09 18:11

LoveMeSomeCode


People also ask

Is Ruby on Rails a Web server?

Ruby on Rails (simplify as Rails) is a server-side web application framework written in Ruby under the MIT License. Rails is a model–view–controller (MVC) framework, providing default structures for a database, a web service, and web pages.

What does Rails add to Ruby?

Rails is a web application development framework written in the Ruby programming language. It is designed to make programming web applications easier by making assumptions about what every developer needs to get started. It allows you to write less code while accomplishing more than many other languages and frameworks.


1 Answers

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.

like image 50
Bob Aman Avatar answered Oct 13 '22 02:10

Bob Aman