• Stars
    star
    102
  • Rank 333,415 (Top 7 %)
  • Language
    Ruby
  • License
    MIT License
  • Created about 12 years ago
  • Updated over 8 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

A proxy server for on-demand socket applications
       _____
      (, /   ) ,          /)          /)
        /__ /   __   _   //  _  _   _(/  _  __
     ) /   \__(_/ (_(_/_(/__(/_(_(_(_(__(/_/ (_
    (_/            .-/
                  (_/

Ringleader is an application proxy for socket applications.

Is it any good?

Yes.

What's it for?

I designed this for a large suite of apps running behind nginx with a somewhat complex routing configuration. Additionally, many of the apps required active resque pollers to run properly. Ultimately this meant having many terminal windows open just to make a few requests to the apps. Instead, I wanted something to manage all that for me.

Before, each app in a terminal, started manually:

                                +-------+
                             +->| app 1 |
                             |  +-------+
              +-----------+  |
  http        |           |  |  +-------+
requests ---> |   nginx   +--+->| app 2 |
              |           |  |  +-------+
              +-----------+  |
                             |  +-------+
                             +->| app n |
                                +-------+

After, apps managed by ringleader, started on demand:

                                                    +-------+
                                                 +->| app 1 |
                                                 |  +-------+
              +-----------+    +--------------+  |
  http        |           |    |              |  |  +-------+
requests ---> |   nginx   +--->|  ringleader  +--+->| app 2 |
              |           |    |              |  |  +-------+
              +-----------+    +--------------+  |
                                                 |  +-------+
                                                 +->| app n |
                                                    +-------+

Ringleader gives on-demand startup and proxying for any TCP server program. It can be a rails app managed with foreman, a node app, or simply a shell command to start netcat.

Isn't this just like inetd?

Pretty much. But with pretty colors in console and a nice web interface.

Web interface?

Yep. Hook it up with fluid and put it in the menu bar. By default it runs at http://localhost:42000.

screenshot of ringleader control panel

Installation

$ gem install ringleader
$ ringleader --help

Configuration

Ringleader requires a yml configuration file to start. It should look something like this:

---
# name of app (used in logging)
main_app:

  # Required settings
  dir: "~/apps/main"       # Working directory
  command: "foreman start" # The command to run to start up the app server.
                           # Executed under "bash -c".
  server_port: 3000        # The port ringleader listens on
  app_port: 4000           # The port the application listens on

  # Optional settings
  host: 127.0.0.1          # The host ringleader should listen on
  idle_timeout: 6000       # Idle timeout in seconds, 0 for infinite
  startup_timeout: 180     # Application startup timeout
  disabled: true           # Set the app to be disabled when ringleader starts
  env:                     # Override or set environment variables inherited
    FOO: hello             # from the current environment. Use nil to unset a
    BAR: nil               # var.
  kill_with: INT           # Signal to use to kill the process tree with. Use
                           # TERM or KILL if the default is leaving zombies.
  run_on_load: false       # Set this to true to start an app when ringleader
                           # loads.

  # If you have an application managed by rvm, this setting automatically adds
  # the rvm-specific shell setup before executing the given command. This
  # supersedes the `command` setting.
  rvm: "foreman start"

  # Likewise for rbenv:
  rbenv: "foreman start"

  # And chruby:
  chruby: "foreman start"

other_app:
  [...]

Known issues

Too many open files - pipe (Errno::EMFILE)

You may get this error if you have a high number of projects in your ringleader file. It happens because Celluloid::IO is trying to opens more file descriptors that your OS allows. This number is different for each version of SO and you can check it running ulimit -a.

You can increase the maximum number of open file descriptors using the ulimit -n NUMBER. Currently I'm using ulimit -n 1024 with a huge ringleader file.

If you are using OS X check it.

License

MIT, see LICENSE.

Top hat icon by Luka Taylor under a Creative Commons Attribution/Non-commercial license.

Contributing

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request

More Repositories

1

launched

A launchd.plist generator app. Because making them by hand is so very difficult.
Go
234
star
2

camper_van

A Campfire to IRC bridge
Ruby
129
star
3

vim-copy-as-rtf

Copy syntax-highlighted code from vim to the OS X clipboard as RTF text
Vim Script
124
star
4

rack-streaming-proxy

Streaming proxy for Rack, the rainbows to Rack::Proxy's unicorn
Ruby
91
star
5

jps-explained

Code for a "Jump Point Search, Explained" post on zerowidth.com
CoffeeScript
68
star
6

golem

minecraft beta proxy ยท no longer maintained
Ruby
27
star
7

zoom-calendar.alfredworkflow

Alfred workflow to open Zoom meetings from your calendar
Ruby
25
star
8

lucene_query_parser

Basic Lucene query parser and syntax checker for Ruby
Ruby
17
star
9

dotfiles

dotfiles
Vim Script
15
star
10

gh-shorthand

go program to generate alfred autocomplete items from shorthand input
Go
15
star
11

gh-shorthand.alfredworkflow

GitHub shorthand Alfred workflow
Shell
12
star
12

toml-parslet

Ruby TOML parsing library using Parslet. Written as an learning / teaching exercise for a series of blog posts
Ruby
12
star
13

vimfiles

My personal collection of vim settings
11
star
14

tire_swing

Simple node and visitor definitions for Treetop grammars
Ruby
10
star
15

iphone_data

A script to dump data from an iPhone's sync backup files
Ruby
9
star
16

hansel

Pathfinding experiments and visualization with Clojure and D3
Clojure
7
star
17

gh-shorthand-backend

RPC backend for gh-shorthand Alfred workflow
Ruby
6
star
18

asteroids

If you wish to play asteroids, you must first invent the universe.
CoffeeScript
6
star
19

gh-md

gh-cli extension to create markdown links and issue references
Go
5
star
20

configurable

Easy configuration setup and loading for Ruby modules
Ruby
4
star
21

jetlag

AR timezone fixes for 2.3.x
Ruby
4
star
22

zerowx

Mobile web app for displaying current and predicted conditions for your neighborhood
JavaScript
3
star
23

raycast-github-shorthand

GitHub Shorthand Raycast Extension
TypeScript
3
star
24

vim-bgtags

A vim plugin for generating and maintaining ctags in the background.
Vim Script
3
star
25

wordfinda

word finding game / js command proof of concept
JavaScript
2
star
26

stupidawesome

stupid awesome dot com
JavaScript
2
star
27

advent

Advent of Code solutions
Ruby
2
star
28

bogglebot

A boggle game IRC bot
Ruby
2
star
29

craft-markdown-export

A pile of "good enough" Craft to Obsidian markdown export scripts
Ruby
2
star
30

asteroids.cljs

ClojureScript version of asteroids with physics, see also:
Clojure
2
star
31

ringleader-clj

first attempt at https://github.com/aniero/ringleader using clojure
Clojure
1
star
32

rsolr-patron

RSolr extention to enable patron http client instead of the default, net/http.
Ruby
1
star
33

raycast-datadog

Raycast extension for Datadog dashboard quick access
TypeScript
1
star
34

bogglehax

A bot to cheat at playing an IRC-based boggle game
Ruby
1
star
35

irc

An irc library (with the beginnings of a web-based irc client) written in 2006
Ruby
1
star
36

neoclock

ATtiny84 firmware and PCB for neoclock project
C
1
star