Thin::Backends::AttachSocket for booting a thin server on an already open
gem install thin-attach_socket, or add
gem 'thin-attach_socket' to your
Gemfile, and run
Thin allows you to configure the backend dynamically, so using thin-attach-socket is as simple as:
require 'thin/attach_socket' Thin::Server.new(MyApp, backend: Thin::Backends::AttachSocket, socket: IO.for_fd(6))
By default thin will stop the EventMachine reactor when you stop the server, and this is
usually what you want. If you're running other servers on the reactor however, you should
preserve_reactor: true when constructing a new server, and this will not happen.
require 'thin/attach_socket' Thin::Server.new(MyApp, backend: Thin::Backends::AttachSocket, socket: IO.for_fd(6), signals: false, preserve_reactor: true)
If you do this, you need to make sure to stop the thin server before stopping the EM reactor.
thin-attach_socket is released under the Ruby License, http://www.ruby-lang.org/en/LICENSE.txt.
It was heavily based on the work of Patrick Collison at Stripe.