mirror of
https://gitlab.ub.uni-bielefeld.de/sfb1288inf/nopaque.git
synced 2024-11-15 01:05:42 +00:00
Merge branch 'development' of gitlab.ub.uni-bielefeld.de:sfb1288inf/opaque into development
This commit is contained in:
commit
30f60b60c2
26
dind_swarm.yml
Normal file
26
dind_swarm.yml
Normal file
@ -0,0 +1,26 @@
|
||||
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
|
33
dind_swarm_setup.sh
Executable file
33
dind_swarm_setup.sh
Executable file
@ -0,0 +1,33 @@
|
||||
#!/bin/bash
|
||||
|
||||
SWARM_MANAGER_IP=""
|
||||
SWARM_WORKER_NUMBER=4
|
||||
|
||||
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
|
||||
|
||||
echo "Leave possible swarm..."
|
||||
docker swarm leave --force > /dev/null 2>&1
|
||||
|
||||
echo "Start storage container"
|
||||
docker-compose --file dind_swarm.yml up --detach storage
|
||||
sleep 3
|
||||
|
||||
echo "Mount 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 "Start worker service(s)"
|
||||
docker-compose --file dind_swarm.yml up --detach --scale worker=${SWARM_WORKER_NUMBER} worker viz
|
||||
sleep 5
|
||||
|
||||
echo "Init Docker swarm..."
|
||||
docker swarm init --advertise-addr ${SWARM_MANAGER_IP} > /dev/null 2>&1
|
||||
|
||||
echo "Join workers to swarm..."
|
||||
SWARM_WORKER_TOKEN=$(docker swarm join-token -q worker)
|
||||
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
|
56
docker_stack_deploy.yml
Normal file
56
docker_stack_deploy.yml
Normal file
@ -0,0 +1,56 @@
|
||||
version: '3'
|
||||
|
||||
services:
|
||||
web:
|
||||
depends_on:
|
||||
- db
|
||||
- redis
|
||||
deploy:
|
||||
placement:
|
||||
constraints:
|
||||
- node.role == manager
|
||||
env_file:
|
||||
- db.env
|
||||
- web.env
|
||||
image: gitlab.ub.uni-bielefeld.de:4567/sfb1288inf/opaque:development
|
||||
ports:
|
||||
- 5000:5000
|
||||
volumes:
|
||||
- storage:/mnt/opaque
|
||||
daemon:
|
||||
depends_on:
|
||||
- db
|
||||
deploy:
|
||||
placement:
|
||||
constraints:
|
||||
- node.role == manager
|
||||
env_file:
|
||||
- db.env
|
||||
- web.env
|
||||
image: gitlab.ub.uni-bielefeld.de:4567/sfb1288inf/opaque_daemon:latest
|
||||
volumes:
|
||||
- storage:/mnt/opaque
|
||||
- $HOME/.docker/config.json:/home/opaque_daemon/.docker/config.json
|
||||
db:
|
||||
deploy:
|
||||
placement:
|
||||
constraints:
|
||||
- node.role == manager
|
||||
env_file: db.env
|
||||
image: postgres:11-alpine
|
||||
volumes:
|
||||
- /srv/opaque/database:/var/lib/postgresql/data
|
||||
redis:
|
||||
deploy:
|
||||
placement:
|
||||
constraints:
|
||||
- node.role == manager
|
||||
image: redis:alpine
|
||||
|
||||
volumes:
|
||||
storage:
|
||||
driver: local
|
||||
driver_opts:
|
||||
device: "//127.0.0.1/opaque_storage"
|
||||
o: "gid=1000,password=opaque,uid=1000,username=opaque"
|
||||
type: cifs
|
Loading…
Reference in New Issue
Block a user