Last active
May 19, 2016 17:23
-
-
Save DaMitchell/ba66a0bcacc289f1417d7af3c0b099cd 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
#!/bin/bash | |
#set -x | |
VIRTUALBOX_DISK_SIZE="1500" | |
# Docker Machine for Consul | |
docker-machine \ | |
create \ | |
-d virtualbox \ | |
--virtualbox-disk-size $VIRTUALBOX_DISK_SIZE \ | |
consul-machine | |
# Start Consul | |
docker $(docker-machine config consul-machine) run -d --restart=always \ | |
-p "8500:8500" \ | |
-h "consul" \ | |
progrium/consul -server -bootstrap | |
# Docker Swarm master | |
docker-machine \ | |
create \ | |
-d virtualbox \ | |
--virtualbox-disk-size $VIRTUALBOX_DISK_SIZE \ | |
--swarm \ | |
--swarm-master \ | |
--swarm-discovery="consul://$(docker-machine ip consul-machine):8500" \ | |
--engine-opt="cluster-store=consul://$(docker-machine ip consul-machine):8500" \ | |
--engine-opt="cluster-advertise=eth1:2376" \ | |
swarm-master | |
# Docker Swarm node-01 | |
docker-machine \ | |
create \ | |
-d virtualbox \ | |
--virtualbox-disk-size $VIRTUALBOX_DISK_SIZE \ | |
--swarm \ | |
--swarm-discovery="consul://$(docker-machine ip consul-machine):8500" \ | |
--engine-opt="cluster-store=consul://$(docker-machine ip consul-machine):8500" \ | |
--engine-opt="cluster-advertise=eth1:2376" \ | |
swarm-node-01 | |
# Docker Swarm node-02 | |
docker-machine \ | |
create \ | |
-d virtualbox \ | |
--virtualbox-disk-size $VIRTUALBOX_DISK_SIZE \ | |
--swarm \ | |
--swarm-discovery="consul://$(docker-machine ip consul-machine):8500" \ | |
--engine-opt="cluster-store=consul://$(docker-machine ip consul-machine):8500" \ | |
--engine-opt="cluster-advertise=eth1:2376" \ | |
swarm-node-02 | |
# Configure to use Docker Swarm cluster | |
eval $(docker-machine env --swarm swarm-master) |
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
#!/bin/bash | |
#set -x | |
docker-machine stop consul-machine && docker-machine remove consul-machine | |
docker-machine stop swarm-master && docker-machine remove swarm-master | |
docker-machine stop swarm-node-01 && docker-machine remove swarm-node-01 | |
docker-machine stop swarm-node-02 && docker-machine remove swarm-node-02 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Taken from docker/community#57