Skip to content
This repository has been archived by the owner on Aug 12, 2024. It is now read-only.

Add create-cluster script to the Swarm chapter #57

Closed
heidizhounolan opened this issue Mar 26, 2016 · 0 comments
Closed

Add create-cluster script to the Swarm chapter #57

heidizhounolan opened this issue Mar 26, 2016 · 0 comments
Assignees

Comments

@heidizhounolan
Copy link

#!/bin/bash
#set -x

# Docker Machine for Consul
docker-machine \
  create \
  -d virtualbox \
  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 "5000" \
  --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 "5000" \
  --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 "5000" \
  --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)"
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants