Skip to content

Latest commit

 

History

History
61 lines (35 loc) · 1.71 KB

README.rdoc

File metadata and controls

61 lines (35 loc) · 1.71 KB

Proxy

A simple, balanced proxy server which forwards requests to a backend / another proxy.

Usage overview

Start the proxy with command:

$ bundle exec bin/medusa start --ontop

Now connect to the internet via forwarded proxy:

$ curl --proxy1.0 localhost:9999 "http://example.com"

or use the provided script, which sends multiple requests in one go:

$ ruby clients.rb

and watch the colorized traffic flowing in your terminal.

Installation

You need the Bundler gem:

$ bundle install

Usage in production

The application contains an executable script which runs the server in the background, saves a PID file and logs output.

First, provide the application with an URL to a list of backend proxies, bind hostname and port:

$ cp config/config.example.rb config/config.rb
$ vim config/config.example.rb

Then start the server (be sure to use the ‘bundle exec` command, to resolve dependencies):

$ bundle exec bin/medusa start -- production

Check that the server is running correctly:

$ ls -l log/medusa.pid
$ tail log/medusa.output
$ ps ax | grep medusa

You can monitor the service as you wish based on the PID file.

A “deathrow” check is performed in Backend.select. The URL of selected proxy is checked against medusa>backends>deathrow set in Redis. You are responsible for checking the status of proxies and adding/removing them into this set:

$ redis-cli
> sadd medusa>backends>deathrow http://127.0.0.1:3000
> smembers medusa>backends>deathrow
> srem medusa>backends>deathrow http://127.0.0.1:3000

TODO:

  • Save “total” stats to Redis asynchronically

  • Create frontend web application with EventMachine and WebSockets to monitor the server