deploy 1.71 KB
Newer Older
Jamesie Pic's avatar
Jamesie Pic committed
1 2 3 4 5 6 7 8 9 10 11
#!/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

pip install -U pip

Jamesie Pic's avatar
Jamesie Pic committed
12 13 14 15 16
yes | pip uninstall django-representatives django-representatives-votes
pip install https://github.com/political-memory/django-representatives/archive/parltrack.tar.gz#egg=django-representatives
pip install https://github.com/political-memory/django-representatives-votes/archive/parltrack.tar.gz#egg=django-representatives-votes
pip install -Ue ${OPENSHIFT_REPO_DIR}

Jamesie Pic's avatar
Jamesie Pic committed
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
# 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
mkdir -p wsgi
./manage.py collectstatic --noinput
46
./manage.py compress
Jamesie Pic's avatar
Jamesie Pic committed
47 48 49 50 51
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
52
ln -sf ${OPENSHIFT_DATA_DIR}compress/CACHE ${OPENSHIFT_REPO_DIR}wsgi/static/collected/CACHE