Change swarm startup

This commit is contained in:
Patrick Jentsch 2019-11-28 09:57:03 +01:00
parent 49311f58f0
commit acedd35e64
2 changed files with 6 additions and 7 deletions

View File

@ -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:

View File

@ -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