The theme of this commit is to make the install process more
resiliant to differences in distros by testing for specific
features or versions of executables rather than making as many
assumptions just on the distro and release.
* Distro and Release detection (install, Vagrantfile)
- Added detection logic for distro and release based on
/etc/os-release which is available on all potential supported
distros. The --distribution and --release options can be used
to override detection.
- Added distro and release checks to ensure values specified are
for a supported release.
- Changed some distro checks to use booleans, e.g.
if $is_centos_7; then ...
- Added a simple check so if --distribution is specified, it will
ensure it's at least sane, e.g. centos on debian or debian on
centos will be caught.
- In Vagrantfile, removed --distribution and --release options for
all distro and release combinations.
* Portable Init System Detection and Management (install, centos.sh)
- Added detection logic for init system type - systemd, Upstart or
System V in the function systemInitDetect().
- Added portable init system install in the function
systemInitInstall() which depends on systemInitDetect(). After
installing files, enables and starts service.
- Added portable init system commands in the function
systemInitCommand() for start, stop, reload, restart and status.
- Python services don't support systemd but unconditionally install
scripts for both Upstart and System V. Disabled by passing
--no-init-script to setup.py for each service.
- When upgrading, remove all old system init files in /etc/init,
/etc/init.d, /etc/default and /etc/systemd/system.
- In centos.sh, removed install of airtime systemd service files
as it's now handled by install.
- Created an Upstart .conf for airtime-celery
- In systemd file for airtime-celery, changed absolute path to
/usr/local/bin/celery and for centos, the install symlinks
celery to /usr/local/bin.
* External Dependencies Install (install)
- For external dependencies, only attempt to install for Debian-
based distros with apt-get. For centos, a warning is displayed.
- For systems with apt-get, detect version and if 1.1 or greater,
use new force options, otherwise use --force-yes option.
* Configuring Apache (install)
- For Apache, check for centos and use httpd for binary and
service, otherwise use apache2ctl and apache2.
- Detect Apache version 2 or better in a more reliable manner.
- Detect Apache root folder and conf file name by running
apache2ctl -V or httpd -V as appropriate.
- Various checks for centos as it doesn't support the Debian
Apache utilities a2ensite/a2dissite, a2enmod/a2dismod, etc.
* Installing Airtime Services (install)
- Detect Python version. If less than 2.7.9, install OpenSSL
support.
- Prevent installing init files by passing --no-init-script to
setup.py for each service.
- Use systemInitInstall to install, enable and start each service
after setup.py has run.
- Removed filtering for WEB_USER for files in
/etc/init/airtime*.template as that is handled in the
systemInitInstall() function.
* Configuring PHP in Apache (install)
- Detect PHP conf folder by checking a list of locations rather
than making assumptions based on the distro and release.
* Configuring PostgreSQL (install)
- Detects if the airtime user has already been created. If not,
then creates the user.
* Installing Locales (install)
- Minor changes to check for centos and prevent from running.
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.