From 7013814af84ab68b2fd4fe978429b39f2d450aa1 Mon Sep 17 00:00:00 2001 From: j <0x006A@0x2620.org> Date: Tue, 30 Nov 2010 22:41:58 +0100 Subject: [PATCH] simplyfy celery queue deployment --- etc/init/pandora-encoding.conf | 11 ++++++++--- etc/init/pandora-tasks.conf | 11 ++++++++--- etc/init/pandora.conf | 6 +++++- pandora/bin/pandora-encoding | 21 --------------------- pandora/bin/pandora-tasks | 21 --------------------- 5 files changed, 21 insertions(+), 49 deletions(-) delete mode 100755 pandora/bin/pandora-encoding delete mode 100755 pandora/bin/pandora-tasks diff --git a/etc/init/pandora-encoding.conf b/etc/init/pandora-encoding.conf index 1c093f0..b75e2d6 100644 --- a/etc/init/pandora-encoding.conf +++ b/etc/init/pandora-encoding.conf @@ -8,7 +8,12 @@ stop on runlevel [!2345] respawn -chdir /srv/pandora/pandora - -exec /bin/su pandora -s /usr/bin/python2.6 /srv/pandora/pandora/bin/pandora-encoding +env VENV=/srv/pandora +env USER=pandora +script +test -e /var/log/pandora || (mkdir -p /var/log/pandora && chown $USER:$USER /var/log/pandora) +cd $VENV/pandora +exec /usr/bin/sudo -u pandora $VENV/bin/python $VENV/pandora/manage.py celeryd \ + -Q encoding -f /var/log/pandora/pandora-enncoding.log -l INFO +end script diff --git a/etc/init/pandora-tasks.conf b/etc/init/pandora-tasks.conf index 2533117..f6d1840 100644 --- a/etc/init/pandora-tasks.conf +++ b/etc/init/pandora-tasks.conf @@ -8,7 +8,12 @@ stop on runlevel [!2345] respawn -chdir /srv/pandora/pandora - -exec /bin/su pandora -s /usr/bin/python2.6 /srv/pandora/pandora/bin/pandora-tasks +env VENV=/srv/pandora +env USER=pandora +script +test -e /var/log/pandora || (mkdir -p /var/log/pandora && chown $USER:$USER /var/log/pandora) +cd $VENV/pandora +exec /usr/bin/sudo -u pandora $VENV/bin/python $VENV/pandora/manage.py celeryd \ + -Q tasks -f /var/log/pandora/pandora-tasks.log -l INFO +end script diff --git a/etc/init/pandora.conf b/etc/init/pandora.conf index c9df964..5909dd6 100644 --- a/etc/init/pandora.conf +++ b/etc/init/pandora.conf @@ -12,6 +12,10 @@ env VENV=/srv/pandora env USER=pandora script +test -e /var/log/pandora || (mkdir -p /var/log/pandora && chown $USER:$USER /var/log/pandora) cd $VENV/pandora -exec sudo -u $USER $VENV/bin/gunicorn_django -b 127.0.0.1:2620 -w5 $VENV/pandora/settings.py +exec /usr/bin/sudo -u $USER $VENV/bin/gunicorn_django \ + -b 127.0.0.1:2620 \ + --log-level info --log-file /var/log/pandora/pandora.log \ + -w5 $VENV/pandora/settings.py end script diff --git a/pandora/bin/pandora-encoding b/pandora/bin/pandora-encoding deleted file mode 100755 index 09a5d52..0000000 --- a/pandora/bin/pandora-encoding +++ /dev/null @@ -1,21 +0,0 @@ -#!/usr/bin/python -import os -import sys -import site - -project_module = 'pandora' - -root_dir = os.path.normpath(os.path.abspath(os.path.join(os.path.dirname(__file__), '..', '..'))) - -#using virtualenv's activate_this.py to reorder sys.path -activate_this = os.path.join(root_dir, 'bin', 'activate_this.py') -execfile(activate_this, dict(__file__=activate_this)) - -sys.path.append(root_dir) -sys.path.append(os.path.join(root_dir, project_module)) - -from django.core.management import execute_manager - -import settings -execute_manager(settings, ['celeryd', 'celeryd', '-Q' 'encoding']) - diff --git a/pandora/bin/pandora-tasks b/pandora/bin/pandora-tasks deleted file mode 100755 index d7738f5..0000000 --- a/pandora/bin/pandora-tasks +++ /dev/null @@ -1,21 +0,0 @@ -#!/usr/bin/python -import os -import sys -import site - -project_module = 'pandora' - -root_dir = os.path.normpath(os.path.abspath(os.path.join(os.path.dirname(__file__), '..', '..'))) - -#using virtualenv's activate_this.py to reorder sys.path -activate_this = os.path.join(root_dir, 'bin', 'activate_this.py') -execfile(activate_this, dict(__file__=activate_this)) - -sys.path.append(root_dir) -sys.path.append(os.path.join(root_dir, project_module)) - -from django.core.management import execute_manager - -import settings -execute_manager(settings, ['celeryd', 'celeryd', '-Q' 'default']) -