Adds Thin::Backend::AttachSocket for running thin behind einhorn
Switch branches/tags
Nothing to show
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.

Provides Thin::Backends::AttachSocket for booting a thin server on an already open Socket.

This is useful when running thin inside einhorn, and it requires either a recent eventmachine gem (1.0.4 and up implement the required functions), or eventmachine-le.


Either gem install thin-attach_socket, or add gem 'thin-attach_socket' to your Gemfile, and run bundle.


Thin allows you to configure the backend dynamically, so using thin-attach-socket is as simple as:

require 'thin/attach_socket',
                 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 pass preserve_reactor: true when constructing a new server, and this will not happen.

require 'thin/attach_socket',
                 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,

It was heavily based on the work of Patrick Collison at Stripe.