-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
4 changed files
with
43 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,11 @@ | ||
# nginx-vs-haproxy | ||
|
||
## haproxy | ||
|
||
haproxy is a great load balancer, but we should stand up an environment and test... | ||
|
||
```bash | ||
./run-haproxy.sh | ||
``` | ||
|
||
Go to: <http://localhost:8080> and/or <http://localhost:8080/stats> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
global | ||
debug | ||
maxconn 256 | ||
|
||
defaults | ||
mode http | ||
timeout connect 5s | ||
timeout client 50s | ||
timeout server 50s | ||
stats enable | ||
stats uri /stats | ||
|
||
frontend http-in | ||
bind *:80 | ||
default_backend servers | ||
|
||
backend servers | ||
server s01 apache-01:80 check cookie s01 | ||
server s02 apache-02:80 check cookie s02 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Hello to the World! |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
#!/bin/bash | ||
|
||
CWD="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" | ||
if [[ $(docker network ls | grep network) ]]; then | ||
echo 'found network' | ||
else | ||
echo 'did not find network, creating network' | ||
docker network create network | ||
fi | ||
|
||
docker run -dit --name=apache-01 --net=network --log-driver=json-file -v "$CWD/html/":/usr/local/apache2/htdocs/:ro httpd:2.4-alpine | ||
docker run -dit --name=apache-02 --net=network --log-driver=json-file -v "$CWD/html/":/usr/local/apache2/htdocs/:ro httpd:2.4-alpine | ||
docker run -dit --name=haproxy --log-driver=json-file --net=network -v "${CWD}/haproxy/haproxy.cfg":/usr/local/etc/haproxy/haproxy.cfg:ro -p 8080:80 haproxy:1.8-alpine |