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?
I also didn't find any solution so I tried to make my own. Here it is.
You can install the package by this command:
pip install git+https://github.com/stavinsky/supervisord-touch-reload.git
(I will add it to PyPI after adding some tests. )
An example of setting up supervisor located in examples folder in github. Documentation will be very soon, I believe.
Basically all you need to start use this module is add event listener with command
like:
python -m touch_reload --socket unix:///tmp/supervisor.sock --file <path/to file file> --program <program name>
where file
is a file that will be monitored with absolute or relative to directory
path, socket
is the socket from supervisorctl
section and program
is program name from [program:<name>]
section definition.
Also available --username
and --password
, that you can use if you have custom supervisor configuration.