views:

122

answers:

2

I'm trying to write a Sinatra app that will run on a shared Passenger server. For now, I'd be happy just getting a "hello world", but something isn't working quite right. I have:

config.ru

require 'vendor/sinatra-lib/sinatra.rb'
set :environment, :production
disable :run

require 'myapp.rb'
run Sinatra::Application

myapp.rb

get '/' do
  "Hello world!"
end

and of course all the support libs I need for sinatra are under /vendor/sinatra-lib. I can rackup this exact load on my local machine, and it runs like a champ. However, on the remote machine, I get 0-byte responses for any URL I try to visit. Note that I have a /public directory, and I can view pages out of that successfully, so I guess Rack is still responding. Also, I can run a basic Rack app without any problems, so Rack must be configured correctly (at least, correctly for running Rack apps).

At this point, the only thing I can think of is to check the version of Rack, etc, on the remote server. I don't have full control over the box, so I don't really have log output to share. I can try to chase it down, if it's important, but I'm hoping something will jump out at somebody.

A: 

I think the problem is that the other sinatra files isn't in the load dir. Try to rename vendor/sinatra-lib into vendor/sinatra, and if it still doesn't work, try to add this in the top of your config.ru, in stead of require 'vendor/...'

$: << 'vendor/sinatra'
require 'sinatra'

A little side note: You are not required to pass the file extension (.rb) to require, so you could do require 'myapp' instead of require 'myapp.rb'.

dvyjones
I'll give it a shot and get back to you. Thanks!
Coderer
A: 

Thank you all for playing, turned out to be a dependency issue -- the server I was deployed to was running a version of Rack that was too old to support Sinatra. Lots of good other stuff to think about, though.

Coderer