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 | |
| export CONNECT_TO="ip-address-of-first-node" | |
| export PRIVATE_IPV4=$(curl -s http://169.254.169.254/metadata/v1/interfaces/private/0/ipv4/address) | |
| export PUBLIC_IPV4=$(curl -s http://169.254.169.254/metadata/v1/interfaces/public/0/ipv4/address) | |
| export CONSUL_KEY="from-the-first-node" | |
| export SWARM_TOKEN="from-the-first-node" | |
| ufw allow 8300 | |
| ufw allow 8301 | |
| ufw allow from $CONNECT_TO | |
| service consul stop |
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
| version: '2' | |
| services: | |
| consul: | |
| image: smebberson/alpine-consul | |
| consului: | |
| image: smebberson/alpine-consul-ui | |
| ports: | |
| - 8500:8500 |
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
| consul: | |
| image: progrium/consul:latest | |
| # net: host | |
| ports: | |
| - "8400:8400" | |
| - "8500:8500" | |
| command: "-server -bootstrap -ui-dir /ui" | |
| registrator: | |
| command: -resync 30 -internal consul://consul:8500 | |
| image: gliderlabs/registrator:latest |
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
| # First node | |
| export PRIVATE_IP=$(curl http://169.254.169.254/latest/meta-data/local-ipv4) | |
| docker run -d -h node1 -v /data:/data \ | |
| -p 8300:8300 \ | |
| -p 8301:8301 \ | |
| -p 8301:8301/udp \ | |
| -p 8302:8302 \ | |
| -p 8302:8302/udp \ | |
| -p 8400:8400 \ | |
| -p 8500:8500 \ |
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
| docker-machine create \ | |
| --driver amazonec2 \ | |
| --amazonec2-access-key ${AWS_ACCESS_KEY_ID} \ | |
| --amazonec2-secret-key ${AWS_SECRET_ACCESS_KEY} \ | |
| --amazonec2-region ${AWS_REGION} \ | |
| --amazonec2-vpc-id ${AWS_VPC_ID} \ | |
| --amazonec2-subnet-id ${AWS_SUBNET_ID} \ | |
| --amazonec2-zone ${AWS_ZONE} \ | |
| consul1 |
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
| # -*- mode: ruby -*- | |
| # vi: set ft=ruby : | |
| $script = <<SCRIPT | |
| echo Installing dependencies... | |
| sudo apt-get install -y unzip | |
| echo Fetching Consul... | |
| cd /tmp/ | |
| wget https://dl.bintray.com/mitchellh/consul/0.5.2_linux_amd64.zip -O consul.zip |
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
| # -*- mode: ruby -*- | |
| # vi: set ft=ruby : | |
| $script = <<SCRIPT | |
| echo Installing dependencies... | |
| sudo apt-get install -y unzip | |
| echo Fetching Consul... | |
| cd /tmp/ | |
| wget https://dl.bintray.com/mitchellh/consul/0.5.2_linux_amd64.zip -O consul.zip |
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 | |
| source /etc/environment | |
| hostname=$(cat /etc/machine-id) | |
| machines=$(etcdctl ls /consul.io/bootstrap/machines) | |
| #If there are 'machines' then the cluster has been initialised. | |
| if [ -z "$machines" ] | |
| then | |
| flags="${flags} -bootstrap" |
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
| rm -rf /tmp/install | |
| mkdir -p /tmp/install | |
| cd /tmp/install | |
| apt-get update | |
| apt-get install -y wget unzip dnsutils | |
| wget https://releases.hashicorp.com/consul/0.6.4/consul_0.6.4_linux_amd64.zip | |
| unzip consul_0.6.4_linux_amd64.zip | |
| install consul /usr/local/bin/consul | |
| mkdir -p /etc/consul | |
| mkdir -p /var/lib/consul |
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
| rm -rf /tmp/install | |
| mkdir -p /tmp/install | |
| cd /tmp/install | |
| apt-get update | |
| apt-get install -y wget unzip dnsutils | |
| wget https://releases.hashicorp.com/consul/0.6.4/consul_0.6.4_linux_amd64.zip | |
| unzip consul_0.6.4_linux_amd64.zip | |
| install consul /usr/local/bin/consul | |
| mkdir -p /etc/consul | |
| mkdir -p /var/lib/consul |