Last active
January 14, 2016 18:34
-
-
Save KorvinSzanto/94eb97724dbcfa489122 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
# Do not run this as an sh file, take these command out and run them individually. | |
# Before you begin, set up a mysql or mariadb install | |
# I did this on the docker host machine because I wanted easy access to the mysql install. | |
# A better way would be to start up a mariadb docker instance and link into each zend server node. | |
# | |
# So lets node with port 10081 access | |
# You have to wait for this one to complete so that you can get the password it outputs | |
docker run -e MYSQL_HOSTNAME=MYSQL_HOSTNAME -e MYSQL_PORT=3306 -e MYSQL_USERNAME=root -e MYSQL_PASSWORD=password -e MYSQL_DBNAME=zend -e EXCLUDE_PORTS=10081,10082 -p 10081:10081 -p 81:80 --name node1 -t php-zendserver | |
# Add more nodes increasing the name and 8x port number | |
# We define the `EXCLUDE_PORTS` on these boxes so that haproxy doesn't loadbalance the zend server pages | |
docker run -e MYSQL_HOSTNAME=MYSQL_HOSTNAME -e MYSQL_PORT=3306 -e MYSQL_USERNAME=root -e MYSQL_PASSWORD=password -e MYSQL_DBNAME=zend -e EXCLUDE_PORTS=10081,10082 -p 82:80 --name node2 -t -d php-zendserver | |
docker run -e MYSQL_HOSTNAME=MYSQL_HOSTNAME -e MYSQL_PORT=3306 -e MYSQL_USERNAME=root -e MYSQL_PASSWORD=password -e MYSQL_DBNAME=zend -e EXCLUDE_PORTS=10081,10082 -p 83:80 --name node3 -t -d php-zendserver | |
docker run -e MYSQL_HOSTNAME=MYSQL_HOSTNAME -e MYSQL_PORT=3306 -e MYSQL_USERNAME=root -e MYSQL_PASSWORD=password -e MYSQL_DBNAME=zend -e EXCLUDE_PORTS=10081,10082 -p 84:80 --name node4 -t -d php-zendserver | |
# Start up haproxy | |
docker run -d -p 80:80 --link node1:node1 --link node2:node2 --link node3:node3 --link node4:node4 --expose 80 --name balancer tutum/haproxy |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment