sintonia/python_apps/airtime-celery
Lucas Bickel c29285ae48 Vagrant Debian support (and experimental CentOS)
This changes the Vagrant setup to support multiple installations as multiple
boxes. In addition to Ubuntu Vagrant can now be used to install on Debian
as well as on CentOS.

I took the chance to clean up the .deb install a bit and backported analyzer
and celery to SysV proper so it runs there. Some of the distro specfics were
moved to the install script from the python setup scripts to acheive this.

For the CentOS support I added a rather involved OS prepare script. In the
long term this will be added to the preparing-the-server docs we already have.

I had to switch the default port to http-alt (8080). On CentOS 9080 is registered
for ocsp and getting it to work for apache without hacking SELinux is hard. I
think 8080 is the RFC way to go anyhow. If anyone want to override this it
should be rather easy using the --web-port arg and by hacking Vagrantfile.

The PyOpenSSL code has been refactored for all the distros that the Vagrantfile
now supports.

As far as my checks go, I tried this code with all the distros, uploaded a track
and downloaded a unicode and a ssl podcast and was able to listen to them
in each case.

In the experimental CentOS case, the UI is not up to spec since services
need to get scheduled through systemctl and the status overview (ie. on the /?config page)
do not work properly. They need to be as follows:

```
sudo systemctl start airtime-playout
sudo systemctl start airtime-liquidsoap
sudo systemctl start airtime_analyzer.service
sudo systemctl start airtime-celery.service
```
2017-03-12 13:42:22 +01:00
..
airtime-celery Fix unicode issues in podcast downloader 2017-03-11 21:01:52 +01:00
install Remove saas-specific configurations 2015-06-12 12:50:35 -04:00
MANIFEST.in Update installer to work with saas branch 2015-06-23 19:02:55 -04:00
README.rst Rewrite config from /etc/airtime-saas to plain /etc/airtime 2017-03-03 15:57:41 +01:00
setup.py Vagrant Debian support (and experimental CentOS) 2017-03-12 13:42:22 +01:00

README.rst

airtime-celery
==============

airtime-celery is a Celery_ daemon for handling backend tasks asynchronously.
Communication and the Celery results backend are both handled with amqp (RabbitMQ).

Installation
============

    $ sudo python setup.py install

Each instance of airtime-celery has its own worker, and multiple instances can be run in parallel.
`Celery is thread-safe`_, so this parallelization won't cause conflicts.

.. _Celery: http://www.celeryproject.org/
.. _Celery is thread-safe: http://celery.readthedocs.org/en/latest/userguide/application.html

Usage
=====

This program must be run with sudo:

    $ sudo service airtime-celery {start | stop | restart | graceful | kill | dryrun | create-paths}

Developers
==========

To debug, you can run celery directly from the command line:

    $ cd /my/airtime/root/python_apps/airtime-celery
    $ RMQ_CONFIG_FILE=${LIBRETIME_CONF_DIR}/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:

    $ sudo rabbitmqctl set_permissions -p /airtime airtime .\* .\* .\*

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 $LIBRETIME_CONF_DIR/airtime.conf rabbitmq settings. Make sure the settings here align with
       $LIBRETIME_CONF_DIR/$ENVIRONMENT/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.