-
Notifications
You must be signed in to change notification settings - Fork 0
/
build-swarm
44 lines (35 loc) · 1.07 KB
/
build-swarm
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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#!/bin/bash
set -ex
# based on this: https://docs.docker.com/engine/userguide/networking/get-started-overlay/#create-a-swarm-cluster
DRIVER=${DRIVER:-virtualbox}
docker-machine create -d $DRIVER kvstore
eval $(docker-machine env kvstore)
docker run --name consul --restart=always -p 8400:8400 -p 8500:8500 \
-p 53:53/udp -d progrium/consul -server -bootstrap-expect 1 -ui-dir /ui
export KVSTORE_IP=$(docker-machine ip kvstore)
export CONSUL_URL="consul://$KVSTORE_IP:8500"
export SWARM_ARGS="
--swarm \
--swarm-discovery=$CONSUL_URL \
--engine-opt=cluster-store=$CONSUL_URL \
--engine-opt=cluster-advertise=eth0:2376
"
docker-machine create \
-d $DRIVER \
--swarm-master \
$SWARM_ARGS \
rogue-leader
docker-machine create \
-d $DRIVER \
$SWARM_ARGS \
rogue-one
docker-machine create \
-d virtualbox \
$SWARM_ARGS \
rogue-two
# load
echo 'connect to swarm:'
echo 'eval $(docker-machine env --swarm rogue-leader)'
eval $(docker-machine env --swarm rogue-leader)
docker info
echo "Don't forget to docker pull jupyterhub/singleuser"