Skip to content

Commit

Permalink
Finished up the environment for the test
Browse files Browse the repository at this point in the history
  • Loading branch information
silentpete committed Aug 3, 2018
1 parent e50f9b6 commit 44d41ae
Show file tree
Hide file tree
Showing 6 changed files with 65 additions and 15 deletions.
5 changes: 3 additions & 2 deletions haproxy/haproxy.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,6 @@ frontend http-in
default_backend servers

backend servers
server s01 apache-01:80 check cookie s01
server s02 apache-02:80 check cookie s02
server s01 httpd-01:80
server s02 httpd-02:80
server s03 httpd-03:80
31 changes: 31 additions & 0 deletions nginx/nginx.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@

events {
worker_connections 1024;
}

http {
server {
server_name _;

location = /robots.txt {
add_header Content-Type text/plain;
return 200 "User-agent: *\nAllow: /";
}
location / {
proxy_pass http://httpd-upstream;
# proxy_cookie_path ~*^/.* /;
# proxy_set_header Host $http_host;
# proxy_set_header X-Forwarded-Host $host;
# proxy_set_header X-Forwarded-Server $host;
# proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
# proxy_set_header X-Real-IP $remote_addr;
# proxy_redirect off;
}
}

upstream httpd-upstream {
server httpd-01:80;
server httpd-02:80;
server httpd-03:80;
}
}
13 changes: 0 additions & 13 deletions run-haproxy.sh

This file was deleted.

27 changes: 27 additions & 0 deletions start-env.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#!/bin/bash

function info () {
info "\e[32mINFO:\e[0m $1"
}

CWD="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"

NETWORK_NAME="test-lan"
if [[ $(docker network ls | grep ${NETWORK_NAME}) ]]; then
info "found docker network: ${NETWORK_NAME}"
else
info "did not find docker network, creating docker network: ${NETWORK_NAME}"
docker network create ${NETWORK_NAME}
fi

echo 'stand up three httpd hosts, httpd-01 - httpd-03'
for host in 01 02 03; do
info "creating httpd-${host}"
docker run -dit --name=httpd-${host} --net=${NETWORK_NAME} --log-driver=json-file -v "$CWD/html/":/usr/local/apache2/htdocs/:rw httpd:2.4.34-alpine
done

info 'stand up haproxy'
docker run -dit --name=haproxy --log-driver=json-file --net=${NETWORK_NAME} -v "${CWD}/haproxy/":/usr/local/etc/haproxy/:rw -p 9001:80 haproxy:1.8-alpine

info 'stand up nginx'
docker run -dit --name=nginx --log-driver=json-file --net=${NETWORK_NAME} -v "${CWD}/nginx/":/etc/nginx/:rw -p 9002:80 nginx:1.15.2-alpine
2 changes: 2 additions & 0 deletions stop-env.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#!/bin/bash
docker ps -aq | xargs docker stop
2 changes: 2 additions & 0 deletions stop-remove-env.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#!/bin/bash
docker ps -aq | xargs docker stop | xargs docker rm

0 comments on commit 44d41ae

Please sign in to comment.