mailgun/vulcand — pull request #136 by klizhentas (2014-12-21 21:13:07+00:00)
Title: Rewrite Vulcand

# Purpose

Vulcand suffered from a couple of issues:

* Inconsistent API - some methods were JSON, some multipart-form data
* Inconsistent Etcd backend - some data structures were represented as folders, and some as JSON blobs
* Inconsistent interface to configuration backends - complicated sequence of events generated
* Complex and confusing naming, hosts, locations and upstreams did not resonate well with people when I was explaining the concepts.
* Host oriented config - it was impossible to set up catch-all routes without setting a route for each possible host
* Complex middleware specification - dependency on complex vulcan library interfaces

# Implementation
This is a big rewrite of Vulcand that introduces the following concepts:

### Frontends and Backends

HAProxy-style frontend and backend configuration. Frontend controls middlewares and matches routes, backends control transport settings to clients and load balancing between pool of servers.

Moreover each frontend and backend has now explicit type what opens the doors for different protocols

### Middlewares

Middlewares do not longer depend on the `vulcan` library that has been deprecated, instead middlewares are fully compatible with `http.Handler` standard library interface what makes them easier to understand.

## Etcd format changes

Frontend, Backend and middlewares are now JSON objects what fixes various problems when it was possible to create an object in the inconsistent state because it required to set up multiple sub-keys.

## API changes

API is now consistent and is all 100% JSON unified interface.
Instead of CRUD API now implements UPSERT/DELETE cycle what works better in practice for Vulcand configuration

## CLI changes

`vulcanctl` and `vulcanbundle` were renamed to `vctl` and `vbundle` to make it more convenient for everyday typing.

## New format example

```bash
etcdctl set /vulcand/backends/b1/backend '{"Type": "http", "Settings": {"MaxIdleConnsPerHost": 128}}'
etcdctl set /vulcand/backends/b1/servers/srv1 '{"URL": "http://localhost:5000"}'
etcdctl set /vulcand/frontends/f1/frontend '{"Type": "http", "BackendId": "b1", "Route": "Path(`/`)"}'
```