Configurer celeryd pour gérer les agents¶
- Sous Debian configurer le fichier /etc/default/celeryd comme ceci :
# Edit the options in this file to match your projects environment. # See http://ask.github.com/celery/cookbook/daemonizing.html for the complete # documentation on the options. # WARNING: This script is only designed to run the worker(s) for a single # project. If you need to start workers for multiple projects you should # consider using supervisor. # Examples can be found in /usr/share/doc/python-celery/supervisord/ export HOBO_SETTINGS_FILE='/etc/hobo/agent.py' # Change this to true when done to enable the init.d script. # Default: false ENABLED="true" # Name of nodes to start # here we have a single node CELERYD_NODES="hobo-agents" # or we could have three nodes: #CELERYD_NODES="w1 w2 w3" # Where to chdir at start. CELERYD_CHDIR="/" # Extra arguments to celeryd CELERYD_OPTS="--time-limit=300 --concurrency=2 -A hobo.agent" # Name of the celery config module. CELERY_CONFIG_MODULE="celeryconfig" # %n will be replaced with the nodename. CELERYD_LOG_FILE="/var/log/celery/%n.log" # Workers should run as an unprivileged user. CELERYD_USER="celery" CELERYD_GROUP="celery"
- Relancer celeryd :
sudo /etc/init.d/celeryd restart
Configurer l'agent wcs¶
- Rajouter wcs-au-quotidien dans le groupe hobo afin qu'il puisse lire le fichier /etc/hobo/secret
- Configurer le serveur hobo dans /etc/hobo/server.py pour fournir des templates :
SERVICE_TEMPLATES = { 'wcs': [('export.wcs', u'Montpellier agglo template')], }
- Configurer l'agent hobo wcs dans /etc/hobo/agent.py comme par exemple :
AGENT_HOST_PATTERNS = { 'wcs': ['*-site.montpellier.entrouvert.org',], } AGENT_WCS_APP_DIR = '/var/lib/wcs-au-quotidien' AGENT_WCS_COMMAND = 'sudo -u wcs-au-quotidien /usr/sbin/wcsctl -f /etc/wcs/wcs-au-quotidien.cfg check-hobos'
- Donner les droits sudo à l'utilisateur celery pour qu'il puisse exécuter la commande ci-dessus :
- sudo /usr/sbin/visudo
- puis ajouter la ligne suivante :
celery ALL=(wcs-au-quotidien)NOPASSWD:/usr/sbin/wcsctl -f /etc/wcs/wcs-au-quotidien.cfg check-hobos