Skip to content
Snippets Groups Projects
install-servers.sh 1.66 KiB
Newer Older
  • Learn to ignore specific revisions
  • felmer's avatar
    felmer committed
    # Installs openBIS AS and DSS.
    
    felmer's avatar
    felmer committed
    # Usage: install-servers.sh <servers> <config snapshot repository> <builds fetching script> <config file list 1> ... <config file list n>
    
    felmer's avatar
    felmer committed
    # Dependencies: 
    # - servers-shutdown.sh
    # - create-config-snapshot.sh
    # - restore-config-snapshot.sh
    # - install.sh of the openBIS AS distribution
    
    set -o nounset
    set -o errexit
    
    if [ $# -lt 4 ]; then
    
    felmer's avatar
    felmer committed
        echo "Usage: install-servers.sh <servers> <config snapshot repository> <builds fetching script> <config file list 1> ... <config file list n>"
    
        exit 1
    fi
    
    ##################################################
    #
    # Gathering parameters
    #
    BIN_DIR=`dirname "$0"`
    SERVERS="$1"
    REPOSITORY="$2"
    FETCHING_SCRIPT="$3"
    shift 3
    
    OPENBIS_AS="$SERVERS/openBIS-server"
    OPENBIS_DSS="$SERVERS/datastore_server"
    
    
    "$BIN_DIR/servers-shutdown.sh" "$SERVERS"
    
    "$BIN_DIR/create-config-snapshot.sh" "$SERVERS" "$REPOSITORY" "$@"
    rm -rf "$OPENBIS_AS"
    rm -rf "$OPENBIS_DSS"
    
    "$FETCHING_SCRIPT"
    
    felmer's avatar
    felmer committed
    echo "unzip openBIS-server*.zip"
    
    unzip -qu openBIS-server*.zip -d "$SERVERS"
    
    felmer's avatar
    felmer committed
    echo "unzip datastore_server-*.zip"
    
    unzip -qu datastore_server-*.zip -d "$SERVERS" 
    for file in datastore_server_plugin-*.zip; do 
    	if [ -f $file ]; then 
    
    felmer's avatar
    felmer committed
        echo "unzip $file"
    
    		unzip -qun -d "$SERVERS" $file;
    
    	fi
    done
    rm -f openBIS-server*.zip
    rm -f datastore_server*.zip
    
    
    felmer's avatar
    felmer committed
    echo "==== Starting install script of the openBIS AS distribution"
    
    "$OPENBIS_AS/install.sh" "$OPENBIS_AS"
    
    felmer's avatar
    felmer committed
    echo "==== Finished install script of the openBIS AS distribution"
    
    
    YOUNGEST_REPOSITORY=`ls "$REPOSITORY"|sort -r|sed q`
    
    felmer's avatar
    felmer committed
    echo "==== Restore config snapshot $YOUNGEST_REPOSITORY"
    
    "$BIN_DIR/restore-config-snapshot.sh" "$SERVERS" "$REPOSITORY/$YOUNGEST_REPOSITORY/"