github
Advanced Search
  • Home
  • Pricing and Signup
  • Explore GitHub
  • Blog
  • Login

mojombo / ernie

  • Admin
  • Watch Unwatch
  • Fork
  • Your Fork
  • Pull Request
  • Download Source
    • 160
    • 11
  • Source
  • Commits
  • Network (11)
  • Issues (1)
  • Downloads (13)
  • Wiki (1)
  • Graphs
  • Branch: master

click here to add a description

click here to add a homepage

  • Branches (2)
    • master ✓
    • supernie
  • Tags (13)
    • v1.3.0
    • v1.2.0
    • v1.1.0
    • v1.0.0
    • v0.4.0
    • v0.3.5
    • v0.3.4
    • v0.3.3
    • v0.3.2
    • v0.3.1
    • v0.3.0
    • v0.2.0
    • v0.1.0
Sending Request…
Enable Donations

Pledgie Donations

Once activated, we'll place the following badge in your repository's detail box:
Pledgie_example
This service is courtesy of Pledgie.

Ernie is an Erlang/Ruby BERT-RPC Server. — Read more

  cancel

  cancel
  • Private
  • Read-Only
  • HTTP Read-Only

This URL has Read+Write access

Regenerated gemspec for version 1.3.0 
mojombo (author)
Mon Nov 30 13:51:54 -0800 2009
commit  fda943f82ec1ab12312b7302618406b379e63d3d
tree    50159c793ea245c24916ff06e828cca7edbd8c61
parent  989c0d150d4d1ced55770abcf9d077b2f47252e6
ernie /
name age
history
message
file .document Mon May 18 16:40:10 -0700 2009 add tests and unify cli [Tom Preston-Werner]
file .gitignore Mon May 18 18:38:26 -0700 2009 add erlang build stuff [Tom Preston-Werner]
file History.txt Mon Nov 30 13:51:16 -0800 2009 Version bump to 1.3.0 [Tom Preston-Werner]
file LICENSE Mon May 18 16:40:10 -0700 2009 add tests and unify cli [Tom Preston-Werner]
file README.md Mon Nov 30 13:22:25 -0800 2009 Merge commit 'rtomayko/auto_start' Conflicts: ... [Tom Preston-Werner]
file Rakefile Wed Oct 28 17:08:05 -0700 2009 remove dependency on erlectricity [Tom Preston-Werner]
file VERSION.yml Mon Nov 30 13:51:16 -0800 2009 Version bump to 1.3.0 [Tom Preston-Werner]
directory bin/ Thu Aug 20 16:57:00 -0700 2009 add stats introspection [Tom Preston-Werner]
directory ebin/ Mon May 18 16:15:19 -0700 2009 add handler cli param and fix up to actually work [Tom Preston-Werner]
directory elib/ Sun Nov 22 23:18:21 -0800 2009 remove internal port wrapper timeout [Tom Preston-Werner]
file ernie.gemspec Mon Nov 30 13:51:54 -0800 2009 Regenerated gemspec for version 1.3.0 [Tom Preston-Werner]
directory examples/ Mon Nov 30 13:06:13 -0800 2009 better logging granularity [Tom Preston-Werner]
directory ext/ Mon May 18 18:38:26 -0700 2009 add erlang build stuff [Tom Preston-Werner]
directory lib/ Mon Nov 30 13:22:25 -0800 2009 Merge commit 'rtomayko/auto_start' Conflicts: ... [Tom Preston-Werner]
directory test/ Mon Nov 30 13:22:25 -0800 2009 Merge commit 'rtomayko/auto_start' Conflicts: ... [Tom Preston-Werner]
README.md

Ernie

By Tom Preston-Werner (tom@mojombo.com)

Ernie is a BERT-RPC server implementation that uses an Erlang server to accept incoming connections, and then delegates the request to Ruby handlers.

See the full BERT-RPC specification at bert-rpc.org.

Ernie currently supports the following BERT-RPC features:

  • call requests
  • cast requests

Ernie was developed for GitHub and is currently in production use serving millions of RPC requests every day. The stability and performance have been exemplary.

Installation

You must have Erlang installed before installing Ernie.

$ gem install ernie -s http://gemcutter.org

Running

Usage: ernie [command] [options]
    -h, --handler HANDLER            Handler file
    -p, --port PORT                  Port
    -n, --number NUMBER              Number of handler instances
    -d, --detached                   Run as a daemon
    -P, --pidfile PIDFILE            Location to write pid file.

Commands:
  <none>                Start an Ernie server.
  reload-handlers       Gracefully reload all of the the ruby handlers
                        and use the new code for all subsequent requests.
  stats                 Print a list of connection and handler statistics.

Examples:
  ernie -d -p 9999 -n 10 -h calc.rb
    Start the ernie server in the background on port 9999 with ten
    handlers, using the calc.rb handler file.

  ernie reload-handlers -p 9999
    Reload the handlers for the ernie server currently running on
    port 9999.

Example Handler

Using a Ruby module and Ernie.expose:

require 'ernie'

module Calc
  def add(a, b)
    a + b
  end
end

Ernie.expose(:calc, Calc)

Using the DSL (this will be deprecated in a future release):

require 'ernie'

mod(:calc) do
  fun(:add) do |a, b|
    a + b
  end
end

Logging

You can have logging sent to a file by adding these lines to your handler:

logfile('/var/log/ernie.log')
loglevel(Logger::INFO)

This will log startup info, requests, and error messages to the log. Choosing Logger::DEBUG will include the response (be careful, doing this can generate very large log files).

Autostart

Normally Ernie handlers will become active after the file has been loaded in. you can disable this behavior by setting:

Ernie.auto_start = false

Example BERT-RPC call for above example

-> {call, calc, add, [1, 2]}

<- {reply, 3}

Using the BERTRPC gem to make calls to Ernie

You can make BERT-RPC calls from Ruby with the BERTRPC gem:

require 'bertrpc'

svc = BERTRPC::Service.new('localhost', 8000)
svc.call.calc.add(1, 2)
# => 3

Contribute

If you'd like to hack on Ernie, start by forking my repo on GitHub:

http://github.com/mojombo/ernie

To get all of the dependencies, install the gem first. To run ernie from source, you must first build the Erlang code:

rake ebuild

The best way to get your changes merged back into core is as follows:

  1. Clone down your fork
  2. Create a topic branch to contain your change
  3. Hack away
  4. Add tests and make sure everything still passes by running rake
  5. If you are adding new functionality, document it in the README.md
  6. Do not change the version number, I will do that on my end
  7. If necessary, rebase your commits into logical chunks, without errors
  8. Push the branch up to GitHub
  9. Send me (mojombo) a pull request for your branch

Copyright

Copyright (c) 2009 Tom Preston-Werner. See LICENSE for details.

Blog | Support | Training | Contact | API | Status | Twitter | Help | Security
© 2010 GitHub Inc. All rights reserved. | Terms of Service | Privacy Policy
Powered by the Dedicated Servers and
Cloud Computing of Rackspace Hosting®
Dedicated Server