-
Notifications
You must be signed in to change notification settings - Fork 14
/
overlay-commands
28 lines (21 loc) · 2 KB
/
overlay-commands
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# With new 1.10 setting up normal overlay network on Swarm
# Set-up infra
docker-machine create -d virtualbox infra
docker $(docker-machine config infra) run -d -p "8500:8500" -h consul progrium/consul -server -bootstrap
# Create swarm-master
docker-machine create -d virtualbox --swarm --swarm-master --swarm-discovery="consul://$(docker-machine ip infra):8500" --engine-opt="cluster-store=consul://$(docker-machine ip infra):8500" --engine-opt="cluster-advertise=eth1:2376" swarm-0
docker $(docker-machine config swarm-0) network create --driver overlay overlay-1
docker $(docker-machine config swarm-0) run -d -p "8500:8500" --net=overlay-1 --name consul -h consul progrium/consul -server -bootstrap
docker $(docker-machine config swarm-0) run -d -v /var/run/docker.sock:/tmp/docker.sock --net=overlay-1 -h registrator --name registrator-swarm-0 kidibox/registrator -internal consul://consul:8500
# Create swarm-1
docker-machine create -d virtualbox --swarm --swarm-discovery="consul://$(docker-machine ip infra):8500" --engine-opt="cluster-store=consul://$(docker-machine ip infra):8500" --engine-opt="cluster-advertise=eth1:2376" swarm-1
docker $(docker-machine config swarm-1) run -d -v /var/run/docker.sock:/tmp/docker.sock --net=overlay-1 -h registrator --name registrator-swarm-1 kidibox/registrator -internal consul://consul:8500
# Start HAProxy
docker $(docker-machine config --swarm swarm-0) run -d --name=rest -p 80:80 -p 1936:1936 --net=overlay-1 sirile/haproxy -consul=consul:8500
# Start node-image-test services
docker $(docker-machine config --swarm swarm-0) run -d -e SERVICE_NAME=hello/v1 --net=overlay-1 -e SERVICE_TAGS=rest --dns 172.17.42.1 sirile/node-image-test
# Print the address of the endpoint
printf "\e[33m*** \e[32mService available at \e[31mhttp://$(docker inspect --format='{{.Node.IP}}' rest)/hello/v1 \e[33m***\e[0m\n"
# Start a few Cassandra images
docker run -d --name cass1 -h cass1 --net=overlay-1 sirile/minicassandra cass1
docker run -d --name cass2 -h cass2 --net=overlay-1 sirile/minicassandra cass1