Ruby BERTRPC server based on Unicorn
Перейти к файлу
Ryan Tomayko 52b2cfd159 Update README for config/ernicorn.rb changes 2012-06-23 06:50:16 -07:00
examples Add --listen option, better default handling 2012-06-23 06:40:28 -07:00
lib Don't exit worker on immediate connection close 2012-06-23 06:40:28 -07:00
script ernicon-ctrl uses port 8149 by default 2012-06-23 06:50:16 -07:00
test Get rid of auto_start entirely 2012-06-23 06:40:28 -07:00
.gitignore Ignore .bundle, vendor, bin 2012-06-23 03:31:19 -07:00
Gemfile Add Gemfile 2012-06-23 03:31:19 -07:00
Gemfile.lock Add Gemfile 2012-06-23 03:31:19 -07:00
LICENSE Add tmm1 to LICENSE 2012-06-23 03:31:19 -07:00
README.md Update README for config/ernicorn.rb changes 2012-06-23 06:50:16 -07:00
Rakefile Take Rakefile down to almost nothing 2012-06-23 03:31:19 -07:00
ernicorn.gemspec v1.0.1 2012-06-23 06:40:28 -07:00

README.md

Ernicorn

A BERT-RPC server based on Ernie's Ruby interface but that uses Unicorn for worker process management.

Ernicorn supports BERT-RPC call and cast requests. See the full BERT-RPC specification at bert-rpc.org for more information.

Like Ernie before it, Ernicorn was developed at GitHub and is currently in production use serving millions of RPC requests every day.

Installation

$ gem install ernicorn

Starting The Server

Use the ernicorn command to start a new RPC server:

$ ernicorn --help
Usage: ernicorn [options] [config file]
Start a Ruby BERT-RPC Server with the given options and config file.

Options
  -h, --host=<host>          Server address to listen on; default: 0.0.0.0
  -p, --port=<portno>        Server port to listen on; default: 8149
  -l, --listen=<host>:<port> Listen addresses. Can be specified multiple times
      --log-level=0-4        Set the log level
  -d, --detached             Run as a daemon
  -P, --pidfile=<file>       Location to write pid file

The ernicorn server attempts to load the config file given or config/ernicorn.rb when no config file is specified. See the example config file examples/config.rb to get started. All Unicorn config options are supported.

The config file should require any libraries needed for the server and register server modules with Ernicorn.expose(:modulename, TheModule). See the examples/handler.rb file for a simple example handler.

Control Commands

The ernicorn-ctrl command can be used to send various control and informational commands to the running server process:

$ ernicorn-ctrl --help
Usage: ernicorn-ctrl [-p <port>] <command>
Issue a control command to an ernicorn server. The port option is used to
specify a non-default control port.

Commands:
  reload-handlers         Gracefully reload all handler processes.
  stats                   Dump handler stats for the server.
  halt                    Shut down.

Ernicorn servers also support most Unicorn signals for managing worker processes and whatnot. See the SIGNALS file for more info.

Development

The script/bootstrap command is provided to setup a local gem environment for development.

$ script/bootstrap

It installs all gems under vendor/gems and creates binstubs under a bin directory. This is the best way to get setup for running tests and experimenting in a sandbox.