forked from seriousben/fun-swarm-scheduler
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdeploy.sh
executable file
·34 lines (28 loc) · 984 Bytes
/
deploy.sh
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
#!env bash
set -e
eval $(docker-machine env node-1)
#
# Deploying nginx as a test app
#
docker pull nginx:latest
# Hack to not use a registry to share images across the swarm nodes
docker-machine ssh node-1 "docker save nginx:latest" | docker-machine ssh node-2 "docker load";
docker service create --name nginx \
--hostname="{{.Service.Name}}-{{.Task.Slot}}" \
--publish 80 \
--replicas 2 \
--network fun-swarm \
nginx:latest
#
# Deploying scheduler
#
docker build -t scheduler .
# Hack to not use a registry to share images across the swarm nodes
docker-machine ssh node-1 "docker save scheduler:latest" | docker-machine ssh node-2 "docker load";
# docker service rm fun-swarm-scheduler
docker service create --name fun-swarm-scheduler \
--constraint=node.role==manager \
--publish 8484 \
--mount type=bind,source=/var/run/docker.sock,target=/var/run/docker.sock \
--network fun-swarm \
scheduler:latest