An open API service indexing awesome lists of open source software.

https://github.com/pariola/lb

Simple Reverse Proxy Load Balancer
https://github.com/pariola/lb

load-balancer reverse-proxy simple

Last synced: 10 days ago
JSON representation

Simple Reverse Proxy Load Balancer

Awesome Lists containing this project

README

          

# lb

a reverse proxy load-balancing server, It implements the Weighted Round Robin Balancing algorithm referenced [here](https://github.com/phusion/nginx/commit/27e94984486058d73157038f7950a0a36ecc6e35).

[Installing](#installing) | [How to Use](#how-to-use) | [Configuration](#configuration)

## Installing

### Using `go install`
You can use the command below to compile and install directly to your $GOPATH/bin
```sh
go install github.com/pariola/lb@latest
```

## How to Use
After installing, run the command below to start the server:
```sh
lb
```
Now the server proxies every request to downstream backends.

## Configuration
Configuration format is `YAML` and path defaults to `lb.yml`.

### Available Values
| **Name** | **Description** | **Default** |
|----------------------|-------------------------------------------------------------------------------|:-----------:|
| `port` | Port the server will listen on | `3000` |
| `retries` | Amount retries per request | `1` |
| `health.path` | URL path to listen to for liveness checks | `/` |
| `health.interval` | Interval to perform the liveness checks | `30s` |
| `backends.[].host` | Downstream Server URL to proxy requests to (ex. `localhost:4023`) | `-` |
| `backends.[].weight` | Weight to influence the amount of requests received by the downstream backend | `1` |

Example Configuration:

```yaml
port: 5000
retires: 5
health:
path: /health
interval: 30s
backends:
- host: "localhost:5000"
weight: 2
- host: "localhost:5001"
weight: 1
```