Open mrmachine opened 9 years ago
@sjdines
Actually, looks like the problem we were having was not that the port number wasn't random enough. It wasn't conflicting with another app. It was just that there was already another supervisor process running for the same app.
So when we tried to start it either via system level supervisor OR manually, it was unable to access the port. I think we just needed to do ./manage.py supervisor shutdown
to kill the existing process, then we could restart it from command line or from system level supervisor.
https://github.com/rfk/django-supervisor - "automatic control socket config"
We should investigate how "random-ish" it is, how "fixed" it is, and why it is occasionally conflicting. Maybe we can make it more random, or more deterministic.
Alternatively, when this conflict occurs, you can work-around the issue by specifying a port number in
supervisor.conf
:Perhaps we can automatically extract the port number from the
SUPERVISOR['ADDRESS']
setting and add 10,000 to it (as a default) and use that as the supervisor port number?But a unix socket might be better, if we can put it in the project directory so we don't have to worry about port numbers:
Unfortunately, the socket server only seems to work when run as root which negates a lot of the benefit that
django-supervisor
provides.