Trouble deploying Radiant on a shared host

Hello all,

I’m trying to deploy Radiant on Site5’s shared hosting, but I can’t
seem to get it to go. I was wondering if anyone had any pointers on
how to try to debug this. Here’s how I have it setup:

I created a gems folder in my home, declared it my GEM_HOME in
my .bash_profile and gemhome in .gemrc (as well as prepending it to
my gempath in both places), and installed radiant without any
troubles to it. I unpacked radiant (./gems/bin/radiant --database
mysql radiant). I setup database.yml and pre-populated it with the
bootstrap script. All is gravy. A very quick test of ./script/
server shows that it’s running without any trouble at all. The
server runs Ruby 1.8.4.

But: I can’t get the cgi scripts working. I get an Apache error
500. Fast CGI repeatedly exits (with status 1) until it gets its
restart interval rolled back to 600 seconds, and then it times out
with the error: FastCGI: comm with (dynamic) server “/home/mbaumann/
public_html/test/dispatch.fcgi” aborted: (first read) idle timeout
(30 sec). And plain-jane cgi gives up the chase immediately with the
error: Premature end of script headers: /home/mbaumann/public_html/
radiant/dispatch.cgi. The scripts themselves don’t throw errors when
run via the command line (./public/dispatch.(f)cgi) – they simply
exit with status 0.

As a quick test, I quickly made a rails app (“rails foo”) and made a
simple controller (rails -v yields version 1.2.3). That worked, with
both fcgi and cgi (and fcgi was indeed faster). So I tried replacing
the public folder in the radiant install with the one from “foo”.
Same error. I tried freezing radiant (from the gem) and replacing
the vendor/radiant/vendor/rails with the frozen counterpart from the
working “foo”. Same error. Permissions seem to be set correctly (I
have a umask of 0022 and the cgi scripts run under my user), but I
tried chmod’ing the entire install to 755. Same error. I tried
mucking around to my wits end in the public folder, reinstalling,
retesting, reinstalling… same error. I’ve looked around at all the
guides to deploying on shared hosts, trying all their debugging tips,
and I get the same error. I’ve searched through the mailing list
archives, but nothing there, either.

I’ll file a ticket with Site5, too, but to be honest, from my (naive)
perspective, it really looks like it’s a problem on Radiant’s side of
things. I’ve posted on the discussion board to no avail , but there
are other users there running the mental release candidates without
troubles. Is the Mental RC1 revision still available? I can test
freezing to that revision (if I get the number) since I know that’s
worked for another Site5 user.

Sorry for the terribly long email… but I’m really flummoxed at this
point. Any ideas on how to further debug this? Or ways of
convincing Site5 that it’s really their problem?
Thanks!
Matt

I am actually able to get Radiant to run with no trouble at all on my
Site5 account. Firstly, you don’t have to run script/server since you
are running fastcgi. just point to the site and it should kick in. It
looks as though you are running in a subdirectory too, and that would
mean you have to declare your home directory in the application. (You
could also set up a 3rd level domain.) Another thing that has caused
me annoyance in the past is the line endings in my database.yml file.
Make sure they are unix line endings and not windows ones.


Al Steffen

It looks as though you are running in a subdirectory too, and that
would
mean you have to declare your home directory in the application. (You
could also set up a 3rd level domain.)

Where (and how) do I set the home directory? I installed it to ~/
radiant/ and created a symbolic link in public_html that points to
the public folder. I’ve also tried installing radiant directly into
public_html, making a domain pointer to the public directory, as well
as making public_html itself a symbolic link to ~/radiant/public.
None of which worked.

I really wasn’t running ./script/server – I was just frustrated
trying to get fcgi working and wanted to make sure that the app
actually worked (I realize it’s a big no-no on a shared box).

Matt

Thanks for the links, Mohit. I bookmarked that wiki – it looks like
a good source of info. Unfortunately, it wasn’t the magic potion for
me this time.

I’ve done a bit more playing around and trying to narrow down the
candidates for failure. It can’t be the database, any of the non-cgi
config files, or ruby itself – the app works from ./script/server.
The cgi scripts all point to ruby correctly, and are identical to a
working rails app. I really don’t think my .gemrc or
my .bash_profile are screwed up… both have correct directories for
the gem path and home.

Does Radiant have any gem dependencies (or other external
dependencies)? What are they? Could one of those on my server be
out of date? The fcgi gem is version 0.8.7 – that’s the latest one.

***Ooh, dropping into ./script/console throws an error: /home/
user_name/gems/gems/radiant-0.6.0/vendor/rails/activerecord/lib/…/…/
activesupport/lib/active_support/dependencies.rb:263:in
`load_missing_constant’:NameError: uninitialized constant
ActionController::Assertions::ResponseAssertions

Here’s the (condensed) output of gem list, for what it’s worth:

BlueCloth (1.0.0)
id3lib-ruby (0.5.0)
radiant (0.6.0)
shipping (1.5.0)
xml-simple (1.0.11)
Thanks again for your help!
Matt

Matt B. wrote:

as making public_html itself a symbolic link to ~/radiant/public.
None of which worked.

I really wasn’t running ./script/server – I was just frustrated
trying to get fcgi working and wanted to make sure that the app
actually worked (I realize it’s a big no-no on a shared box).

Matt

Hi Matt

This doesn’t directly answer your question, but I find the
RailsPlayground guides very useful whenever I deploy. (I use their
service as well as another one, and the guide basically applies to
both).

This is the one about using Rails:
http://wiki.railsplayground.com/railsplayground/show/How+To+Use+Rails+at+RailsPlayground

and this is one about using FCGI:
http://wiki.railsplayground.com/railsplayground/show/How+To+use+FastCGI

Follow the 2 in sequence.
Hope this helps you.
Cheers
Mohit.

Haha! I figured it out last night. I simply needed to add the
following two lines to my environment.rb file:

ENV[‘GEM_PATH’] = ‘/home/username/gems:/usr/lib/ruby/gems/1.8’
ENV[‘HOME’] = ‘home/username’

I wrote up the complete instructions that I used to get it working on
the wiki. I hope this helps those of you trying to install on
Site5. (I imagine it should work with many other shared hosts, too
– nothing is too proprietary.)

Matt