Fixes to airtime-celery setup
This commit is contained in:
parent
76a7aa9a24
commit
70f6cbbc71
5 changed files with 57 additions and 32 deletions
|
@ -25,8 +25,16 @@ This program must be run with sudo:
|
|||
Developers
|
||||
==========
|
||||
|
||||
To debug, you can run celery directly from the command line:
|
||||
|
||||
$ cd /my/airtime/root/python_apps/airtime-celery
|
||||
$ RMQ_CONFIG_FILE=/etc/airtime/airtime.conf celery -A airtime-celery.tasks worker --loglevel=info
|
||||
|
||||
This worker can be run alongside the service without issue.
|
||||
|
||||
You may want to use the setuptools develop target to install:
|
||||
|
||||
$ cd /my/airtime/root/python_apps/airtime-celery
|
||||
$ sudo python setup.py develop
|
||||
|
||||
You will need to allow the "airtime" RabbitMQ user to access all exchanges and queues within the /airtime vhost:
|
||||
|
@ -39,3 +47,19 @@ Logging
|
|||
By default, logs are saved to:
|
||||
|
||||
/var/log/airtime/airtime-celery[-DEV_ENV].log
|
||||
|
||||
Troubleshooting
|
||||
===============
|
||||
|
||||
If you run into issues getting Celery to accept tasks from Airtime:
|
||||
|
||||
1) Make sure Celery is running ($ sudo service airtime-celery status).
|
||||
|
||||
2) Check the log file (/var/log/airtime/airtime-celery[-DEV_ENV].log) to make sure Celery started correctly.
|
||||
|
||||
3) Check your /etc/airtime/airtime.conf rabbitmq settings. Make sure the settings here align with
|
||||
/etc/airtime-saas/production/rabbitmq.ini.
|
||||
|
||||
4) Check RabbitMQ to make sure the celeryresults and task queues were created in the correct vhost.
|
||||
|
||||
5) Make sure the RabbitMQ user (the default is airtime) has permissions on all vhosts being used.
|
|
@ -4,13 +4,16 @@ import os
|
|||
import sys
|
||||
|
||||
install_args = ['install', 'install_data', 'develop']
|
||||
run_postinst = False
|
||||
|
||||
# XXX Definitely not the best way of doing this...
|
||||
if sys.argv[1] in install_args and "--no-init-script" not in sys.argv:
|
||||
run_postinst = True
|
||||
data_files = [('/etc/default', ['install/conf/airtime-celery']),
|
||||
('/etc/init.d', ['install/initd/airtime-celery'])]
|
||||
else:
|
||||
if "--no-init-script" in sys.argv:
|
||||
run_postinst = True # We still want to run the postinst here
|
||||
sys.argv.remove("--no-init-script")
|
||||
data_files = []
|
||||
|
||||
|
@ -20,6 +23,14 @@ def postinst():
|
|||
# permissions for the defaults config file
|
||||
os.chmod('/etc/init.d/airtime-celery', 0755)
|
||||
os.chmod('/etc/default/airtime-celery', 0640)
|
||||
# Make the airtime log directory group-writable
|
||||
os.chmod('/var/log/airtime', 0775)
|
||||
|
||||
# Create the Celery user
|
||||
call(['adduser', '--no-create-home', '--home', '/var/lib/celery', '--gecos', '""', '--disabled-login', 'celery'])
|
||||
# Add celery to the www-data group
|
||||
call(['usermod', '-G', 'www-data', '-a', 'celery'])
|
||||
|
||||
print "Reloading initctl configuration"
|
||||
call(['initctl', 'reload-configuration'])
|
||||
print "Setting Celery to start on boot"
|
||||
|
@ -43,5 +54,5 @@ setup(name='airtime-celery',
|
|||
zip_safe=False,
|
||||
data_files=data_files)
|
||||
|
||||
if data_files:
|
||||
if run_postinst:
|
||||
postinst()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue