Last active
September 15, 2016 04:45
-
-
Save fcruxen/82b94b2bb7127c9448105d55f9dd57fd to your computer and use it in GitHub Desktop.
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
unset -v machines && unset -v flags && unset -v machineID | |
export machineID=$(cat /etc/machine-id) | |
/usr/bin/etcdctl rm /consul/machines/$machineID | |
/usr/bin/docker kill consul | |
export machines=$(/usr/bin/etcdctl ls /consul/machines) | |
if [ -z "$machines" ]; then export flags="-bootstrap"; else export flags=$(/usr/bin/etcdctl ls /consul/machines | while read line; \ | |
do ip=$(/usr/bin/etcdctl get ${line}); \ | |
echo ${flags} -join ${ip}; done);fi | |
/usr/bin/etcdctl mk /consul/machines/$machineID $COREOS_PRIVATE_IPV4 | |
/usr/bin/docker pull progrium/consul | |
/usr/bin/docker run -h $machineID -v /mnt:/data \ | |
-p $COREOS_PRIVATE_IPV4:8300:8300 \ | |
-p $COREOS_PRIVATE_IPV4:8301:8301 \ | |
-p $COREOS_PRIVATE_IPV4:8301:8301/udp \ | |
-p $COREOS_PRIVATE_IPV4:8302:8302 \ | |
-p $COREOS_PRIVATE_IPV4:8302:8302/udp \ | |
-p $COREOS_PRIVATE_IPV4:8400:8400 \ | |
-p $COREOS_PRIVATE_IPV4:8500:8500 \ | |
-p 127.0.0.1:53:53/udp \ | |
progrium/consul -server -advertise $COREOS_PRIVATE_IPV4 $flags |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment