No commit activity in last 3 years
No release in over 3 years
This is useful for running thin behind einhorn, and requires a recent eventmachine
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Runtime

>= 0
 Project Readme

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.

Installation

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

Usage

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 pass 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.

Meta-foo

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.