Merge pull request #6 from TrentBartlem/master

Running long-lived processes in the background
This commit is contained in:
Raynaldo Rivera 2014-11-03 20:53:08 -07:00
commit afc4784a16
5 changed files with 29 additions and 14 deletions

View File

@ -11,6 +11,8 @@ sudo apt-get -y install python-pip
cd /vagrant/ cd /vagrant/
sudo pip install --upgrade pip sudo pip install --upgrade pip
# Pip moved location after upgrade from 1.0
sudo ln -s /usr/local/bin/pip /usr/bin/pip 2>/dev/null sudo ln -s /usr/local/bin/pip /usr/bin/pip 2>/dev/null
sudo apt-get -y install libmysqlclient-dev sudo apt-get -y install libmysqlclient-dev
@ -23,21 +25,13 @@ sudo pip install --allow-external libffi-dev libffi-dev
#TODO collect user input and use that to populate the passwords #TODO collect user input and use that to populate the passwords
sudo apt-get -y install mysql-server-5.5 sudo apt-get -y install mysql-server-5.5
sudo apt-get -y install rabbitmq-server sudo apt-get -y install rabbitmq-server
sudo apt-get -y install python-xmpp #sudo apt-get -y install python-xmpp
sudo pip install -r requirements.txt sudo pip install -r requirements.txt
chmod +x *.sh
# TODO Extract the rest of this file to separate shell script echo '--------'
echo 'This would be a good point to adjust mysql passwords, as well as all the stuff '
echo 'in ./alliance_auth/settings.py otherwise startup.sh will not work.'
echo '--------'
## comment out bootstrap_permissions() before sync, as per instructions
#cp groupmanagement/__init__.py groupmanagement/__init__.py.bak
#sed "s/bootstrap_permissions()/#bootstrap_permissions()/" groupmanagement/__init__.py.bak > groupmanagement/__init__.py
#python manage.py syncdb
#mv groupmanagement/__init__.py.bak groupmanagement/__init__.py
#python manage.py celeryd --verbosity=2 --loglevel=DEBUG
#python manage.py celerybeat --verbosity=2 --loglevel=DEBUG
#python manage.py runserver

View File

@ -3,6 +3,7 @@ mysql-python
dnspython dnspython
passlib passlib
xmpppy==0.5.0rc1
# Django Stuff # # Django Stuff #
django==1.6.1 django==1.6.1

View File

@ -0,0 +1,6 @@
from util import bootstrap_permissions
from celerytask.tasks import run_alliance_corp_update
bootstrap_permissions()
run_alliance_corp_update()
quit()

3
shutdown.sh Executable file
View File

@ -0,0 +1,3 @@
#!/usr/bin/env bash
ps ww | grep 'manage.py' | grep -v grep | awk '{print $1}' | xargs kill

11
startup.sh Executable file
View File

@ -0,0 +1,11 @@
#!/usr/bin/env bash
# TODO route log output to file.
python manage.py syncdb
python manage.py shell < run_alliance_corp_update.py
python manage.py celeryd --verbosity=2 --loglevel=DEBUG &
python manage.py celerybeat --verbosity=2 --loglevel=DEBUG &
python manage.py runserver &