Has anyone made an all-Ruby website? how'd it go?

I run a website that’s all PHP now, but was due for
a total re-write anyway. (The old code is a mess.)

It’s more MVC style - where the code comes first and
outputs HTML from templates - NOT embedded code inside HTML.

I love Ruby so much that it’s very tempting to write
my new version in Ruby (mod_ruby + Apache).

But I wonder if anyone who has already done a whole
interactive website in Ruby/modruby could share their
experience with it?

Were there any featured you really missed or any surprise
problems? Would you recommend it for someone else?

I know the question is vague, but I can’t tell if I’d
be making a big mistake by trying it this way, especially
if I didn’t realize until I was a month into it.

Thanks!

Yes.

One of my clients, a mutual fund, has their entire site powered by Ruby.
The basic need there was that the way the site was designed, they have two
different versions of content occupying the same URL space. One version
is public, and the other is private for brokers, distributors, and other
financial professionals. So, the Ruby underneath takes care of delivering
the right content for a given request, depending on whether the requestor
is logged in to the private version or not. At the same time, the code
also takes care of all of the various dynamic content pieces. I can't
give a URL to this site because of a confidentiality agreement.

I am redoing my company website, though, and it also has Ruby sitting
behind all of it. In this case, the framework takes care of handling the
navigation menu, header and footer inclusions, a client login section
where customers can view and pay invoices online, some simple dynamic
content demos, a client facing system status display where customers can
see a live and current display of the operational status of their systems,
and delivery of a correct stylesheet based on the type of browser making a
request. I'd rather have two slightly different stylesheets than have one
stylesheet with gross hacks in it to deal with differences in browser
implementations of CSS (thought te CSS that I have now still has a slight
issue with Opera).

Not all of these bits are online, yet, but feel free to take a look at
what is done:

http://enigo.com

It's all done under Iowa. The stuff that is just plain HTML is just plain
HTML files, but where there is something dynamic going on, there is a code
file associated with the HTML that contains the Ruby that handles the
dynamic bits.

The site redesign for my Iowa tutorial and documentation(the new versions
of which are not ready to be public yet), is done in much the same way.

The way that this all works is that there is a mod_ruby handler that is
setup to take a first crack at requests:

  RubyRequire '/apache/mod_iowa'
  <Location />
    RubySetEnv IOWA_SOCKET "localhost:12345"
    RubySetEnv MAP_FILE "/usr/local/htdocs/enigo.com/mapfile.cnf"
    SetHandler ruby-object
    RubyHandler Apache::Iowa
    RubyTransHandler Apache::Iowa
  </Location>

High level nutshell -- when Apache geta a request that matched the
location specified, it passes it to the handler. If the request is for a
URL specified in the mapfile.cnf file, then the handler issues a request
to the socket specified in the IOWA_SOCKET variable. This request is
basically a Marshalled clone of Apache::Request, giving the Iowa app full
access to the HTTP headers, query_string parameters, etc... This
Iowa::Request can be thought of as a Marshalable 80% close of
Apache::Request. It also works outside of mod_ruby, populating the
Iowa::Request with data pulled from the standard CGI environment
variables. Anyway, the request is passed off to Iowa. Iowa, running in
this way, will lookup the URL requested in a mapfile on its end, so that
it knows which class to use to handle the request.

Unless specifically specified in the associated code file, the class for a
plain HTML file is derived from the filename.

So, for examples:

Index.html becomes Iowa::Application::ContentClasses::Index
Gerbils/FAQ.html becomes Iowa::Application::ContentClasses::Gerbils::FAQ

and so on. This leads into one of the few current required naming
conventions. A filename has to follow Ruby rules for a valid class name
(the part before the .html, that is).

It all works very well. I can put a site with dynamic content together
quickly because I can leverage Ruby, and I can still use plain old HTML
for all of the areas where I want that. I have zero problems with it.
The Iowa process doesn't have a very large resident set size, even for
sites that have a lot of content and require a larger session cache than
the default 10. It's relatively fast. Speed is dependent on the size of
the content being returned and on just how much processing is required to
generate the dynamic stuff. On Ruby 1.8.1, on an 800Mhz test box, I
get around 35-40ish pages per second for relatively simple pages like the
Enigo navigation & homepage. On 1.6.8 it is somewhat slower, and seems to
evoke a threading bug if hammered for lots of hits per second, causing a
segfault.

So, I suppose my whole point here is that Ruby/mod_ruby can definitely be
used to power an entire web site. No problem. The issues all really come
up depending on whether you are using some framework like the recently
posted about 0.2 release of SWS or Iowa or something else or whether you
are using eruby or.... Each of these is going to have different strenghts
and weaknesses.

Kirk Haines

···

On Fri, 5 Mar 2004, Ruby Baby wrote:

I run a website that's all PHP now, but was due for
a total re-write anyway. (The old code is a mess.)

It's more MVC style - where the code comes first and
outputs HTML from templates - NOT embedded code inside HTML.

I love Ruby so much that it's very tempting to write
my new version in Ruby (mod_ruby + Apache).

But I wonder if anyone who has already done a whole
interactive website in Ruby/modruby could share their
experience with it?

