Closed seraph-g closed 4 years ago
The uvicorn
library with the --fd
option, it doesn't seem to be supported by windows because it uses a unix socket.
uvicorn/main.py
In windows the line above should be as follows:
sock = socket.fromfd(config.fd, socket.AF_INET, socket.SOCK_STREAM)
However after I made the necessary corrections in the supervisor and also in the uvicorn I was able to make the two work together.
Realize that there is a difference in the documented configuration of the supervisor.
This is because on windows sharing file descriptor works differently.
socket_fd_param=--fd
(It is the name of the option that would be placed in the command)
[fcgi-program:uvicorn]
socket=tcp://127.0.0.1:8105
command="C:\Python37\python.exe" -m uvicorn app:run
socket_fd_param=--fd
numprocs=2
#directory=%(here)s
process_name=uvicorn-%(process_num)d
#stdout_logfile=%(here)s/uvicorn.log
autorestart = false
redirect_stderr=true
Changes have been applied to the windows branch https://github.com/alexsilva/supervisor/commit/fdb591317068a9c129a04bd7f5c2ddbc18f9e6d2
If you want to test install from git
python -m pip install git+https://github.com/alexsilva/supervisor.git@windows -U
The new supervisor implementation solves the fastcgi problem but the web server needs to support AF_INET
sockets with socket.fromfd.
https://docs.python.org/2/library/socket.html#socket.AF_INET
Thanks! I actually already modified Uvicorn to get it running with AF_INET sockets before, so the tweak to Supervisor is all I need!
I truly cannot for the life of me figure out what the issue is, I'm trying to move over from circus and would like to run this Uvicorn server with supervisor, but the process keeps exiting for some reason.
Config:
supervisord.log:
uvicorn.log: