Running Ruby Cammping app?

software development

#1

Anybody running Ruby Camping apps on Dreamhost?

I have a very small Ruby Camping app that I would like to run on Dreamhost. So it would be great if anybody could point to some instructions of what I need to do.


#2

Please don’t double-post. You only need to ask a question once.


si-blog | Keystone Websites
Save $97 on yearly plans with promo code [color=#CC0000]SCJESSEY97[/color]


#3

Sorry i was hoping i could delete the other one, cause I thought it was more appropriate in ‘Programming’


#4

To start answering my own question - this should get me started - http://code.whytheluckystiff.net/camping/wiki/TheCampingServerForApache


#5

Right that didn’t help :frowning:

I created a .htaccess and a dispatch.rb file. But if I just try running the dispatch file from the command line i get the following error.

/usr/local/lib/site_ruby/1.8/rubygems.rb:301:in `report_activate_error’: Could not find RubyGem markaby (>= 0.5) (Gem::LoadError)

So it looks like Dreamhost doesn’t have everything installed for Camping to run


#6

You could try setting up a local gem repository, or even simpler copy the gem into your “vendor/plugins” folder. I used the latter to allow my app to use the “pdf/writer” gem.

rodney


#7

In fact my problems are before even trying to load camping.

I have a .htaccess file which directs Apache to dispatch.fcgi

But i get this error in the logs:

[Tue Jun 05 11:15:35 2007] [error] [client 78.146.XXX.XXX] FastCGI: comm with (dynamic) server “/home/XXX/XXX.dreamhosters.com/dispatch.fcgi” aborted: (first read) idle timeout (60 sec)
[Tue Jun 05 11:15:35 2007] [error] [client 78.146.XXX.XXX] FastCGI: incomplete headers (0 bytes) received from server “/home/XXX/XXX.dreamhosters.com/dispatch.fcgi”


#8

Did you manage to get “dispatch.fcgi” to run from the command-line successfully? If that doesn’t work, Apache will not be able to run it either, which would explain the error.

rodney


#9

If I run it at the command line i get the error about the missing markaby dependency. So i have given up for the moment on ‘camping’ (i have reported the missing gem to Dreamhost Support, so hopefully that can be added in the future).

Firstly, just want to get the .htaccess & dispatch.fcgi bit actually running correctly. I then I can investigate installing my own gems. To test I went for a simply dispatch.fcgi as follows …

(will post it in a mo)


#10

Right this is far more effort than I would of hoped, but at least some progress is being made.

First I had to install my on RubyGems system following http://wiki.dreamhost.com/index.php/RubyGems

This didn’t work initially, but i think the last thing I changed was use the .bash_profile line from the second instructions (i.e. echo ‘export GEM_PATH="$GEM_HOME:/usr/lib/ruby/gems/1.8"’ >> .bash_profile)

With that working, I installed the camping. Again this didn’t work straight away (I will try to remember what I did to get it working later)

Now I created my dispatch.fcgi file along the lines of the one described at http://code.whytheluckystiff.net/camping/wiki/TheCampingServerForApache however instead of a path I used ‘current’ which I saw in another example …

Camping::Models::Base.establish_connection :adapter => sqlite3’, :database => File.expand_path(current + ‘/camping.db’)
Camping::FastCGI.serve File.expand_path(current)

Then I moved onto the .htaccess file. I am using …

General Apache options

AddHandler fastcgi-script .fcgi
Options +FollowSymLinks +ExecCGI

Redirect all requests not available on the filesystem to Rails

By default the cgi dispatcher is used which is very slow

RewriteEngine On
RewriteRule ^$ index.html [QSA]
RewriteRule ^([^.]+)$ $1.html [QSA]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ dispatch.fcgi [QSA,L]

In case Rails experiences terminal errors

Instead of displaying this message you can supply a file here which will be rendered instead

Example:

ErrorDocument 500 /500.html

ErrorDocument 500 “

Application error

Camping application failed to start properly”

But now when I try view the site I get the error message and in my error logs I get …

[Thu Jun 07 15:04:59 2007] [error] [client 89.xxx.xxx.xxx] mod_rewrite: maximum number of internal redirects reached. Assuming configuration error. Use ‘RewriteOptions MaxRedirects’ to increase the limit if neccessary.


#11

Looks like I might have an error in my .htaccess file. I will have to give this a read http://www.sitepoint.com/print/mod_rewrite-no-endless-loops