Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Running Uvicorn with unix socket

Tags:

systemd

uwsgi

I'm having trouble running uvicorn on a unix socket with...

I have tried the below plus every combination I can think of, both in the command line and in systemd Unit file as well...

env/bin/uvicorn appname.asgi:application --uds unix:/run/uvicorn/appname.sock and every other combination produces a FileNotFoundError: [Errno 2] No such file or directory, but the directory is there...

Am I missing something here? I am not an expert in Ubuntu or systemd, but I was able to set up Nginx and uWSGI pretty easily.

like image 320
mrchestnut Avatar asked Mar 05 '23 08:03

mrchestnut


1 Answers

Well... as it turns out, it was much simpler than I though:

The solution is to NOT use the unix: prefix, only the location of the socket, e.g.:

venv/bin/uvicorn appname.asgi:application --uds /run/uvicorn/appname.sock
like image 65
mrchestnut Avatar answered Mar 07 '23 22:03

mrchestnut