views:

1006

answers:

1

Hi All,

I'm a newcomer trying to get my feet wet with Ruby and Sinatra. I followed the Slicehost articles in getting Ruby 1.9.1 setup along with Thin 1.2.7 with a reverse proxy to Nginx.

Most things were going pretty smooth until I tried to start up my thin server.

This is the output I get from my logs:

$ sudo thin -C config.yml -R config.ru start
  /home/user/public_html/testapp/config.ru:9:in `block in <main>': undefined method `application' for Sinatra:Module (NoMethodError)
    from /var/lib/gems/1.9.1/gems/rack-1.1.0/lib/rack/builder.rb:46:in `instance_eval'
    from /var/lib/gems/1.9.1/gems/rack-1.1.0/lib/rack/builder.rb:46:in `initialize'
    from /home/user/public_html/testapp/config.ru:1:in `new'
    from /home/user/public_html/testapp/config.ru:1:in `<main>'
    from /var/lib/gems/1.9.1/gems/thin-1.2.7/lib/rack/adapter/loader.rb:36:in `eval'
    from /var/lib/gems/1.9.1/gems/thin-1.2.7/lib/rack/adapter/loader.rb:36:in `load'
    from /var/lib/gems/1.9.1/gems/thin-1.2.7/lib/thin/controllers/controller.rb:175:in `load_rackup_config'
    from /var/lib/gems/1.9.1/gems/thin-1.2.7/lib/thin/controllers/controller.rb:65:in `start'
    from /var/lib/gems/1.9.1/gems/thin-1.2.7/lib/thin/runner.rb:177:in `run_command'
    from /var/lib/gems/1.9.1/gems/thin-1.2.7/lib/thin/runner.rb:143:in `run!'
    from /var/lib/gems/1.9.1/gems/thin-1.2.7/bin/thin:6:in `<top (required)>'
    from /usr/bin/thin:19:in `load'
    from /usr/bin/thin:19:in `<main>'

I can post my config.yml, config.ru and myapp.rb, where my Sinatra code resides (it's basically the sample code ripped from the top of the Sinatra book), if anyone needs to see it, but if you have any ideas on what's going on based on that log itself, I'd appreciate it, as I couldn't find anything on the world wide Google.

Also, is this still the preferred way of running Sinatra on thin?

I can get the app working with just running it through Ruby itself:

$ ruby myapp.rb 
  == Sinatra/1.0 has taken the stage on 4567 for development with backup from Thin

This allows me to see my pages in my sandbox.

Thank you, all.

+1  A: 

Any time you have an issue and are wondering if it could be related to 1.8 vs 1.9, check the following site:

http://isitruby19.com/thin

Michael Kohl