#30 ✓resolved
Alex MacCaw

Using Thin with a framework other than Rails.

Reported by Alex MacCaw | February 1st, 2008 @ 05:37 AM | in 0.6.3

Although Thin uses Rack, and so has the ability to work with lots of different frameworks (merb, rails, camping etc), but can only use the rails adapter since this is hard coded in the bin/thin file:

server.app = Rack::Adapter::Rails.new(options.merge(:root => options[:chdir]))

Is it possible that the adapter used could be overrided in a config option? Is this a good idea?

Comments and changes to this ticket

  • macournoyer

    macournoyer February 1st, 2008 @ 10:11 AM

    • State changed from “new” to “open”
    • Milestone set to 0.7.0

    the problem is that there's no convention as to how to initialize an adapter. Some require that your load the app first (Camping) and some do all the work of loading the app (Rails) and none take the same arguments also.

    What I could do though is take a Rack config.ru file as an argument and load that file instead of the adapter like the Rack rackup command does.

    What frameowkr did you want to server w/ thin script?

  • Alex MacCaw

    Alex MacCaw February 1st, 2008 @ 10:59 AM

    I wanted to use my own custom framework. I ended up duplicating bin/thin and replacing that line. I think the option to load a rack config file would be a good idea, defaulting back to Rails if it can't be found.

  • macournoyer

    macournoyer February 6th, 2008 @ 12:48 AM

    • State changed from “open” to “resolved”
    • Milestone changed from 0.7.0 to 0.6.3

    it's on git now:

    Add the --rackup option to load a Rack config file instead of the Rails adapter.

    So you can use any framework with the thin script and start cluster and stuff like that.

    A Rack config file is one that is usable through the rackup command and looks like this:

    use Rack::CommonLogger
    run MyCrazyRackAdapter.new(:uterly, 'cool')
    

    Then use it with thin like this:

    thin start --rackup config.ru
    

    Thx a lot for the suggestion Alex!

Please Sign in or create a free account to add a new ticket.

With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.

New-ticket Create new ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile ยป

People watching this ticket

Pages