I recently did an all-ruby website for my company. I have done sites in
PHP, Perl, HTML, etc. This one was the easiest to put together, and has
more features than any previous. The site is completely integrated with a
backend database. We spent some time making some backend classes that
really sped up developement. We have a database connection pool manager,
a dynamic menu builder based upon a user's access priviledges. Every
script has a mechinism for deteminig if a user can use a certain feature
or not depending on their access priveledges. All forms are driven by
data-structures (not just static). All in all it was a real pleasure
putting this site together. I would highly recommend using mod_ruby. Of
all the languages I've used to do this sort of thing in the past, Ruby
lends itself extremely well. The code is very easy to read/understand and
write, and I believe more powerful.

~ John

···

On Fri, 5 Mar 2004, Ruby Baby wrote:

I run a website that's all PHP now, but was due for
a total re-write anyway. (The old code is a mess.)

It's more MVC style - where the code comes first and
outputs HTML from templates - NOT embedded code inside HTML.

I love Ruby so much that it's very tempting to write
my new version in Ruby (mod_ruby + Apache).

But I wonder if anyone who has already done a whole
interactive website in Ruby/modruby could share their
experience with it?

Were there any featured you really missed or any surprise
problems? Would you recommend it for someone else?

I know the question is vague, but I can't tell if I'd
be making a big mistake by trying it this way, especially
if I didn't realize until I was a month into it.

Thanks!

Ruby Baby wrote:

I run a website that’s all PHP now, but was due for
a total re-write anyway. (The old code is a mess.)

It’s more MVC style - where the code comes first and
outputs HTML from templates - NOT embedded code inside HTML.

I love Ruby so much that it’s very tempting to write
my new version in Ruby (mod_ruby + Apache).

But I wonder if anyone who has already done a whole
interactive website in Ruby/modruby could share their
experience with it?

Were there any featured you really missed or any surprise
problems? Would you recommend it for someone else?

I know the question is vague, but I can’t tell if I’d
be making a big mistake by trying it this way, especially
if I didn’t realize until I was a month into it.

Thanks!

I am in the same situation as you, and began to look at cgikit.
http://www.spice-of-life.net/download/cgikit/index_en.html

My only regret is that I didn’t discover cgikit earlier. I can do everything
I did in PHP but much more cleanly, clearly, and also faster. The
infrastructure put in place by cgikit is really what is needed in web
development (I really like CKRepetition).

My only experience until now is to reproduce all kind of stuff I did in PHP,
but my next web development will be based on it as I could reproduce
everything in a matter of hours (included the time learning cgikit).

I don’t want to diminish other ruby projects I didn’t test (like SWS,
cerise, …), but I’m really pleased with cgikit and can only encourage you
to take a look at it…

Raph

Ruby Baby wrote:

I run a website that’s all PHP now, but was due for
a total re-write anyway. (The old code is a mess.)

It’s more MVC style - where the code comes first and
outputs HTML from templates - NOT embedded code inside HTML.

I love Ruby so much that it’s very tempting to write
my new version in Ruby (mod_ruby + Apache).

But I wonder if anyone who has already done a whole
interactive website in Ruby/modruby could share their
experience with it?

Not sure what you mean by “interactive”, but I have a number of sites
built with Blogtari, a web log app written in Ruby.

I’ve recently added support for mod_ruby, with only a few surprises.

Were there any featured you really missed or any surprise
problems? Would you recommend it for someone else?

There are a number of Ruy tools for building web sites, from simple
templating systems to “web application frameworks” (a fairly nebulous
term). There was a discussion here on ruby-talk recently about web
frameworks; search through Google groups to dig it up.

For myself, I wrote Blogtari to make frequent use of dynamic file and
class loading. It’s possible, for example, to write a blog entry
preprocessor, drop it in a plugin directory, and have it automatically
located, loaded, and run when rendering the site. Blogtari also renders
blog entry source files of various file types (plain
text/pseudo-textile, email, xhtml, with support for oowriter/sxw
planned); the code loads entry rendering classes based on file
extension, so there is minimum amount of hard-coded details.

In general, Ruby’s dynamic nature makes it easy to write flexible
rendering tools.

I know the question is vague, but I can’t tell if I’d
be making a big mistake by trying it this way, especially
if I didn’t realize until I was a month into it.

If you’ve already done sites in PHP, you’ll likely find it easier to do
things in Ruby, assuming you think in terms of The Ruby Way.

James Britt

ruby_powered_sites = %w{
www.ruby-doc.org
www.rubyxml.com
www.jamesbritt.com
www.blogtari.com
}

My tutorial is all done in Ruby:

http://pine.fm/LearnToProgram/

In fact, you can see the code for it at:

http://pine.fm/LearnToProgram/?ShowTutorialCode=true

It’s not terribly interactive, but it does actually run the example scripts
(and does the syntax coloring), capturing their output and sticking it in
the page.

Nothing too fancy; I’m pretty low-tech. :slight_smile:

We are also using Ruby to build our family picture site, and we have been
loving that:

http://pine.fm/FamilyPictures/

It, too, is just one big script. As I am a Ruby programmer (and most
certainly not an html… uh, html-maker) I never use eruby or anything
like that for inlining ruby; I like to keep the html as out of my way as I
can.

Anyway, in both cases I have been quite pleased. Hey, it’s Ruby! :slight_smile:

Chris

“Chris Pine” cpine@hellotree.com

It, too, is just one big script. As I am a Ruby programmer (and most
certainly not an html… uh, html-maker) I never use eruby or anything
like that for inlining ruby; I like to keep the html as out of my way as I

Take a look at dynamator: http://dynamator.sourceforge.net/

Or you may have already :wink:
– shanko