#!/bin/bash REL="3.2.5" DC_REQUIRED="1.28" usage () { cat <= $DC_REQUIRED Usage: $0 [options...] -d, --dir Specifies the installation directory (must not exist or be empty) Default: steady-$REL -t, --tag Tag or commit used for getting source files from https://github.com/eclipse/steady Default: release-$REL -h, --help Prints this help text HELP_USAGE exit 0 } check_docker_version() { docker_version=`docker-compose --version | egrep -o "[0-9]+\.[0-9]+\.?[0-9]*"` IFS='.' read -ra iv <<< "$docker_version" IFS='.' read -ra rv <<< "$DC_REQUIRED" if [[ "$(( ${iv[0]} ))" < "$(( ${rv[0]} ))" || ( "$(( ${iv[0]} ))" == "$(( ${rv[0]} ))" && "$(( ${iv[1]} ))" < "$(( ${rv[1]} ))" ) ]]; then printf "Requirement on Docker-Compose not met (installed: $docker_version, required: $DC_REQUIRED)\n" return 0 else return 1 fi } setup (){ DIR=$1 printf "Installing Eclipse Steady...\n" printf " from https://raw.githubusercontent.com/eclipse/steady/$TAG/docker\n" printf " into `pwd`/$DIR/\n" # Services with mounted volumes for configuration and/or data conf_services='haproxy postgresql rest-backend cache kb-importer' data_services='patch-lib-analyzer postgresql rest-lib-utils cache kb-importer' # Create directories #mkdir -p $DIR/certs for s in $conf_services; do mkdir -p $DIR/$s/conf done for s in $data_services; do mkdir -p $DIR/$s/data done # Download all necessary files curl -s https://raw.githubusercontent.com/eclipse/steady/$TAG/docker/docker-compose.yml -o ./$DIR/docker-compose.yml curl -s https://raw.githubusercontent.com/eclipse/steady/$TAG/docker/.env.sample -o ./$DIR/.env curl -s https://raw.githubusercontent.com/eclipse/steady/$TAG/docker/start-steady.sh -o ./$DIR/start-steady.sh chmod 744 ./$DIR/start-steady.sh curl -s https://raw.githubusercontent.com/eclipse/steady/$TAG/docker/haproxy/conf/haproxy.cfg -o ./$DIR/haproxy/conf/haproxy.cfg curl -s https://raw.githubusercontent.com/eclipse/steady/$TAG/docker/postgresql/conf/10-vulas-setup.sh -o ./$DIR/postgresql/conf/10-vulas-setup.sh curl -s https://raw.githubusercontent.com/eclipse/steady/$TAG/docker/cache/conf/nginx.conf -o ./$DIR/cache/conf/nginx.conf curl -s https://raw.githubusercontent.com/eclipse/steady/$TAG/docker/kb-importer/conf/kaybeeconf.yaml.sample -o ./$DIR/kb-importer/conf/kaybeeconf.yaml.sample curl -s https://raw.githubusercontent.com/eclipse/steady/$TAG/docker/rest-backend/conf/restbackend.properties -o ./$DIR/rest-backend/conf/restbackend.properties # Create default configuration in user's home directory home_config="$HOME/.steady.properties" cat > "$home_config" < to start all of Steady's Docker Compose services (or any other key to skip execution): " CONTINUE if [[ $CONTINUE == 'a' ]]; then cd $INSTALL_DIR case "$CONTINUE" in a ) SERVICES="all" ;; esac printf "Executing Steady with ./$INSTALL_DIR/start-steady.sh -s $SERVICES\n" bash start-steady.sh -s $SERVICES else printf "Execution skipped. Check startup options with ./$INSTALL_DIR/start-steady.sh --help)\n" fi