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

https://github.com/mabrarov/haproxy-test

Testing HAProxy
https://github.com/mabrarov/haproxy-test

discovery dns docker docker-compose haproxy nginx

Last synced: 5 months ago
JSON representation

Testing HAProxy

Awesome Lists containing this project

README

          

# Testing HAProxy

Prerequisites:

1. Docker 20+
1. [Docker Compose](https://docs.docker.com/compose/):
* [Docker Compose standalone](https://docs.docker.com/compose/install/standalone/) 2+ or
* [Docker Compose plugin](https://docs.docker.com/compose/install/linux/) (this README commands use Docker Compose plugin syntax)

Start containers:

```bash
docker compose up -d
```

Add one more backend server:

```bash
docker compose up -d --scale backend=2 --no-recreate
```

Check output of balancer:

```bash
curl -s http://localhost
```

Output of balancer should look like:

```html

Backend

hostname

```

where `hostname` is the name of backend host which actually served request.

Ensure that if output is requested multiple times then different `hostname` is returned.

Stop containers:

```bash
docker compose stop
```

Cleanup:

```bash
docker compose down -v -t 0 && \
docker rmi -f abrarov/haproxy-test-backend && \
docker rmi -f abrarov/haproxy-test-balancer
```