Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a way to automatically reload Supervisor processes?

Tags:

supervisord

I have a dev server which I often push code changes to over Git. After each push, I need to manually log into the server and restart the supervisor processes.

Is there a way to have Supervisor monitor a filesystem directory for changes and reload the process(es) on changes?

like image 330
Naftuli Kay Avatar asked Nov 26 '13 21:11

Naftuli Kay


People also ask

How do I restart my supervisor service?

Start / Stop a Service To start a non-running service or stop a running one, use supervisorctl start my-daemon and supervisorctl stop my-daemon . To restart a service, you can also use supervisorctl restart my-daemon .

How do I stop Supervisord daemon?

Finally, you can exit supervisorctl with Ctrl+C or by entering quit into the prompt: supervisor> quit.

What is supervisor command?

In Linux, Supervisor is a client/server system that allows its users to monitor and control a number of processes on Linux or UNIX-like operating systems. Whenever we want, Processes can be stopped and started as a unit. It starts its sub-processes via fork/exec.


1 Answers

You should be able to use an Event Listener which monitors the filesystem (with perhaps watchdog) and emits a restart using the XML-RPC API. Check out the memmon listener from the superlance package for inspiration. It wouldn't need to be that complicated. And since the watchdog would call your restart routine you don't need to read the events using childutils.listener.wait.

Alternatively, git hooks might do the trick if the permissions are correct for the supervisord API to be accessed (socket permissions, HTTP passwords). A simpler but less-secure approach.

A simpler and even less-secure approach would be to allow you to issue a supervisorctl restart. The running user has to match your push user (or git, or www, depending on how you have it setup). Lot's of ways to have it go wrong security-wise. But for development, might do fine.

Related:

  • Supervisord: is there any way to touch-reload a child?
like image 132
soulseekah Avatar answered Nov 25 '22 20:11

soulseekah