1

I have a small Python flask webserver on an Ubuntu box (ngnix and uwsgi) that I just started using to receive and process webhooks. Part of the webhook processing can include sending an email, which I noticed causes a delay and subsequently blocks the response back to the server sending the webhook.

In researching a way to mitigate this, I discovered python-rq (aka rq), which lets me queue up a function call and then immediately respond to the webhook. In testing, this works great!

I'm testing it on my server, and to start rq I have to run rqworker in the same directory as my website. This is great for testing, but I don't want to have to log into the server to start rq just to keep in running.

Some ideas I've come across:

This is a small internal-only server. I don't want to over-engineer it (I feel like I'm creeping in that direction already), but I also don't want to have to babysit it to make sure all of the pieces are working.

How can I set up rqworker to run in the web site application directory on its own?

Ben McCormack
  • 32,086
  • 48
  • 148
  • 223
  • Since you're on Ubuntu, an upstart script would probably be the easiest thing. – Daniel Roseman Sep 01 '15 at 16:07
  • 2
    There is not much overhead at all to supervisor. This, or another daemon, is really the best way to go about this. It can be a bit hard to figure out if you are new, but all you're really doing is asking the daemon to run a command. – Patrick Allen Sep 02 '15 at 03:38
  • 2
    Supervisor is the standard way to run non-quite-well-behaving-daemon scripts on even Ubuntu. And it is faster to write config for supervisor than trying to write an upstart script. – Antti Haapala -- Слава Україні Sep 02 '15 at 08:01

0 Answers0