Skip to content
Snippets Groups Projects
Commit 8a3e5073 authored by Patrick Jentsch's avatar Patrick Jentsch
Browse files

Add dind_swarm setup and config.

parent 6c9b4336
No related branches found
No related tags found
No related merge requests found
version: '3'
services:
storage:
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:
- /srv/opaque/storage:/srv/opaque/storage
worker:
image: docker:dind
ports:
- 2375
privileged: true
restart: on-failure
volumes:
- /mnt/opaque:/mnt/opaque
viz:
image: dockersamples/visualizer:latest
ports:
- 8080:8080
volumes:
- /var/run/docker.sock:/var/run/docker.sock
#!/bin/bash
OPAQUE_STORAGE_MOUNT_DIRECTORY="/mnt/opaque" # Don't change this variable, unless you know what you are doing!
SWARM_MANAGER_IP=""
SWARM_WORKER_NUMBER=4
SWARM_WORKER_TOKEN=""
if [ -z ${SWARM_MANAGER_IP} ]; then
# See https://stackoverflow.com/a/25851186
SWARM_MANAGER_IP=$(ip route get 1 | awk '{print $(NF-2);exit}')
fi
if [ -z ${SWARM_WORKER_TOKEN} ]; then
docker swarm leave --force > /dev/null 2>&1
docker swarm init --advertise-addr ${SWARM_MANAGER_IP} > /dev/null 2>&1
SWARM_WORKER_TOKEN=$(docker swarm join-token -q worker)
fi
docker-compose --file dind_swarm.yml up --detach storage
sleep 3
echo "Mounting network storage to host system..."
sudo mkdir -p /mnt/opaque
sudo mount -t cifs -o gid=${USER},password=opaque,uid=${USER},user=opaque,vers=3.0 //localhost/opaque_storage /mnt/opaque
echo "Done"
docker-compose --file dind_swarm.yml up --detach --scale worker=${SWARM_WORKER_NUMBER} worker
sleep 10
echo "Add workers to swarm"
for i in $(seq 1 ${SWARM_WORKER_NUMBER}); do
docker-compose --file dind_swarm.yml exec --index=${i} worker docker swarm join --token ${SWARM_WORKER_TOKEN} ${SWARM_MANAGER_IP}:2377
done
docker-compose --file dind_swarm.yml up --detach viz
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment