Skip to content
This repository has been archived by the owner on Mar 24, 2021. It is now read-only.

Commit

Permalink
Merge pull request #240 from alphagov/serialize-dev-startup
Browse files Browse the repository at this point in the history
Serialize dev startup
  • Loading branch information
nick-gravgaard committed Feb 14, 2014
2 parents 3dde653 + 39209af commit 12fb21b
Showing 1 changed file with 19 additions and 4 deletions.
23 changes: 19 additions & 4 deletions start-app.sh
Original file line number Diff line number Diff line change
@@ -1,13 +1,28 @@
#!/bin/bash -e

venvdir=~/.virtualenvs/$(basename $(cd $(dirname $0) && pwd -P))-$1-$2
VENV_DIR=~/.virtualenvs/$(basename $(cd $(dirname $0) && pwd -P))-$1-$2
LOCK_DIR=./tmp-start

if [ ! -d "${venvdir}" ]; then
virtualenv --no-site-packages "$venvdir"
trap "rm -rf $LOCK_DIR" EXIT INT TERM

waiting=0
until mkdir $LOCK_DIR > /dev/null 2>&1; do
if [ $waiting -eq 0 ]; then
echo "waiting for startup lock"
waiting=1
fi
sleep 1
done

if [ ! -d "${VENV_DIR}" ]; then
virtualenv --no-site-packages "$VENV_DIR"
fi

source "$venvdir/bin/activate"
source "$VENV_DIR/bin/activate"

echo "Installing dependencies"
pip install -r requirements.txt

rmdir $LOCK_DIR

python start.py $1 $2

0 comments on commit 12fb21b

Please sign in to comment.