From 022a48f7415deee221ee69254ec132d42f52c914 Mon Sep 17 00:00:00 2001 From: Karl Klepper Date: Fri, 25 Mar 2016 18:45:19 +0100 Subject: [PATCH 01/14] --fixed all issues --- docker | 37 ++++++++++++++++++++++++++++--------- 1 file changed, 28 insertions(+), 9 deletions(-) diff --git a/docker b/docker index 52f7bc4..400fea5 100755 --- a/docker +++ b/docker @@ -1,24 +1,36 @@ #!/bin/bash +#~/kklepper/docker-wordpress$ nano docker echo echo "Create MySQL Tier" echo "-----------------" echo "* Create MySQL01" -MYSQL01=$(docker run -d paulczar/mysql mysqld_safe --server-id=1 --log-bin=mysql-bin --log-slave-updates=1 --auto_increment_increment=2 --auto_increment_offset=1) -MYSQL01_IP=$(docker inspect $MYSQL01 | grep IPAd | awk -F'"' '{print $4}') +MYSQL01=$(docker run -d --name m1 paulczar/mysql mysqld_safe --server-id=1 --log-bin=mysql-bin --log-slave-updates=1 --auto_increment_increment=2 --auto_increment_offset=1) +MYSQL01_IP=$(docker inspect -f '{{ .NetworkSettings.Networks.bridge.IPAddress }}' $MYSQL01) +#MYSQL01_IP=$(docker inspect $MYSQL01 | grep IPAd | awk -F'"' '{print $4}'|awk '{print $2}') echo "* Create MySQL02" -MYSQL02=$(docker run -d paulczar/mysql mysqld_safe --server-id=2 --log-bin=mysql-bin --log-slave-updates=1 --auto_increment_increment=2 --auto_increment_offset=2) -MYSQL02_IP=$(docker inspect $MYSQL02 | grep IPAd | awk -F'"' '{print $4}') +MYSQL02=$(docker run -d --name m2 paulczar/mysql mysqld_safe --server-id=2 --log-bin=mysql-bin --log-slave-updates=1 --auto_increment_increment=2 --auto_increment_offset=2) +MYSQL02_IP=$(docker inspect -f '{{ .NetworkSettings.Networks.bridge.IPAddress }}' $MYSQL02) +#MYSQL02_IP=$(docker inspect $MYSQL02 | grep IPAd | awk -F'"' '{print $4}'|awk '{print $2}') + + + + + + echo "* Sleep for two seconds for servers to come online..." sleep 2 echo "* Creat replication user" +echo "___________ $MYSQL01_IP" + mysql -uroot -proot -h $MYSQL01_IP -AN -e 'GRANT REPLICATION SLAVE ON *.* TO "replication"@"%" IDENTIFIED BY "password";' + mysql -uroot -proot -h $MYSQL01_IP -AN -e 'flush privileges;' @@ -71,7 +83,8 @@ echo "* Create HAProxy-MySQL" mysql -uroot -proot -h $MYSQL01_IP -AN -e "GRANT USAGE ON *.* TO 'haproxy'@'%';" HAPROXY_MYSQL=$(docker run -d paulczar/haproxy-mysql /haproxy/start "$MYSQL01_IP:3306,$MYSQL02_IP:3306") -HAPROXY_MYSQL_IP=$(docker inspect $HAPROXY_MYSQL | grep IPAd | awk -F'"' '{print $4}') +HAPROXY_MYSQL_IP=$(docker inspect -f '{{ .NetworkSettings.Networks.bridge.IPAddress }}' $HAPROXY_MYSQL) +#HAPROXY_MYSQL_IP=$(docker inspect $HAPROXY_MYSQL | grep IPAd | awk -F'"' '{print $4}') echo "* Check our haproxy works" echo " (should show alternating server_id)" @@ -87,11 +100,13 @@ echo "------------------------" echo "* Create WordPress01" WORDPRESS1=$(docker run -d paulczar/apache2-wordpress /wordpress/start $HAPROXY_MYSQL_IP) -WORDPRESS1_IP=$(docker inspect $WORDPRESS1 | grep IPAd | awk -F'"' '{print $4}') +WORDPRESS1_IP=$(docker inspect -f '{{ .NetworkSettings.Networks.bridge.IPAddress }}' $WORDPRESS1) +#WORDPRESS1_IP=$(docker inspect $WORDPRESS1 | grep IPAd | awk -F'"' '{print $4}') echo "* Create WordPress02" WORDPRESS2=$(docker run -d paulczar/apache2-wordpress /wordpress/start $HAPROXY_MYSQL_IP) -WORDPRESS2_IP=$(docker inspect $WORDPRESS2 | grep IPAd | awk -F'"' '{print $4}') +WORDPRESS2_IP=$(docker inspect -f '{{ .NetworkSettings.Networks.bridge.IPAddress }}' $WORDPRESS2) +#WORDPRESS2_IP=$(docker inspect $WORDPRESS2 | grep IPAd | awk -F'"' '{print $4}') echo echo "Create Web Load Balancer" @@ -99,9 +114,13 @@ echo "--------------------------" echo "* Create HAProxy-Web" HAPROXY_WEB=$(docker run -d paulczar/haproxy-web /haproxy/start "$WORDPRESS1_IP:80,$WORDPRESS2_IP:80") -HAPROXY_WEB_IP=$(docker inspect $HAPROXY_WEB | grep IPAd | awk -F'"' '{print $4}') -echo "* Check it works" +echo "+++++++++++++ $HAPROXY_WEB" + +HAPROXY_WEB_IP=$(docker inspect -f '{{ .NetworkSettings.Networks.bridge.IPAddress }}' $HAPROXY_WEB) +#HAPROXY_WEB_IP=$(docker inspect $HAPROXY_WEB | grep IPAd | awk -F'"' '{print $4}') + +echo "* Check it works $HAPROXY_WEB_IP" curl -s http://$HAPROXY_WEB_IP/phpinfo.php | grep "PHP API" From 723f99b1f0ea33b98d12e84953dca8770e94e702 Mon Sep 17 00:00:00 2001 From: Karl Klepper Date: Fri, 25 Mar 2016 18:49:28 +0100 Subject: [PATCH 02/14] --cleaned up --- docker | 18 ------------------ 1 file changed, 18 deletions(-) diff --git a/docker b/docker index 400fea5..1f8c53a 100755 --- a/docker +++ b/docker @@ -8,32 +8,20 @@ echo "* Create MySQL01" MYSQL01=$(docker run -d --name m1 paulczar/mysql mysqld_safe --server-id=1 --log-bin=mysql-bin --log-slave-updates=1 --auto_increment_increment=2 --auto_increment_offset=1) MYSQL01_IP=$(docker inspect -f '{{ .NetworkSettings.Networks.bridge.IPAddress }}' $MYSQL01) -#MYSQL01_IP=$(docker inspect $MYSQL01 | grep IPAd | awk -F'"' '{print $4}'|awk '{print $2}') echo "* Create MySQL02" MYSQL02=$(docker run -d --name m2 paulczar/mysql mysqld_safe --server-id=2 --log-bin=mysql-bin --log-slave-updates=1 --auto_increment_increment=2 --auto_increment_offset=2) MYSQL02_IP=$(docker inspect -f '{{ .NetworkSettings.Networks.bridge.IPAddress }}' $MYSQL02) -#MYSQL02_IP=$(docker inspect $MYSQL02 | grep IPAd | awk -F'"' '{print $4}'|awk '{print $2}') - - - - - - echo "* Sleep for two seconds for servers to come online..." sleep 2 echo "* Creat replication user" -echo "___________ $MYSQL01_IP" - mysql -uroot -proot -h $MYSQL01_IP -AN -e 'GRANT REPLICATION SLAVE ON *.* TO "replication"@"%" IDENTIFIED BY "password";' - mysql -uroot -proot -h $MYSQL01_IP -AN -e 'flush privileges;' - echo "* Export Data from MySQL01 to MySQL02" mysqldump -uroot -proot -h $MYSQL01_IP --single-transaction --all-databases \ @@ -84,7 +72,6 @@ mysql -uroot -proot -h $MYSQL01_IP -AN -e "GRANT USAGE ON *.* TO 'haproxy'@'%';" HAPROXY_MYSQL=$(docker run -d paulczar/haproxy-mysql /haproxy/start "$MYSQL01_IP:3306,$MYSQL02_IP:3306") HAPROXY_MYSQL_IP=$(docker inspect -f '{{ .NetworkSettings.Networks.bridge.IPAddress }}' $HAPROXY_MYSQL) -#HAPROXY_MYSQL_IP=$(docker inspect $HAPROXY_MYSQL | grep IPAd | awk -F'"' '{print $4}') echo "* Check our haproxy works" echo " (should show alternating server_id)" @@ -101,12 +88,10 @@ echo "------------------------" echo "* Create WordPress01" WORDPRESS1=$(docker run -d paulczar/apache2-wordpress /wordpress/start $HAPROXY_MYSQL_IP) WORDPRESS1_IP=$(docker inspect -f '{{ .NetworkSettings.Networks.bridge.IPAddress }}' $WORDPRESS1) -#WORDPRESS1_IP=$(docker inspect $WORDPRESS1 | grep IPAd | awk -F'"' '{print $4}') echo "* Create WordPress02" WORDPRESS2=$(docker run -d paulczar/apache2-wordpress /wordpress/start $HAPROXY_MYSQL_IP) WORDPRESS2_IP=$(docker inspect -f '{{ .NetworkSettings.Networks.bridge.IPAddress }}' $WORDPRESS2) -#WORDPRESS2_IP=$(docker inspect $WORDPRESS2 | grep IPAd | awk -F'"' '{print $4}') echo echo "Create Web Load Balancer" @@ -115,10 +100,7 @@ echo "--------------------------" echo "* Create HAProxy-Web" HAPROXY_WEB=$(docker run -d paulczar/haproxy-web /haproxy/start "$WORDPRESS1_IP:80,$WORDPRESS2_IP:80") -echo "+++++++++++++ $HAPROXY_WEB" - HAPROXY_WEB_IP=$(docker inspect -f '{{ .NetworkSettings.Networks.bridge.IPAddress }}' $HAPROXY_WEB) -#HAPROXY_WEB_IP=$(docker inspect $HAPROXY_WEB | grep IPAd | awk -F'"' '{print $4}') echo "* Check it works $HAPROXY_WEB_IP" From 977c42861d6acc65e6cc45212de6278315b24a86 Mon Sep 17 00:00:00 2001 From: Karl Klepper Date: Fri, 25 Mar 2016 19:19:58 +0100 Subject: [PATCH 03/14] --added comments --- docker | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/docker b/docker index 1f8c53a..cc01be6 100755 --- a/docker +++ b/docker @@ -8,11 +8,13 @@ echo "* Create MySQL01" MYSQL01=$(docker run -d --name m1 paulczar/mysql mysqld_safe --server-id=1 --log-bin=mysql-bin --log-slave-updates=1 --auto_increment_increment=2 --auto_increment_offset=1) MYSQL01_IP=$(docker inspect -f '{{ .NetworkSettings.Networks.bridge.IPAddress }}' $MYSQL01) +# new docker syntax echo "* Create MySQL02" MYSQL02=$(docker run -d --name m2 paulczar/mysql mysqld_safe --server-id=2 --log-bin=mysql-bin --log-slave-updates=1 --auto_increment_increment=2 --auto_increment_offset=2) MYSQL02_IP=$(docker inspect -f '{{ .NetworkSettings.Networks.bridge.IPAddress }}' $MYSQL02) +# new docker syntax echo "* Sleep for two seconds for servers to come online..." sleep 2 @@ -72,6 +74,7 @@ mysql -uroot -proot -h $MYSQL01_IP -AN -e "GRANT USAGE ON *.* TO 'haproxy'@'%';" HAPROXY_MYSQL=$(docker run -d paulczar/haproxy-mysql /haproxy/start "$MYSQL01_IP:3306,$MYSQL02_IP:3306") HAPROXY_MYSQL_IP=$(docker inspect -f '{{ .NetworkSettings.Networks.bridge.IPAddress }}' $HAPROXY_MYSQL) +# new docker syntax echo "* Check our haproxy works" echo " (should show alternating server_id)" @@ -88,10 +91,12 @@ echo "------------------------" echo "* Create WordPress01" WORDPRESS1=$(docker run -d paulczar/apache2-wordpress /wordpress/start $HAPROXY_MYSQL_IP) WORDPRESS1_IP=$(docker inspect -f '{{ .NetworkSettings.Networks.bridge.IPAddress }}' $WORDPRESS1) +# new docker syntax echo "* Create WordPress02" WORDPRESS2=$(docker run -d paulczar/apache2-wordpress /wordpress/start $HAPROXY_MYSQL_IP) WORDPRESS2_IP=$(docker inspect -f '{{ .NetworkSettings.Networks.bridge.IPAddress }}' $WORDPRESS2) +# new docker syntax echo echo "Create Web Load Balancer" @@ -99,8 +104,8 @@ echo "--------------------------" echo "* Create HAProxy-Web" HAPROXY_WEB=$(docker run -d paulczar/haproxy-web /haproxy/start "$WORDPRESS1_IP:80,$WORDPRESS2_IP:80") - HAPROXY_WEB_IP=$(docker inspect -f '{{ .NetworkSettings.Networks.bridge.IPAddress }}' $HAPROXY_WEB) +# new docker syntax echo "* Check it works $HAPROXY_WEB_IP" From e4c01a858709cb64ebe00f1b1bf6b84546f30b5a Mon Sep 17 00:00:00 2001 From: Karl Klepper Date: Fri, 25 Mar 2016 19:23:20 +0100 Subject: [PATCH 04/14] --more cleaning --- docker | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker b/docker index cc01be6..8f9b75c 100755 --- a/docker +++ b/docker @@ -107,7 +107,7 @@ HAPROXY_WEB=$(docker run -d paulczar/haproxy-web /haproxy/start "$WORDPRESS1_IP: HAPROXY_WEB_IP=$(docker inspect -f '{{ .NetworkSettings.Networks.bridge.IPAddress }}' $HAPROXY_WEB) # new docker syntax -echo "* Check it works $HAPROXY_WEB_IP" +echo "* Check it works" curl -s http://$HAPROXY_WEB_IP/phpinfo.php | grep "PHP API" From 560a6709163c67140e1e0295b32e2dee31e9c99f Mon Sep 17 00:00:00 2001 From: Karl Klepper Date: Fri, 25 Mar 2016 21:32:55 +0100 Subject: [PATCH 05/14] --get rid of MySQL warnings --- docker | 51 +++++++++++++++++++++++++++++++-------------------- 1 file changed, 31 insertions(+), 20 deletions(-) diff --git a/docker b/docker index 8f9b75c..303d112 100755 --- a/docker +++ b/docker @@ -1,6 +1,17 @@ #!/bin/bash #~/kklepper/docker-wordpress$ nano docker +# to get rid of MySQL warnings "Warning: Using a password on the command line interface can be insecure." + +echo +echo "Create credentials" + +credentialsFile=~/.docker-wordpress-credentials.cnf +echo "[client]" > $credentialsFile +echo "user=root" >> $credentialsFile +echo "password=root" >> $credentialsFile + + echo echo "Create MySQL Tier" echo "-----------------" @@ -21,48 +32,48 @@ sleep 2 echo "* Creat replication user" -mysql -uroot -proot -h $MYSQL01_IP -AN -e 'GRANT REPLICATION SLAVE ON *.* TO "replication"@"%" IDENTIFIED BY "password";' -mysql -uroot -proot -h $MYSQL01_IP -AN -e 'flush privileges;' +mysql --defaults-extra-file=$credentialsFile -h $MYSQL01_IP -AN -e 'GRANT REPLICATION SLAVE ON *.* TO "replication"@"%" IDENTIFIED BY "password";' +mysql --defaults-extra-file=$credentialsFile -h $MYSQL01_IP -AN -e 'flush privileges;' echo "* Export Data from MySQL01 to MySQL02" -mysqldump -uroot -proot -h $MYSQL01_IP --single-transaction --all-databases \ - --flush-privileges | mysql -uroot -proot -h $MYSQL02_IP +mysqldump --defaults-extra-file=$credentialsFile -h $MYSQL01_IP --single-transaction --all-databases \ + --flush-privileges | mysql --defaults-extra-file=$credentialsFile -h $MYSQL02_IP echo "* Set MySQL01 as master on MySQL02" -MYSQL01_Position=$(mysql -uroot -proot -h $MYSQL01_IP -e "show master status \G" | grep Position | awk '{print $2}') -MYSQL01_File=$(mysql -uroot -proot -h $MYSQL01_IP -e "show master status \G" | grep File | awk '{print $2}') +MYSQL01_Position=$(mysql --defaults-extra-file=$credentialsFile -h $MYSQL01_IP -e "show master status \G" | grep Position | awk '{print $2}') +MYSQL01_File=$(mysql --defaults-extra-file=$credentialsFile -h $MYSQL01_IP -e "show master status \G" | grep File | awk '{print $2}') -mysql -uroot -proot -h $MYSQL02_IP -AN -e "CHANGE MASTER TO master_host='$MYSQL01_IP', master_port=3306, \ +mysql --defaults-extra-file=$credentialsFile -h $MYSQL02_IP -AN -e "CHANGE MASTER TO master_host='$MYSQL01_IP', master_port=3306, \ master_user='replication', master_password='password', master_log_file='$MYSQL01_File', \ master_log_pos=$MYSQL01_Position;" echo "* Set MySQL02 as master on MySQL01" -MYSQL02_Position=$(mysql -uroot -proot -h $MYSQL02_IP -e "show master status \G" | grep Position | awk '{print $2}') -MYSQL02_File=$(mysql -uroot -proot -h $MYSQL02_IP -e "show master status \G" | grep File | awk '{print $2}') +MYSQL02_Position=$(mysql --defaults-extra-file=$credentialsFile -h $MYSQL02_IP -e "show master status \G" | grep Position | awk '{print $2}') +MYSQL02_File=$(mysql --defaults-extra-file=$credentialsFile -h $MYSQL02_IP -e "show master status \G" | grep File | awk '{print $2}') -mysql -uroot -proot -h $MYSQL01_IP -AN -e "CHANGE MASTER TO master_host='$MYSQL02_IP', master_port=3306, \ +mysql --defaults-extra-file=$credentialsFile -h $MYSQL01_IP -AN -e "CHANGE MASTER TO master_host='$MYSQL02_IP', master_port=3306, \ master_user='replication', master_password='password', master_log_file='$MYSQL02_File', \ master_log_pos=$MYSQL02_Position;" echo "* Start Slave on both Servers" -mysql -uroot -proot -h $MYSQL01_IP -AN -e "start slave;" -mysql -uroot -proot -h $MYSQL02_IP -AN -e "start slave;" +mysql --defaults-extra-file=$credentialsFile -h $MYSQL01_IP -AN -e "start slave;" +mysql --defaults-extra-file=$credentialsFile -h $MYSQL02_IP -AN -e "start slave;" echo "* Create database 'wordpress' on MySQL01" -mysql -uroot -proot -h $MYSQL01_IP -e "create database wordpress;" +mysql --defaults-extra-file=$credentialsFile -h $MYSQL01_IP -e "create database wordpress;" echo "* Load up Site SQL data" -mysql -uroot -proot -h $MYSQL01_IP wordpress < wordpress.sql +mysql --defaults-extra-file=$credentialsFile -h $MYSQL01_IP wordpress < wordpress.sql echo "* Sleep 2 seconds, then check that database 'wordpress' exists on MySQL02" sleep 2 -mysql -uroot -proot -h $MYSQL02_IP -e "show databases; \G" | grep wordpress +mysql --defaults-extra-file=$credentialsFile -h $MYSQL02_IP -e "show databases; \G" | grep wordpress echo echo "Create MySQL Load Balancer" @@ -70,7 +81,7 @@ echo "--------------------------" echo "* Create HAProxy-MySQL" -mysql -uroot -proot -h $MYSQL01_IP -AN -e "GRANT USAGE ON *.* TO 'haproxy'@'%';" +mysql --defaults-extra-file=$credentialsFile -h $MYSQL01_IP -AN -e "GRANT USAGE ON *.* TO 'haproxy'@'%';" HAPROXY_MYSQL=$(docker run -d paulczar/haproxy-mysql /haproxy/start "$MYSQL01_IP:3306,$MYSQL02_IP:3306") HAPROXY_MYSQL_IP=$(docker inspect -f '{{ .NetworkSettings.Networks.bridge.IPAddress }}' $HAPROXY_MYSQL) @@ -79,10 +90,10 @@ HAPROXY_MYSQL_IP=$(docker inspect -f '{{ .NetworkSettings.Networks.bridge.IPAddr echo "* Check our haproxy works" echo " (should show alternating server_id)" -mysql -uroot -proot -h $HAPROXY_MYSQL_IP -e 'show variables like "server_id"' | grep server_id -mysql -uroot -proot -h $HAPROXY_MYSQL_IP -e 'show variables like "server_id"' | grep server_id -mysql -uroot -proot -h $HAPROXY_MYSQL_IP -e 'show variables like "server_id"' | grep server_id -mysql -uroot -proot -h $HAPROXY_MYSQL_IP -e 'show variables like "server_id"' | grep server_id +mysql --defaults-extra-file=$credentialsFile -h $HAPROXY_MYSQL_IP -e 'show variables like "server_id"' | grep server_id +mysql --defaults-extra-file=$credentialsFile -h $HAPROXY_MYSQL_IP -e 'show variables like "server_id"' | grep server_id +mysql --defaults-extra-file=$credentialsFile -h $HAPROXY_MYSQL_IP -e 'show variables like "server_id"' | grep server_id +mysql --defaults-extra-file=$credentialsFile -h $HAPROXY_MYSQL_IP -e 'show variables like "server_id"' | grep server_id echo echo "Create Wordpress Web Servers" From 3413cfd896526b071ae1d4d6f13a76006f29d797 Mon Sep 17 00:00:00 2001 From: Karl Klepper Date: Fri, 25 Mar 2016 21:59:01 +0100 Subject: [PATCH 06/14] --open port 80 --- docker | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker b/docker index 303d112..4146509 100755 --- a/docker +++ b/docker @@ -114,7 +114,7 @@ echo "Create Web Load Balancer" echo "--------------------------" echo "* Create HAProxy-Web" -HAPROXY_WEB=$(docker run -d paulczar/haproxy-web /haproxy/start "$WORDPRESS1_IP:80,$WORDPRESS2_IP:80") +HAPROXY_WEB=$(docker run -p 80:80 -d paulczar/haproxy-web /haproxy/start "$WORDPRESS1_IP:80,$WORDPRESS2_IP:80") HAPROXY_WEB_IP=$(docker inspect -f '{{ .NetworkSettings.Networks.bridge.IPAddress }}' $HAPROXY_WEB) # new docker syntax From 2b4f3d48d5311a64212dea4a385ab1777c01cad8 Mon Sep 17 00:00:00 2001 From: Karl Klepper Date: Fri, 25 Mar 2016 22:03:37 +0100 Subject: [PATCH 07/14] --added note public IP --- docker | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker b/docker index 4146509..aba217f 100755 --- a/docker +++ b/docker @@ -126,7 +126,7 @@ curl -s http://$HAPROXY_WEB_IP/phpinfo.php | grep "PHP API" echo "Environment Created!" echo "--------------------" echo -echo "Browse to http://$HAPROXY_WEB_IP to access your wordpress site" +echo "Browse to http://$HAPROXY_WEB_IP or to your public IP to access your wordpress site" echo echo Variables available fo you :- echo From 80df31bf3c6f06ac4532ba00ecc996b948d22cc1 Mon Sep 17 00:00:00 2001 From: Karl Klepper Date: Fri, 25 Mar 2016 22:11:19 +0100 Subject: [PATCH 08/14] --added comment for missing css file --- docker | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/docker b/docker index aba217f..2dc62ac 100755 --- a/docker +++ b/docker @@ -126,7 +126,10 @@ curl -s http://$HAPROXY_WEB_IP/phpinfo.php | grep "PHP API" echo "Environment Created!" echo "--------------------" echo -echo "Browse to http://$HAPROXY_WEB_IP or to your public IP to access your wordpress site" +echo "Browse to http://$HAPROXY_WEB_IP" +echo "--- or to your public IP to access your wordpress site" +echo "--- may look bad due to incorrect link to wordpress css file: " +echo "--- http://wordpress/wp-content/themes/twentythirteen/style.css?ver=2013-07-18" echo echo Variables available fo you :- echo From 82be2f01c52f4255045c3d40041f2835c15ccb69 Mon Sep 17 00:00:00 2001 From: Karl Klepper Date: Sat, 26 Mar 2016 11:12:31 +0100 Subject: [PATCH 09/14] --typo --- docker | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker b/docker index 2dc62ac..c59489b 100755 --- a/docker +++ b/docker @@ -30,7 +30,7 @@ MYSQL02_IP=$(docker inspect -f '{{ .NetworkSettings.Networks.bridge.IPAddress }} echo "* Sleep for two seconds for servers to come online..." sleep 2 -echo "* Creat replication user" +echo "* Create replication user" mysql --defaults-extra-file=$credentialsFile -h $MYSQL01_IP -AN -e 'GRANT REPLICATION SLAVE ON *.* TO "replication"@"%" IDENTIFIED BY "password";' mysql --defaults-extra-file=$credentialsFile -h $MYSQL01_IP -AN -e 'flush privileges;' From a1ddce8172634321281281eceb4c04f71b9314d7 Mon Sep 17 00:00:00 2001 From: Karl Klepper Date: Tue, 29 Mar 2016 16:31:44 +0200 Subject: [PATCH 10/14] --show success for haproxy web by container ID --- docker | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/docker b/docker index c59489b..95570a2 100755 --- a/docker +++ b/docker @@ -120,8 +120,13 @@ HAPROXY_WEB_IP=$(docker inspect -f '{{ .NetworkSettings.Networks.bridge.IPAddres echo "* Check it works" -curl -s http://$HAPROXY_WEB_IP/phpinfo.php | grep "PHP API" +#curl -s http://$HAPROXY_WEB_IP/phpinfo.php | grep "PHP API" +curl -s http://$HAPROXY_WEB_IP/phpinfo.php | grep "HOSTNAME" +curl -s http://$HAPROXY_WEB_IP/phpinfo.php | grep "HOSTNAME" +curl -s http://$HAPROXY_WEB_IP/phpinfo.php | grep "HOSTNAME" +curl -s http://$HAPROXY_WEB_IP/phpinfo.php | grep "HOSTNAME" +echo " (should show alternating container id)" echo "Environment Created!" echo "--------------------" From 140a3fc7735bbba4e02574ce650dce3afd4b0189 Mon Sep 17 00:00:00 2001 From: Karl Klepper Date: Tue, 29 Mar 2016 17:42:22 +0200 Subject: [PATCH 11/14] --beautyfied --- docker | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/docker b/docker index 95570a2..c72405f 100755 --- a/docker +++ b/docker @@ -120,13 +120,13 @@ HAPROXY_WEB_IP=$(docker inspect -f '{{ .NetworkSettings.Networks.bridge.IPAddres echo "* Check it works" +echo "------------ (should show alternating container id) ----------" +curl -s http://$HAPROXY_WEB_IP/phpinfo.php | grep "HOSTNAME" | awk '{print $4}' | awk -F\> '{print $2}' +curl -s http://$HAPROXY_WEB_IP/phpinfo.php | grep "HOSTNAME" | awk '{print $4}' | awk -F\> '{print $2}' +curl -s http://$HAPROXY_WEB_IP/phpinfo.php | grep "HOSTNAME" | awk '{print $4}' | awk -F\> '{print $2}' +curl -s http://$HAPROXY_WEB_IP/phpinfo.php | grep "HOSTNAME" | awk '{print $4}' | awk -F\> '{print $2}' #curl -s http://$HAPROXY_WEB_IP/phpinfo.php | grep "PHP API" -curl -s http://$HAPROXY_WEB_IP/phpinfo.php | grep "HOSTNAME" -curl -s http://$HAPROXY_WEB_IP/phpinfo.php | grep "HOSTNAME" -curl -s http://$HAPROXY_WEB_IP/phpinfo.php | grep "HOSTNAME" -curl -s http://$HAPROXY_WEB_IP/phpinfo.php | grep "HOSTNAME" - -echo " (should show alternating container id)" +echo "------------ (should show alternating container id) ----------" echo "Environment Created!" echo "--------------------" From a9968b9efaa95b6af6665a4f737736d522205b56 Mon Sep 17 00:00:00 2001 From: Karl Klepper Date: Tue, 29 Mar 2016 17:45:20 +0200 Subject: [PATCH 12/14] --once more --- docker | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/docker b/docker index c72405f..480fa6d 100755 --- a/docker +++ b/docker @@ -118,16 +118,14 @@ HAPROXY_WEB=$(docker run -p 80:80 -d paulczar/haproxy-web /haproxy/start "$WORDP HAPROXY_WEB_IP=$(docker inspect -f '{{ .NetworkSettings.Networks.bridge.IPAddress }}' $HAPROXY_WEB) # new docker syntax -echo "* Check it works" - -echo "------------ (should show alternating container id) ----------" +echo "* Check it works ------------ (should show alternating container id) ----------" curl -s http://$HAPROXY_WEB_IP/phpinfo.php | grep "HOSTNAME" | awk '{print $4}' | awk -F\> '{print $2}' curl -s http://$HAPROXY_WEB_IP/phpinfo.php | grep "HOSTNAME" | awk '{print $4}' | awk -F\> '{print $2}' curl -s http://$HAPROXY_WEB_IP/phpinfo.php | grep "HOSTNAME" | awk '{print $4}' | awk -F\> '{print $2}' curl -s http://$HAPROXY_WEB_IP/phpinfo.php | grep "HOSTNAME" | awk '{print $4}' | awk -F\> '{print $2}' #curl -s http://$HAPROXY_WEB_IP/phpinfo.php | grep "PHP API" -echo "------------ (should show alternating container id) ----------" +echo "--------------------" echo "Environment Created!" echo "--------------------" echo From 60d79c72d9bf7bc1ca1ab6a82ff98a8a94e6be30 Mon Sep 17 00:00:00 2001 From: Karl Klepper Date: Tue, 29 Mar 2016 17:58:25 +0200 Subject: [PATCH 13/14] --still better --- docker | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/docker b/docker index 480fa6d..67952c6 100755 --- a/docker +++ b/docker @@ -119,10 +119,10 @@ HAPROXY_WEB_IP=$(docker inspect -f '{{ .NetworkSettings.Networks.bridge.IPAddres # new docker syntax echo "* Check it works ------------ (should show alternating container id) ----------" -curl -s http://$HAPROXY_WEB_IP/phpinfo.php | grep "HOSTNAME" | awk '{print $4}' | awk -F\> '{print $2}' -curl -s http://$HAPROXY_WEB_IP/phpinfo.php | grep "HOSTNAME" | awk '{print $4}' | awk -F\> '{print $2}' -curl -s http://$HAPROXY_WEB_IP/phpinfo.php | grep "HOSTNAME" | awk '{print $4}' | awk -F\> '{print $2}' -curl -s http://$HAPROXY_WEB_IP/phpinfo.php | grep "HOSTNAME" | awk '{print $4}' | awk -F\> '{print $2}' +curl -s http://$HAPROXY_WEB_IP/phpinfo.php | grep "HOSTNAME" | awk '{print $4}' | awk -F\> '{printf "container ID: %s\n", $2}' +curl -s http://$HAPROXY_WEB_IP/phpinfo.php | grep "HOSTNAME" | awk '{print $4}' | awk -F\> '{printf "container ID: %s\n", $2}' +curl -s http://$HAPROXY_WEB_IP/phpinfo.php | grep "HOSTNAME" | awk '{print $4}' | awk -F\> '{printf "container ID: %s\n", $2}' +curl -s http://$HAPROXY_WEB_IP/phpinfo.php | grep "HOSTNAME" | awk '{print $4}' | awk -F\> '{printf "container ID: %s\n", $2}' #curl -s http://$HAPROXY_WEB_IP/phpinfo.php | grep "PHP API" echo "--------------------" From 8b4c480e11410cc1752cb1f1113386b186436e53 Mon Sep 17 00:00:00 2001 From: Karl Klepper Date: Tue, 29 Mar 2016 18:04:11 +0200 Subject: [PATCH 14/14] --clarified --- docker | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/docker b/docker index 67952c6..4b9988e 100755 --- a/docker +++ b/docker @@ -119,10 +119,10 @@ HAPROXY_WEB_IP=$(docker inspect -f '{{ .NetworkSettings.Networks.bridge.IPAddres # new docker syntax echo "* Check it works ------------ (should show alternating container id) ----------" -curl -s http://$HAPROXY_WEB_IP/phpinfo.php | grep "HOSTNAME" | awk '{print $4}' | awk -F\> '{printf "container ID: %s\n", $2}' -curl -s http://$HAPROXY_WEB_IP/phpinfo.php | grep "HOSTNAME" | awk '{print $4}' | awk -F\> '{printf "container ID: %s\n", $2}' -curl -s http://$HAPROXY_WEB_IP/phpinfo.php | grep "HOSTNAME" | awk '{print $4}' | awk -F\> '{printf "container ID: %s\n", $2}' -curl -s http://$HAPROXY_WEB_IP/phpinfo.php | grep "HOSTNAME" | awk '{print $4}' | awk -F\> '{printf "container ID: %s\n", $2}' +curl -s http://$HAPROXY_WEB_IP/phpinfo.php | grep "HOSTNAME" | awk '{print $4}' | awk -F\> '{printf "container ID (HOSTNAME): %s\n", $2}' +curl -s http://$HAPROXY_WEB_IP/phpinfo.php | grep "HOSTNAME" | awk '{print $4}' | awk -F\> '{printf "container ID (HOSTNAME): %s\n", $2}' +curl -s http://$HAPROXY_WEB_IP/phpinfo.php | grep "HOSTNAME" | awk '{print $4}' | awk -F\> '{printf "container ID (HOSTNAME): %s\n", $2}' +curl -s http://$HAPROXY_WEB_IP/phpinfo.php | grep "HOSTNAME" | awk '{print $4}' | awk -F\> '{printf "container ID (HOSTNAME): %s\n", $2}' #curl -s http://$HAPROXY_WEB_IP/phpinfo.php | grep "PHP API" echo "--------------------"