Reputation: 369
I have Ubuntu 14.04.4 LTS running as a vagrant environment under virtualbox. In this box I have this configuration:
supervisor 3.0b2
python 3.4 under virtualenvironment
celery 3.1.23
flower 0.9.1
A flower configuration under supervisor is:
[program:flower]
command=/home/vagrant/.virtualenvs/meridian/bin/python /vagrant/meridian/meridian/manage.py celery flower --loglevel=INFO -conf=/vagrant/meridian/meridian/meridian/flowerconfig.py
directory=/vagrant/meridian/meridian
user=vagrant
autostart=true
autorestart=true
stdout_logfile=/var/log/supervisor/flower-stdout.log
stderr_logfile=/var/log/supervisor/flower-stderr.log
priority=997
stdout_logfile_maxbytes=10MB
stdout_logfile_backups=5
stderr_logfile_maxbytes=10MB
stderr_logfile_backups=5
The flowerconfig.py is an empty file. So all the values are default. Host is localhost and port is 5555.
When I run flower from a command line:
vagrant@localhost> flower
it is run as it should and I see the tasks result in my browser, visiting an address localhost:5555.
netstat shows me the ports that are listened:
vagrant@localhost> netstat -l | grep 5555
tcp 0 0 *:5555 *:* LISTEN
tcp6 0 0 [::]:5555 [::]:* LISTEN
So, it is OK.
When I run flowe under supervisor in this way:
vagrant@localhost> sudo supervisorctl start flower
it starts as it should. Netstat shows that port 5555 are listened. But a query from a browser just hangs.
Why flower doesn't reply under supervisor ?
Upvotes: 2
Views: 1074
Reputation: 369
I have found a solution. The problem was that I ran flower not under my virtual environment. I added a shell file "start_flower.sh":
source /usr/share/virtualenvwrapper/virtualenvwrapper.sh
source /home/vagrant/.virtualenvs/meridian/bin/activate
workon meridian
exec flower --conf=/vagrant/meridian/meridian/meridian/flowerconfig.py
and it started works as it should.
Then I rewrited supervisor's configuration for flower in this way:
[program:flower]
command=bash -c "/vagrant/meridian/meridian/start_flower.sh"
directory=/vagrant/meridian/meridian
user=vagrant
autostart=true
autorestart=true
stdout_logfile=/var/log/supervisor/flower-stdout.log
stderr_logfile=/var/log/supervisor/flower-stderr.log
priority=997
stdout_logfile_maxbytes=10MB
stdout_logfile_backups=5
stderr_logfile_maxbytes=10MB
stderr_logfile_backups=5
stopasgroup=true
killasgroup=true
and now everything is good.
Note: I want to draw your attention to fact that I run flower in shell file with "exec":
exec flower --conf=/vagrant/meridian/meridian/meridian/flowerconfig.py
I use this there because when I use that construction:
flower --conf=/vagrant/meridian/meridian/meridian/flowerconfig.py
I had a problew - shell file process was terminated with:
sudo supervisorctl stop flower
But flower process was working anyway!
So if you would face with such kind of problem always use 'exec'. This is a good additional information for such cases:
http://veithen.github.io/2014/11/16/sigterm-propagation.html
Upvotes: 1