Thanks for sharing. The gem thing could have been eased by using bundler, though.
). Did you look at that? If so, how much of a help was it, how can it be improved?
> 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 received this message because you are subscribed to the Google Groups "sinatrarb" group.
> To post to this group, send email to sinatrarb@googlegroups.com.
> To unsubscribe from this group, send email to sinatrarb+unsubscribe@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/sinatrarb?hl=en.