Celery flower as a daemon

I run celery with redis backend

I know that flowers are tornado applications, so I should use a process to run the tornado application as Deamon

Usually I start using this command:

I see in the following link that I need to create a python script: http://www.charleshooper.net/blog/python-starting-tornado-apps-at-boot-using-upstart/ (Startflower.py)

import tornado.ioloop
import tornado.web
import tornado.httpserver 

if __name__ == "__main__":
    http_server = tornado.httpserver.HTTPServer(application)
    http_server.listen(port)
    tornado.ioloop.IOLoop.instance().start()

However, I'm not sure what to put in the "application" variable I tried "celery flower - agent = redis: / / localhost" and "celery flower", but they didn't work

What do I need to do to make it work as a daemon?

Solution

You can use it as a command line program and run it under the supervisor daemon This is a common solution in the python world (although supervisor can be used with any command, not just Python), and I always use it

The supervisor makes the program think it is still running in the terminal There are many examples of how to use supervisor, but I can find an example here for Python proxy server and scroll down to "install proxy server as a service"

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>