deploy 1.37 KB
Newer Older
Jamesie Pic's avatar
Jamesie Pic committed
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
#!/bin/bash
# This deploy hook gets executed after dependencies are resolved and the
# build hook has been run but before the application has been started back
# up again.  This script gets executed directly, so it could be python, php,
# ruby, etc.
set -xe

source ${OPENSHIFT_HOMEDIR}app-root/runtime/dependencies/python/virtenv/bin/activate

cat ${OPENSHIFT_REPO_DIR}requirements.txt

pip install -U pip

pip install -r ${OPENSHIFT_REPO_DIR}requirements.txt

# We don't have sentry yet
# python ${OPENSHIFT_REPO_DIR}manage.py raven test

python ${OPENSHIFT_REPO_DIR}manage.py migrate --noinput

pushd ${OPENSHIFT_DATA_DIR}
if ! [ -d node ]; then
    wget https://nodejs.org/dist/v4.2.2/node-v4.2.2-linux-x64.tar.gz
    tar xvzf node-v4.2.2-linux-x64.tar.gz
    ln -sfn node-v4.2.2-linux-x64 node
fi
popd

pushd ${OPENSHIFT_REPO_DIR}
if [ -f ${OPENSHIFT_DATA_DIR}sentry ]; then
    pip install raven
    ./manage.py raven test
else
    echo ${OPENSHIFT_DATA_DIR}sentry does not exist, not setting up raven.
fi

PATH="${OPENSHIFT_DATA_DIR}node/bin:$PATH"
HOME=$OPENSHIFT_DATA_DIR
CI=true
npm install bower
npm install
node_modules/.bin/bower install
node_modules/gulp/bin/gulp.js less
mkdir -p wsgi
./manage.py collectstatic --noinput
popd

mkdir -p ${OPENSHIFT_DATA_DIR}media
mkdir -p ${OPENSHIFT_REPO_DIR}wsgi/static/media
ln -sf ${OPENSHIFT_DATA_DIR}media ${OPENSHIFT_REPO_DIR}wsgi/static/media