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
- Host: GitHub
- URL: https://github.com/mabrarov/haproxy-test
- Owner: mabrarov
- Created: 2019-10-08T20:54:11.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2025-01-14T02:16:59.000Z (over 1 year ago)
- Last Synced: 2025-01-14T03:24:10.160Z (over 1 year ago)
- Topics: discovery, dns, docker, docker-compose, haproxy, nginx
- Language: JavaScript
- Homepage:
- Size: 24.4 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
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
```