Running Flower using Supervisor
Asked Answered
A

1

8

Am having challanges starting flower using supervisor.

The following command in my development environment works on the console

celery --app=celery_conf.celeryapp flower --conf=flowerconfig

but moving to production to use supervisor am getting all sorts of errors

/supervisor/conf.d/flower.conf

[program:flower]
command=/opt/apps/venv/my_app/bin/celery flower --app=celery_conf.celeryapp --conf=flowerconfig
directory=/opt/apps/my_app
user=www-data
autostart=true
autorestart=false
redirect_stderr=true
stderr_logfile=/var/log/celery/flower.err.log
stdout_logfile=/var/log/celery/flower.out.log

With the above configuration, there is no error but all celery does is give me a help like output. Its like it doesn't acknowledge the variables passed.

 Type 'celery <command> --help' for help using a specific command.
 Usage: celery <command> [options]
 Show help screen and exit.
 Options:
   -A APP, --app=APP     app instance to use (e.g. module.attr_name)
   -b BROKER, --broker=BROKER
                         url to broker.  default is 'amqp://guest@localhost//'
   --loader=LOADER       name of custom loader class to use.
   etc..
   etc..
   etc...

Supervisor on the other hand throws INFO exited: flower (exit status 64; not expected)

I have other supervisor initiated apps using celery_beat and using the configuration file samples on github and they are working well with the same directory paths as above

The flowerconfig is as below:

flowerconfig.py

# Broker settings
BROKER_URL = 'amqp://guest:guest@localhost:5672//'

# RabbitMQ management api
broker_api = 'http://guest:guest@localhost:15672/api/'

#Port
port = 5555

# Enable debug logging
logging = 'INFO'

Solution:

Well, not really a solution so I haven't put it as an answer. Turned out there was a problem with my virtual environment. So I removed flower and installed again using pip3.4 as am on python3.4

Something to note though is that for flower to use your flowerconfig file, you need to add a director=/path/to/your/celery_config/folder/ entry in supervisor's /etc/supervisor/conf.d/flower.conf file else flower will launch with default settings.

/etc/supervisor/conf.d/flower.conf

; ==================================
;  Flower: For monitoring Celery
; ==================================
[program:flower]
command=/opt/apps/venv/my_app/bin/celery flower --app=celery_conf.celeryapp --conf=flowerconfig
directory=/opt/apps/my_app/celery_conf #this is key as my configuration file was in the `celery_conf` folder
user=www-data
autostart=true
autorestart=false
redirect_stderr=true
stderr_logfile=/var/log/celery/flower.err.log
stdout_logfile=/var/log/celery/flower.out.log

Thanks.

Anthropolatry answered 18/11, 2014 at 2:45 Comment(0)
W
2

Your supervisor is unable to locate celeryapp. My be your supervisor configuration file supervisor.conf is in different path.

You can pass directory option to supervisor process. So you can try

[program:flower]
directory = /opt/apps/venv/my_app/
command =  celery --app=celery_conf.celeryapp flower

This starts a new flower instance.

Also note celery conf and flower conf are different.

Watersick answered 18/11, 2014 at 5:44 Comment(6)
Looks like you answered as I was editing the question. I think I resolved the path errors. Now all am getting is help like output from celery with the new configuration. Note that I have two directories opt/apps/venv/my_app which is the virtual environment for the application and also /opt/apps/my_app which is where the application resides..Anthropolatry
does your command works correctly on the command line? what do you have in your flowerconfig?Watersick
Yes it works fine. The flowerconfig has got basic settings. I've added the settings to the question..Anthropolatry
Turned out there was a problem with the virtual environment installation. I've posted final working conf fileAnthropolatry
Where can I find flowerconfig.py file.?Rist
@AlbinAntony You have to create one.Watersick

© 2022 - 2024 — McMap. All rights reserved.