Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Sinatra in Bluehost
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  2 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
AnonymousCodeholic  
View profile  
 More options Jan 8 2011, 12:38 pm
From: AnonymousCodeholic <juha.myntti...@gmail.com>
Date: Sat, 8 Jan 2011 09:38:19 -0800 (PST)
Local: Sat, Jan 8 2011 12:38 pm
Subject: Sinatra in Bluehost
I just tried Sinatra the first time, because it sounded nice and I had
planned to do a smallish project that I'd normally do with Rails, but
wanted to give Sinatra a shot. Implementing the project went OK.
Thanks for a great product!

The problems started when I tried to deploy the application to
production, more accurately said to Bluehost. Bluehost supports Rails,
so it has theoretically all the pieces needed to support Sinatra.

Unfortunately, deploying wasn't so easy in practice and it took me
something like five hours to get it working. So, finally I can say
that it is possible to run Sinatra in Bluehost. There have been some
articles in Sinatra mailing list about the subject of running Sinatra
with fcgi, but they are really old. Also, in Bluehost forums there's
one post of the topic. That however, didn't work for me. So, I'm
posting my experiences to 1) announce that it is possible to get
Sinatra working in Bluehost and 2) make installing Sinatra in Bluehost
less troublesome for anybody else trying.

Here's the gem list I have in Bluehost for refenrence on what kind of
setup I got Sinatra working in Bluehost:

# gem list --local

*** LOCAL GEMS ***

actionmailer (2.3.4)
actionpack (2.3.4)
activerecord (2.3.4)
activeresource (2.3.4)
activesupport (2.3.4)
fcgi (0.8.8)
json (1.4.6)
mysql (2.8.1)
nokogiri (1.4.1)
rack (1.2.1, 1.0.1)
rails (2.3.4)
sinatra (1.1.2)
tilt (1.2.1)

Naturally, the essential gems are rack, tilt (I assume Sinatra needs
this) and rack, the rest are for my Rails stuff and my other Ruby
apps.

Unfortunately I didn't record my installation steps, so I cannot
provide with a fail-safe step-by-step guide, but I'll share what I
learned in the process and what resources I used to make the magic
happen.

There's an article in Bluehost forums with title "Sinatra
Howto" (http://www.bluehostforum.com/showthread.php?16486-Sinatra-
Howto) that is supposed to explain how to install Sinatra in Bluehost.
You should follow these instructions. They almost result in a working
setup. The thing that doesn't work is the step 5. The code includes
this line in dispatch.fcgi:

Gem.path.unshift("/home/XXXXXXX/.gem/ruby/1.8")

This just doesn't work. I spent hours debugging and I'm pretty sure
that for some reason you cannot make gem system find the local gem
directory with this approach. I could verify that it's not about e.g.
file permissions. Instead you have to do:

ENV["GEM_HOME"] = "/homeX/YYYY/ruby/gems"

I put this after the first line in the script and before the like
"require 'rubygems'".

Additionally, you need to install the fcgi gem, which at least I
didnt' have. Unfortunately "gem install fcgi" didn't work and I had to
resort article "Deploying rails app on BlueHost" in
http://penkin.co.uk/deploying-rails-app-on-bluehost/ for instruction
on how to install fcgi gem. I installed it like this:

wget http://www.fastcgi.com/dist/old/fcgi-2.2.2.tar.gz
tar -zxvf fcgi-2.2.2.tar.gz
cd fcgi-2.2.2
mkdir $HOME/src
./configure   --prefix=$HOME/src/fcgi
make && make install
gem install fcgi -r -- --with-fcgi-include=$HOME/src/fcgi/include --
with-fcgi-lib=$HOME/src/fcgi/lib

That's about it. The app should work now.

If you keep getting "Rails application failed to start properly" when
testing your app with your browser (the error message defined for HTTP
500 in .htaccess), a really valuable resource for debugging the root
cause of the error is the file /var/log/httpd/error_log. The problem
is that this file is shared by all users in the server and fills (in
my case) with crap all the time. This is not a problem, however. Just
do "less -n /var/log/httpd/error_log", hit F and do reload in your
browser and hit CTRL-C in the less command and you should see the real
error. Using this method I found e.g. that the fcgi gem was missing.

Also note that if you need to make any changes in the code
(dispatch.fcgi), you need to kill all your dispatch.fcgi processes
first.

What a pain was it get running! But anyway, I finally got my app
hosted in the hosting provider I already had contracted.

J


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Konstantin Haase  
View profile  
 More options Jan 10 2011, 6:10 pm
From: Konstantin Haase <k.ha...@finn.de>
Date: Tue, 11 Jan 2011 00:10:48 +0100
Local: Mon, Jan 10 2011 6:10 pm
Subject: Re: Sinatra in Bluehost
Thanks for sharing. The gem thing could have been eased by using bundler, though.
The book has as section about fcgi (http://sinatra-book.gittr.com/#deployment_fastcgi). Did you look at that? If so, how much of a help was it, how can it be improved?

Konstantin

On Jan 8, 2011, at 18:38 , AnonymousCodeholic wrote:


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »