From b70b32dc3af87ced07b917856c7feefbac286787 Mon Sep 17 00:00:00 2001 From: Trent Bartlem Date: Tue, 4 Nov 2014 09:20:40 +1000 Subject: [PATCH 1/5] Added xmpppy --- requirements.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/requirements.txt b/requirements.txt index 278d06f7..9a87a129 100644 --- a/requirements.txt +++ b/requirements.txt @@ -3,6 +3,7 @@ mysql-python dnspython passlib +xmpppy==0.5.0rc1 # Django Stuff # django==1.6.1 From 6c0942e64c0a34d70b07fa31d204adfbaa792d72 Mon Sep 17 00:00:00 2001 From: Trent Bartlem Date: Tue, 4 Nov 2014 09:20:52 +1000 Subject: [PATCH 2/5] Extracted startup to a new script --- bootstrap.sh | 20 ++++++-------------- startup.sh | 12 ++++++++++++ 2 files changed, 18 insertions(+), 14 deletions(-) create mode 100755 startup.sh diff --git a/bootstrap.sh b/bootstrap.sh index 38d37a11..1e7493ce 100644 --- a/bootstrap.sh +++ b/bootstrap.sh @@ -23,21 +23,13 @@ sudo pip install --allow-external libffi-dev libffi-dev #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 rabbitmq-server -sudo apt-get -y install python-xmpp +#sudo apt-get -y install python-xmpp sudo pip install -r requirements.txt +chmod +x startup.sh -# TODO Extract the rest of this file to separate shell script - - - -## 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 \ No newline at end of file +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 '--------' \ No newline at end of file diff --git a/startup.sh b/startup.sh new file mode 100755 index 00000000..69fa9f1c --- /dev/null +++ b/startup.sh @@ -0,0 +1,12 @@ +#!/usr/bin/env bash +python manage.py syncdb + +python manage.py shell + from util import bootstrap_permissions + from celerytask.tasks import run_alliance_corp_update + bootstrap_permissions() + run_alliance_corp_update() + +python manage.py celeryd --verbosity=2 --loglevel=DEBUG +python manage.py celerybeat --verbosity=2 --loglevel=DEBUG +python manage.py runserver From 964752cf2fbe747df764e8bd4417d8af033643c5 Mon Sep 17 00:00:00 2001 From: Trent Bartlem Date: Tue, 4 Nov 2014 09:21:27 +1000 Subject: [PATCH 3/5] Added info message. --- bootstrap.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/bootstrap.sh b/bootstrap.sh index 1e7493ce..3e2b9b86 100644 --- a/bootstrap.sh +++ b/bootstrap.sh @@ -11,6 +11,8 @@ sudo apt-get -y install python-pip cd /vagrant/ 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 apt-get -y install libmysqlclient-dev From 1f317ae7114299b230badc599e69030ad5bf397e Mon Sep 17 00:00:00 2001 From: Trent Bartlem Date: Tue, 4 Nov 2014 11:28:49 +1000 Subject: [PATCH 4/5] Extracted alliance corp update to new file --- run_alliance_corp_update.py | 6 ++++++ startup.sh | 6 +----- 2 files changed, 7 insertions(+), 5 deletions(-) create mode 100644 run_alliance_corp_update.py diff --git a/run_alliance_corp_update.py b/run_alliance_corp_update.py new file mode 100644 index 00000000..c41709f2 --- /dev/null +++ b/run_alliance_corp_update.py @@ -0,0 +1,6 @@ +from util import bootstrap_permissions +from celerytask.tasks import run_alliance_corp_update + +bootstrap_permissions() +run_alliance_corp_update() +quit() diff --git a/startup.sh b/startup.sh index 69fa9f1c..8b854739 100755 --- a/startup.sh +++ b/startup.sh @@ -1,11 +1,7 @@ #!/usr/bin/env bash python manage.py syncdb -python manage.py shell - from util import bootstrap_permissions - from celerytask.tasks import run_alliance_corp_update - bootstrap_permissions() - run_alliance_corp_update() +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 From 8a022ae885ee0b26e066e308f334168b61baa5b8 Mon Sep 17 00:00:00 2001 From: Trent Bartlem Date: Tue, 4 Nov 2014 13:50:38 +1000 Subject: [PATCH 5/5] Running long-lived processes in the background, --- bootstrap.sh | 2 +- shutdown.sh | 3 +++ startup.sh | 9 ++++++--- 3 files changed, 10 insertions(+), 4 deletions(-) create mode 100755 shutdown.sh diff --git a/bootstrap.sh b/bootstrap.sh index 3e2b9b86..c0058e56 100644 --- a/bootstrap.sh +++ b/bootstrap.sh @@ -29,7 +29,7 @@ sudo apt-get -y install rabbitmq-server sudo pip install -r requirements.txt -chmod +x startup.sh +chmod +x *.sh echo '--------' echo 'This would be a good point to adjust mysql passwords, as well as all the stuff ' diff --git a/shutdown.sh b/shutdown.sh new file mode 100755 index 00000000..4743ed09 --- /dev/null +++ b/shutdown.sh @@ -0,0 +1,3 @@ +#!/usr/bin/env bash + +ps ww | grep 'manage.py' | grep -v grep | awk '{print $1}' | xargs kill diff --git a/startup.sh b/startup.sh index 8b854739..54999021 100755 --- a/startup.sh +++ b/startup.sh @@ -1,8 +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 +python manage.py celeryd --verbosity=2 --loglevel=DEBUG & +python manage.py celerybeat --verbosity=2 --loglevel=DEBUG & + +python manage.py runserver &