Skip to content
This repository
Fetching contributors…

Cannot retrieve contributors at this time

executable file 169 lines (139 sloc) 4.839 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169
#!/bin/bash

CONTAINER_URL="http://www-unix.globus.org/ftppub/gt4/4.0/4.0.8/ws-core/bin/ws-core-4.0.8-bin.tar.gz"
CONTAINER_URL="https://github.com/downloads/nimbusproject/nimbus/ws-core-4.0.8-bin.tar.gz"
CONTAINER_TARNAME="ws-core-4.0.8-bin.tar.gz"
CONTAINER_UNTARREDNAME="ws-core-4.0.8"

# destination directory inside $NIMBUS_HOME
CONTAINER_DIRNAME="services"

NIMBUS_SRC_REL="`dirname $0`/.."
NIMBUS_SRC=`cd $NIMBUS_SRC_REL; pwd`

TMPDIR="$NIMBUS_SRC/tmp"

if [ ! -d $TMPDIR ]; then
    mkdir $TMPDIR
    if [ $? -ne 0 ]; then
        echo "Failed to create temp directory: $TMPDIR"
        exit 1
    fi
fi

if [ "X$1" = "X" ]; then
    echo ""
    echo "Usage: $0 destination_dir"
    echo " You must specify the destination directory.\n"
    exit 1
fi

echo ""
echo "-----------------------------------------------------------------"
echo " Preparing Nimbus installation directory"
echo "-----------------------------------------------------------------"
echo ""
# first ensure we have a GT tarball. Most likely it has been bundled with
# the Nimbus installer.
if [ ! -f $TMPDIR/$CONTAINER_TARNAME ]; then
    echo "Downloading service container.."
    echo ""
    wget --no-check-certificate -c -O $TMPDIR/$CONTAINER_TARNAME $CONTAINER_URL

    if [ $? -ne 0 ]; then
    echo ""
        echo "Failed to download container tarball from: $CONTAINER_URL"
        echo ""
        echo "If you are unable to access the Internet, please retrieve this"
        echo "file by other means and place it in $TMPDIR/."
        echo "Then rerun this script."

        rm -f $TMPDIR/$CONTAINER_TARNAME

        exit 1
    fi
fi

NIMBUS_HOME=$1

if [ ! -d $NIMBUS_HOME ]; then
    PARENT_DIR=`dirname $NIMBUS_HOME`
    
    if [ -d $PARENT_DIR ]; then
        
        mkdir $NIMBUS_HOME

        if [ $? -ne 0 ]; then
            echo "Failed to create destination directory!"
            exit 1
        fi
    else
        echo "Parent dir of destination does not exist: $PARENT_DIR"
        exit 1
    fi
fi

echo "Installing cumulus..."
${NIMBUS_SRC}/cumulus/cumulus-install.sh $NIMBUS_HOME/cumulus $NIMBUS_HOME/ve
if [ $? -ne 0 ]; then
    echo "Failed to install cumulus"
    exit 1
fi
rm -rf $NIMBUS_HOME/cumulus/log
ln -s $NIMBUS_HOME/var $NIMBUS_HOME/cumulus/log

echo "Deploying skeleton directory structure.."
cp -fr $NIMBUS_SRC/home/* $NIMBUS_HOME/
if [ $? -ne 0 ]; then
    echo "Failed to copy Nimbus home directory"
    exit 1
fi

echo "Deploying web application.."
cp -r $NIMBUS_SRC/web $NIMBUS_HOME/
if [ $? -ne 0 ]; then
    echo "Failed to copy Nimbus web directory"
    exit 1
fi

CONTAINER_DIR="$NIMBUS_HOME/$CONTAINER_DIRNAME"
if [ ! -d $CONTAINER_DIR ]; then

    echo "Installing service container.."

    tar xzf $TMPDIR/$CONTAINER_TARNAME -C $TMPDIR
    if [ $? -ne 0 ]; then
        echo "Failed to expand container tarball: $TMPDIR/$CONTAINER_TARNAME"
        echo "If this file is corrupted, you may delete it and rerun this script to download a new one."
        exit 1
    fi

    mv $TMPDIR/$CONTAINER_UNTARREDNAME $CONTAINER_DIR
    if [ $? -ne 0 ]; then
        echo "Failed to move container directory to $CONTAINER_DIR"
        exit 1
    fi

    CONTAINER_LOG_PROPS="$CONTAINER_DIR/container-log4j.properties"
    echo "" >> $CONTAINER_LOG_PROPS
    echo "# Change the following lines from \"INFO\" to \"DEBUG\" to enable Nimbus debugging" >> $CONTAINER_LOG_PROPS
    echo "# Also see: services/etc/nimbus/workspace-service/logging.conf" >> $CONTAINER_LOG_PROPS
    echo "# Logging changes require a container restart." >> $CONTAINER_LOG_PROPS
    echo "log4j.category.org.nimbustools=INFO" >> $CONTAINER_LOG_PROPS
    echo "log4j.category.org.globus.workspace=INFO" >> $CONTAINER_LOG_PROPS

else
    echo "Service container already exists at $CONTAINER_DIR"
fi

echo ""
echo "-----------------------------------------------------------------"
echo " Building and installing Nimbus services"
echo "-----------------------------------------------------------------"

GLOBUS_LOCATION=$CONTAINER_DIR
export GLOBUS_LOCATION

$NIMBUS_SRC/scripts/gt/all-build-and-install.sh
if [ $? -ne 0 ]; then
    echo "Build and install FAILED!"
    exit 1
fi

# add in native libraries
LIBNATIVE="$CONTAINER_DIR/lib-native"
mkdir -p $LIBNATIVE
if [ $? -ne 0 ]; then
    echo "Creation of $LIBNATIVE directory failed"
    exit 1
fi
cp $NIMBUS_SRC/lib/native/* $LIBNATIVE/
if [ $? -ne 0 ]; then
    echo "Deployment of native libs failed"
    exit 1
fi

# create domain sockets privileged directory
PRIVILEGED="$NIMBUS_HOME/var/run/privileged"
mkdir -p $PRIVILEGED
if [ $? -ne 0 ]; then
    echo "Creation of privileged domain sockets directory failed: $PRIVILEGED"
    exit 1
fi
chmod 700 $PRIVILEGED
if [ $? -ne 0 ]; then
    echo "chmod of privileged domain sockets directory failed: $PRIVILEGED"
    exit 1
fi

echo ""
Something went wrong with that request. Please try again.