Skip to content

Instantly share code, notes, and snippets.

View byteshiva's full-sized avatar
🎯
Focusing

Siva byteshiva

🎯
Focusing
View GitHub Profile
@byteshiva
byteshiva / second.sh
Created August 24, 2016 13:40 — forked from darron/second.sh
User-data for Second Node.
#!/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
@byteshiva
byteshiva / docker-compose.yml
Created August 25, 2016 06:04 — forked from smebberson/docker-compose.yml
Zero configuration Consul cluster
version: '2'
services:
consul:
image: smebberson/alpine-consul
consului:
image: smebberson/alpine-consul-ui
ports:
- 8500:8500
@byteshiva
byteshiva / docker-compose.yml
Created August 25, 2016 06:04 — forked from igor-vovk/docker-compose.yml
Docker Compose Consul cluster
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
# 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 \
@byteshiva
byteshiva / gist:12679a0f83fe9abf500f7dac5e0fab6d
Created August 25, 2016 06:09 — forked from hutchic/gist:84a4a2b121fac807b3bf3943a6cf64fe
Creating a consul cluster using docker-machine on AWS
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
@byteshiva
byteshiva / Vagrantfile
Created August 25, 2016 06:17 — forked from stuartrexking/Vagrantfile
Vagrantfile to install consul, dnsmasq and Event Store cluster
# -*- 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
@byteshiva
byteshiva / Vagrantfile
Created August 25, 2016 06:17 — forked from stuartrexking/Vagrantfile
Vagrantfile to install consul, dnsmasq and Event Store cluster
# -*- 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
@byteshiva
byteshiva / bootstrap-consul.sh
Created August 25, 2016 06:20 — forked from yaronr/bootstrap-consul.sh
Bootstrap Consul on CoreOS
#!/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"
@byteshiva
byteshiva / install_cluster_node
Last active August 25, 2016 06:26 — forked from jmcarbo/install_cluster_node
install cluster node
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
@byteshiva
byteshiva / install_cluster_master
Last active August 25, 2016 06:28 — forked from jmcarbo/intall_cluster_master
Install cluster master node
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