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
$ docker run -d -name mysql ctlc/mysql |
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
$ docker run -d --name wordpress2 --link serf_1:serf_1 -e="DB_PASSWORD=$DB_PASSWORD" -p 80 ctlc/wordpress-serf /run.sh | |
$ docker run -d --name wordpress3 --link serf_1:serf_1 -e="DB_PASSWORD=$DB_PASSWORD" -p 80 ctlc/wordpress-serf /run.sh | |
$ docker run -d --name wordpress4 --link serf_1:serf_1 -e="DB_PASSWORD=$DB_PASSWORD" -p 80 ctlc/wordpress-serf /run.sh | |
$ serf members | |
packer-virtualbox 10.0.2.15:7946 alive | |
b62e43c286c8 172.17.0.76:7946 alive serf-agent | |
356dc2b8c86c 172.17.0.77:7946 alive mysql | |
44f00d42908a 172.17.0.81:7946 alive wordpress | |
37fd075fac46 172.17.0.82:7946 alive wordpress | |
32431bfcf1ca 172.17.0.80:7946 alive wordpress |
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
/** MySQL hostname */ | |
define('DB_HOST', exec("/usr/bin/serf members -tag role=mysql | awk {'print $2'} | cut -d':' -f1")); |
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
$ curl --location http://$(docker port $WORDPRESS_ID 80)/ |
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
$ WORDPRESS_ID=$(docker run -d --name wordpress --link serf_1:serf_1 -e="DB_PASSWORD=$DB_PASSWORD" -p 80 ctlc/wordpress-serf /run.sh) | |
$ serf members | |
packer-virtualbox 10.0.2.15:7946 alive | |
b62e43c286c8 172.17.0.76:7946 alive serf-agent | |
356dc2b8c86c 172.17.0.77:7946 alive mysql | |
56b4d5f7580d 172.17.0.78:7946 alive wordpress |
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
$ MYSQL_ID=$(docker run -d --name mysql --link serf_1:serf_1 -p 3306 ctlc/mysql-serf /run.sh) | |
$ docker logs $MYSQL_ID | |
======================================================================== | |
You can now connect to this MySQL Server using: | |
mysql -uadmin -p8gmn0Pc7cWJt -h -P | |
Please remember to change the above password as soon as possible! | |
MySQL user 'root' has no password but only allows local connections | |
======================================================================== |
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
$ serf join $(docker port $SERF_ID 7946) | |
Successfully joined cluster by contacting 1 nodes. | |
$ serf members | |
packer-virtualbox 10.0.2.15:7946 alive | |
b62e43c286c8 172.17.0.76:7946 alive serf-agent |
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
$ wget https://dl.bintray.com/mitchellh/serf/0.5.0_linux_amd64.zip | |
$ unzip 0.5.0_linux_amd64.zip | |
$ sudo mv serf /usr/bin/ | |
$ serf agent & | |
$ serf members | |
packer-virtualbox 10.0.2.15:7946 alive |
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
$ SERF_ID=$(docker run -d --name serf_1 -p 7946 -p 7373 ctlc/serf /run.sh) |
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
$ cd ~/coreos-vagrant/cluster/ | |
# find out which box is hosting your port 80 | |
$ etcdctl get /services/web/web_1 | |
{ "host": "core-03", "port": 80, "version": "52c7248a14" } | |
$ vagrant share core-03 --http 80 | |
==> core-03: Detecting network information for machine... | |
core-03: Local machine address: 192.168.65.2 | |
core-03: Local HTTP port: 80 |