From acedd35e645ba311d17158eb921003ae6ecbf84d Mon Sep 17 00:00:00 2001
From: Patrick Jentsch
Date: Thu, 28 Nov 2019 09:57:03 +0100
Subject: [PATCH] Change swarm startup
---
dind_swarm.yml | 1 -
dind_swarm_setup.sh | 12 ++++++------
2 files changed, 6 insertions(+), 7 deletions(-)
diff --git a/dind_swarm.yml b/dind_swarm.yml
index 8dbc831e..9bb160dd 100644
--- a/dind_swarm.yml
+++ b/dind_swarm.yml
@@ -5,7 +5,6 @@ services:
command: ["-p", "-s", "opaque_storage;/srv/opaque/storage;no;no;no;opaque", "-u", "opaque;opaque"]
image: dperson/samba:latest
ports:
- - 139:139
- 445:445
restart: on-failure
volumes:
diff --git a/dind_swarm_setup.sh b/dind_swarm_setup.sh
index df1c8b73..7ddc9abc 100755
--- a/dind_swarm_setup.sh
+++ b/dind_swarm_setup.sh
@@ -9,9 +9,8 @@ if [ -z ${SWARM_MANAGER_IP} ]; then
fi
echo "Leave possible swarm and down all services..."
-docker swarm leave --force > /dev/null 2>&1
-docker-compose --file dind_swarm.yml down > /dev/null 2>&1
-
+docker swarm leave --force
+docker-compose --file dind_swarm.yml down
echo "Start storage container"
docker-compose --file dind_swarm.yml up --detach storage
@@ -19,18 +18,19 @@ sleep 3
echo "Mount network storage to host system..."
sudo mkdir -p /mnt/opaque
+sudo umount /mnt/opaque
sudo mount -t cifs -o gid=${USER},password=opaque,uid=${USER},user=opaque,vers=3.0 //localhost/opaque_storage /mnt/opaque
echo "Start worker service(s)"
docker-compose --file dind_swarm.yml up --detach --scale worker=${SWARM_WORKER_NUMBER} worker viz
-sleep 5
+sleep 7
echo "Init Docker swarm..."
-docker swarm init --advertise-addr ${SWARM_MANAGER_IP} > /dev/null 2>&1
+docker swarm init --advertise-addr ${SWARM_MANAGER_IP}
echo "Add workers to swarm..."
SWARM_WORKER_TOKEN=$(docker swarm join-token -q worker)
for i in $(seq 1 ${SWARM_WORKER_NUMBER}); do
- echo "[opaque_worker_${i}]"
+ echo -n "[opaque_worker_${i}]: "
docker-compose --file dind_swarm.yml exec --index=${i} worker docker swarm join --token ${SWARM_WORKER_TOKEN} ${SWARM_MANAGER_IP}:2377
done