Hipache API service
Hipache is a distributed HTTP and websocket proxy. Originally announced in Dotcloud blog, hipache acts as a routing layer with dynamic configuration capability. Under the hood it uses Redis for route lookups and written in node.js. What are the use cases? Well, if you're building your own "heroku" or just need an ability to dynamically re-route traffic to different backends, hipache can help you. This is something i've been working with and i also blogged about other experiments with nginx and lua. Installation and configuration is very straightforward and since we have Docker now it became even easier to spin up a new router instance.
However, if you worked with hipache before you might have noticed that interacting with redis to update routes is not necessarily a good idea. I think the major issue here is that you have to use redis protocol instead of regular HTTP to make any changes. HTTP makes a good abstraction on top of actual implementation, so i decided to make a API service that hooks into redis and exposes RESTful interface to make route changes. Enter hipache-api.
hipache-api project is written in go and provides a very simple interface to create/update routes. It also supports token based authentication and easily installed via docker image. Check README for more details. I had some prototypes written in Ruby, but finally settled with Go as i can just build a binary and upload it to a clean server and run the service with upstart (on ubuntu).
To install hipache-api you can use Github Releases page or build from source. There's a prebuilt Docker Image available as well.
API endpoints:
GET /frontends
GET /frontends/:name
POST /frontends?host=site.com&backends=http://host1:port,http://host2:port
POST /frontends/:name?backends=http://host1:port,http://host2:port
DELETE /frontends/:name
DELETE /frontends/:name/backend?backend=http://host1:port
POST /flush
Overall i'm pretty happy with results. Hipache has been a very reliable with running in front of hundreds on internal work projects and now being used in pair with hipache-api in the next-generation system. If you havent tried hipache, i recommend you giving it a spin.