Rails on a "/cgi-bin" and ".rb" focused web server

Hello dear Rubyists,

I would like to program my homepage with Ruby on Rails. However, on my
homepage web server, there seem to be some restrictions:

- Scripts are only executed when they reside inside the "/cgi-bin"
directory.
- Ruby scripts must end with ".rb"; the extension ".rhtml" is not
recognized.
- I am not sure if the Rails libraries are installed. Ruby itself seems
to work though.

So, here come my questions. (First of all, I assume that I develop my
homepage as a normal Rails application, just like all the Ruby
beginner's guides tell me to.)

1. When my homepage is a regular Rails application, this would require
that I can call something like "myserver.com/appname/action" or
something - a special URL format. Is there any way that I can "map"
this to something like:
"myserver.com/cgi-bin/script.rb?appname=foo&action=bar" or so? I mean,
can I make a regular Rails application work, based on the "/cgi-bin"
script restriction? (I hope this was understandable.)

2. How do I find out if the Rails libraries are installed? (I don't
have telnet or ssh access; I can just execute ".rb" scripts per HTTP,
which I uploaded using FTP.)

3. If the Rails libraries are not installed, is there a simple way for
me to upload them and use them in my Ruby scripts?

4. If all of that will not work out, what would be an easy, small
change which I could request from my hoster, to make this work,
whithout requiring them to change their whole webserver?

Thanks for Your attention. I am quite new to Ruby, so please don't
expect from me to understand any elaborated concepts. But I'm also
really keen on using RoR for my homepage, so I really hope I get this
working.

Thanks,
Madoc.

I have one more remark:

PHP scripts also get executed when they are somewhere else than in "cgi-bin". So one of my ideas is to make a PHP script that only contains something like this (in pseudo-syntax):

  <?php php_command_to_make_an_internal_redirect_to_ruby(); ?>

Maybe this would be a solution. However, the URI would need to be changed. Might be that the original URL is something like:

  http://myserver.com/index.php?/ruby/argument/uri

The internal redirect should go to:

  http://myserver.com/cgi-bin/somerubyscript.rb?.

I'm completely lost on this.

Madoc schrieb:

One more remark: I discovered that the Rails gem is installed, with
version 1.1.2.

Also, for Ruby scripts in "/cgi-bin" to work, they must have
"#!/bin/ruby -" as their first line.

I've been testing RoR for quite a while, and I can tell you one thing
for sure -- you're wasting your time, trying to learn a workaround for
installation. Do not try to invent a new path. Your hair will go grey
and you'll start to despise life itself.

Even if you try to follow the advice provided in the webpages and
books, you'll have troubles. Setting up RoR for websites is a very
painful thing. Part of the problem is that there is no one method that
is preferred above others. It is a changing field. The best
documentation (I'm told) is the "Agile" book, referred to on the main
RoR webpage. Well, I just bought the new edition, and it is very,
very, nice. I recommend it highly. However, there is a very scary bit
to the book. When it comes to deploying the site (as opposed to
playing around with a test server), things get nasty. The authors note
that the previous edition of the book recommended a particular method,
but that they now (just a year later) strongly recommend AGAINST that
method, and have a new shiny method that they favour. Neither method
is easy to set up, EVEN IF you have administrator priviledges.

I realise, from the tone of your post, that most of what I say is
irrelevant. You need to hear one message, and only one, at this time:
do NOT waste time trying to find a new path. Try the tutorial. If it
works, continue on with RoR programming. If not, give up and go back
to PHP, which is almost certain to work on most platforms.

PS. I'm at the "give up" stage, actually. If we measure the effort in
learning RoR as X, then the effort in learning to deploy a rails
website (not using the test server) is of order X. That is too much
pain for something so boring, and requiring so many admin priviledges
that (a) you can screw up your machine or (b) a reasonable sysadmin
will tell you to get lost.

PPS. Of course, you could go commercial. Pay someone to set up the RoR
stuff for you, on a Rails-compatible site. But of course you may not
want to start shelling out money for that until you learn whether RoR
is for you.

PPPS. All of this applies to Django, also.

I would like to program my homepage with Ruby on Rails. However, on my
homepage web server, there seem to be some restrictions:

- Scripts are only executed when they reside inside the "/cgi-bin"
directory.
- Ruby scripts must end with ".rb"; the extension ".rhtml" is not
recognized.
- I am not sure if the Rails libraries are installed. Ruby itself seems
to work though.

So, here come my questions. (First of all, I assume that I develop my
homepage as a normal Rails application, just like all the Ruby
beginner's guides tell me to.)

1. When my homepage is a regular Rails application, this would require
that I can call something like "myserver.com/appname/action" or
something - a special URL format. Is there any way that I can "map"
this to something like:
"myserver.com/cgi-bin/script.rb?appname=foo&action=bar" or so? I mean,
can I make a regular Rails application work, based on the "/cgi-bin"
script restriction? (I hope this was understandable.)

2. How do I find out if the Rails libraries are installed? (I don't
have telnet or ssh access; I can just execute ".rb" scripts per HTTP,
which I uploaded using FTP.)

I wouldn't use Rails on a host that didn't offer shell access. I'd
definately request this, and if they refuse, I'd look for a different
host.

3. If the Rails libraries are not installed, is there a simple way for
me to upload them and use them in my Ruby scripts?

4. If all of that will not work out, what would be an easy, small
change which I could request from my hoster, to make this work,
whithout requiring them to change their whole webserver?

I have one site that I host where I couldn't change the webserver
configuration, and the webserver didn't support proxing or fastcgi. I
ended up using cgi2scgi and setting up Rails with SCGI Rails Runner.
I remember having to change some Rails internals to get it to work,
but it does work, and it works well enough for a small site.

You are probably better off using a host that better supports Rails,
so I'd look into other hosts if at all possible.

PS. I'm at the "give up" stage, actually. If we measure the effort in
learning RoR as X, then the effort in learning to deploy a rails
website (not using the test server) is of order X. That is too much
pain for something so boring, and requiring so many admin priviledges
that (a) you can screw up your machine or (b) a reasonable sysadmin
will tell you to get lost.

Don't give up! Really :wink: I've been learning rails for a month or so, and
every step of the way there's a moment when I'm ready to give up. But
then somewhere there's a blog post, and I'm not the person "not getting
it". Spirits get restored, and I proceed.

I gave myself a couple of days to install an app with lighhttpd / fcgi
on textdrive.
And it was painful, but I got there - with much help from the web.

Then i came across the railsmachine gem which claims to do it all the
easy way. Have no idea how well it performs, but it was like a light at
the end of the tunnel, I could now comfort myself that:

*If* rails use continues with the same growth, many of these niggly
bits and pieces will become a lot easier. Okay, deployment is hardly
"bits and pieces", but I'd wager than in the not so distant future, there'll
be lots of helpful tools to make this (relatively) painless for a newbie.

I started out with asp 1.0 in 97 (iirc) and looking back at the kind of cr*p
I had to deal with then, and how in a few short years think radically improved,
I have confidence that rails will grow in a similar way.

The big plus for me is that the rails community are a *lot more* switched
on than their counterparts in the asp environment.

Keep looking - there's no shortage of inexpensive hosts that are knowledgeable
and helpful regarding Rails. Shameless plug: I use Site5; they have a helpful
set of forums (they use Rails internally for ticketing/account management) and
at $5/month for 55GB, it should be enough space for any small site...