*.db-journal
*~
*.orig
+*.log
# Compress output
/wolnelektury/static/css/all.min*.css
.tmp_*
# Tags file
-TAGS
\ No newline at end of file
+TAGS
upload_tar_from_git()
upload_wsgi_script()
upload_vhost_sample()
+ upload_celery_conf()
install_requirements()
copy_localsettings()
symlink_current_release()
files.upload_template('%(project_name)s.wsgi.template' % env, '%(path)s/%(project_name)s.wsgi' % env, context=env)
run('chmod ug+x %(path)s/%(project_name)s.wsgi' % env)
+def upload_celery_conf():
+ "Create and upload a Celery conf for supervisord"
+ print ">>> upload celery supervisord conf"
+ files.upload_template('%(project_name)s-celery.conf.template' % env, '%(path)s/%(project_name)s-celery.conf' % env, context=env)
+ run('chmod ug+x %(path)s/%(project_name)s-celery.conf' % env)
+
def install_requirements():
"Install the required packages from the requirements file using pip"
print '>>> install requirements'
"Restart the web server"
print '>>> restart webserver'
run('touch %(path)s/%(project_name)s.wsgi' % env)
+ print '>>> restart Celery'
+ sudo('supervisord restart %(project_name)s-celery' % env)
--- /dev/null
+; =========================================
+; WolneLektury-Celeryd conf for supervisord
+; Put this in /etc/supervisor/conf.d
+; =========================================
+
+[program:%(project_name)s-celery]
+command=%(path)s/bin/python %(path)s/releases/current/%(project_name)s/manage.py celeryd --loglevel=INFO
+directory=%(path)s/releases/current/%(project_name)s
+user=%(user)s
+numprocs=2
+process_name=wolnelektury-celery-%%(process_num)
+stdout_logfile=%(path)s/celeryd.log
+stderr_logfile=%(path)s/celeryd.log
+autostart=true
+autorestart=true
+startsecs=10
+
+; Need to wait for currently executing tasks to finish at shutdown.
+; Increase this if you have very long running tasks.
+stopwaitsecs = 600
+
+; if rabbitmq is supervised, set its priority higher
+; so it starts first
+priority=998
#!%(python)s
import site
-site.addsitedir('%(path)s/lib/python2.5/site-packages')
+site.addsitedir('%(path)s/lib/python2.6/site-packages')
import os
from os.path import abspath, dirname, join
# print statements for optional import exceptions.
sys.stdout = sys.stderr
-# we don't want these packages to cover our virtualenv
-sys.path = [p for p in sys.path if not p.startswith('/usr/lib/python2.5/site-packages') and not p.startswith('/var/lib/python-support/python2.5')]
-
# Add apps and lib directories to PYTHONPATH
sys.path = [
'%(path)s/releases/current/%(project_name)s',
] + sys.path
# Run Django
+os.environ["CELERY_LOADER"] = "django"
os.environ['DJANGO_SETTINGS_MODULE'] = 'settings'
from django.core.handlers.wsgi import WSGIHandler