About Unicorn Rack handler
normalperson at yhbt.net
Thu Nov 5 18:19:24 EST 2009
"Lin Jen-Shin (aka godfat 真常)" <godfat at godfat.org> wrote:
> 2009/11/5 Eric Wong <normalperson at yhbt.net>:
> > As I explained in the other email, this unfortunately can't ever give
> > you all the features that Unicorn has.
> > I've made an effort to keep everything else as compatible and the
> > migration paths as easy as possible.
> Many, many thanks for your effort on Unicorn.
> It's awesome, in all ways. I would switch all services
> at my working place to Unicorn at some point.
Cool, good to know :)
> > Can you try and see if the USR2 handling of Unicorn allows
> > a transparent upgrade here? If it doesn't then I don't think
> > it's worth supporting an interface that's crippled compared
> > to using the plain `unicorn' command.
> I think it does work. This is start.rb:
> #!/usr/bin/env ruby
> require File.expand_path('app', File.dirname(__FILE__))
> require 'unicorn'
> Rack::Handler.register('unicorn', 'Unicorn')
> Ramaze.start(:adapter => 'unicorn', :port => 7000)
> It won't work if I invoke start.rb like this:
> $ ruby start.rb
> (perhaps it's impossible to get the `ruby' ?)
> but it does work if I invoke this way:
> $ ./start.rb
> (tested with different debug output in lib/unicorn.rb)
Yeah, running "ruby start.rb" throws off $0 unless start.rb is in $PATH.
"ruby ./start.rb" should work, too, but it's ugly. I think there
are/were cases where "#!/usr/bin/env ruby" won't even work as a shebang,
> On the other hand, `ramaze' command won't work,
> and I guess it's because it uses `rackup', which
> you've explained why it won't.
> I am wondering.. Could `rackup' be fixed for this?
> For instance, use the same way as `unicorn' in `rackup'?
> If so, I would be glad to try to fix that in rackup.
> I would try it later in my free time.
It would require `rackup' to do a "require 'unicorn'" before it does any
option parsing. That would be unnecessarily intrusive if one has
Unicorn installed but wants to test with a different server.
More information about the mongrel-unicorn