Skip to content

mabrarov/haproxy-test

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Testing HAProxy

Prerequisites:

  1. Docker 1.12.3+
  2. Docker Compose

Start containers:

docker-compose up -d

Add one more backend server:

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

Check output of balancer:

curl -s http://localhost

Output of balancer should look like:

<!DOCTYPE html>
<html>
<head>
<title>Backend</title>
</head>
<body>
hostname
</body>
</html>

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:

docker-compose stop

Cleanup:

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