#!/bin/bash COLOR_BLUE="\033[0;34m" COLOR_END="\033[0m" COLOR_GREEN="\033[0;32m" PROTOTYPE_URL="http://"$(hostname -I | cut -d' ' -f1)"/vre" if [ "$1" == "-clean" ]; then echo -e "${COLOR_BLUE}Remove existing prototype related containers...${COLOR_END}" docker rm -f \ vre_manager \ vre_nlp_node \ vre_ocr_node \ vre_www echo -e "${COLOR_GREEN}Done!${COLOR_END}" echo -e "${COLOR_BLUE}Remove existing prototype related images...${COLOR_END}" docker rmi \ gitlab.ub.uni-bielefeld.de:4567/pjentsch/vre_manager \ gitlab.ub.uni-bielefeld.de:4567/pjentsch/vre_nlp_node \ gitlab.ub.uni-bielefeld.de:4567/pjentsch/vre_ocr_node \ gitlab.ub.uni-bielefeld.de:4567/pjentsch/vre_www echo -e "${COLOR_GREEN}Done!${COLOR_END}" echo -e "${COLOR_BLUE}Remove the existing prototype related volume...${COLOR_END}" docker volume rm vre_files echo -e "${COLOR_GREEN}Done!${COLOR_END}" exit 0; fi echo -e "${COLOR_BLUE}Build container images from corresponding directories...${COLOR_END}" for dir in *; do if [ -d "$dir" ]; then docker build -t gitlab.ub.uni-bielefeld.de:4567/pjentsch/"$dir" "$dir" fi done echo -e "${COLOR_GREEN}Done!${COLOR_END}" echo -e "${COLOR_BLUE}Create prototype files volume...${COLOR_END}" docker volume create vre_files echo -e "${COLOR_GREEN}Done!${COLOR_END}" echo -e "${COLOR_BLUE}Start prototype manager container...${COLOR_END}" docker run \ --name vre_manager \ -d \ -p 5000:5000 \ -v vre_files:/root/vre_files \ gitlab.ub.uni-bielefeld.de:4567/pjentsch/vre_manager:latest echo -e "${COLOR_GREEN}Done!${COLOR_END}" echo -e "${COLOR_BLUE}Start prototype nlp node container...${COLOR_END}" docker run \ --name vre_nlp_node \ -dit \ -v vre_files:/root/vre_files \ gitlab.ub.uni-bielefeld.de:4567/pjentsch/vre_nlp_node:latest echo -e "${COLOR_GREEN}Done!${COLOR_END}" echo -e "${COLOR_BLUE}Start prototype ocr node container...${COLOR_END}" docker run \ --name vre_ocr_node \ -dit \ -v vre_files:/root/vre_files \ gitlab.ub.uni-bielefeld.de:4567/pjentsch/vre_ocr_node:latest echo -e "${COLOR_GREEN}Done!${COLOR_END}" echo -e "${COLOR_BLUE}Start prototype www container...${COLOR_END}" docker run \ --name vre_www \ -d \ -p 80:80 \ -v vre_files:/usr/share/nginx/html/vre_files \ gitlab.ub.uni-bielefeld.de:4567/pjentsch/vre_www:latest echo -e "${COLOR_GREEN}Done!${COLOR_END}" echo -e "${COLOR_GREEN}The prototype is now completly loaded and reachable under ${PROTOTYPE_URL}!${COLOR_END}" while true; do sleep 30s echo -e "${COLOR_BLUE}Ask for jobs...${COLOR_END}" $(dirname "$0")/ask_for_jobs done