Skip to content

ncode/hot-potato-router

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

HPR - Hot Potato Router

######## dynamic reverse proxy

How it works?

HPR receives a connection from interwebs, looks for http backends on Redis for a given vhost and proxy the connection among all backends.

Config:

hpr.conf

hpr:
  http_addr: :80                 # bind address
  https_addr:                    # https_addres
  cert_file:                     # cert file for https
  key_file:                      # key file for https
  probe_interval: 50             # seconds between probes
  db_backend: redis              # backend type

redis:
  server_list: 127.0.0.1:6379    # list of redis servers to connect

Instalation:

Building

$ git clone https://github.com/ncode/hot-potato-router.git
$ cd hot-potato-router
$ go get -v .
$ make build
$ hpr

Packaging on Debian and Ubuntu

$ apt-get install golang
$ git clone https://github.com/ncode/hot-potato-router.git
$ cd gogix hot-potato-router
$ dpkg-buildpackage -us -uc -rfakeroot
$ /etc/init.d/hot-potato-router start

Cli:

hprctl

$ hprctl -h
Hot Potato Router Control

Usage:
  hprctl add <vhost> <backend_ip:port> [--weight=<n>]
  hprctl del <vhost> <backend_ip:port> [--weight=<n>]
  hprctl show <vhost>
  hprctl list

Args:
  add           add a new vhost and backend
  dell          del a vhost and a backend
  show          show all backends from a given vhost
  list          list all vhosts

Options:
  -h --help     Show this screen.
  --version     Show version.
  --weight=<n>  Weight in wrr [default: 1].

$ hprctl add hpr.martinez.io 127.0.0.1:8080
$ hprctl add hpr.martinez.io 127.0.0.1:8081
$ hprctl show hpr.martinez.io
:: vhost [ hpr.martinez.io ]
-- backend 127.0.0.1:8080 weight=1
-- backend 127.0.0.1:8081 weight=1

$ hprctl list
:: vhost [ hpr.martinez.io ]

Depends:

Todo:

  • Improve the database support adding more backends
  • Add more load balancing algorithms
  • Implement the api on hpr and stop calling direct the database

About

dynamic http reverse proxy made easy

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages