multiple daphne processes with supervisord and UNIX socket
See original GitHub issueSetup daphne
with supervisord
and nginx
as shown in the docs is working.
https://channels.readthedocs.io/en/latest/deploying.html#nginx-supervisor-ubuntu
But changing from TCP to UNIX socket for the fcgi
process group results in daphne
not responding to requests.
Run as single program in supervisor
[program:current.example.com_daphne]
command = /srv/current.example.com/env/bin/daphne --unix-socket /srv/current.example.com/run/daphne.sock --proxy-headers crm.asgi:application
directory = /srv/current.example.com/src/
environment = LANGUAGE=en_US.UTF-8,LANG=en_US.UTF-8,LC_ALL=en_US.UTF-8,PYTHONPATH='/srv/current.example.com/env/'
user = www-data
Request
root@crm:# curl -v --no-buffer --unix-socket /srv/current.example.com/run/daphne.sock "http://current.example.com/dashboard/"
* Trying /srv/current.example.com/run/daphne.sock...
* Connected to current.example.com (/srv/current.example.com/run/daphne.sock) port 80 (#0)
> GET /dashboard/ HTTP/1.1
> Host: current.example.com
> User-Agent: curl/7.58.0
> Accept: */*
>
< HTTP/1.1 302 Found
< Content-Type: text/html; charset=utf-8
< Location: /auth/login/?next=/dashboard/
< X-Frame-Options: SAMEORIGIN
< Vary: Accept-Language, Cookie
< Content-Language: de
< Content-Length: 0
<
* Connection #0 to host current.example.com left intact
Run as fcgi-program in supervisor
[fcgi-program:demo.example.com_daphne]
command = /srv/demo.example.com/env/bin/daphne --fd 0 --proxy-headers crm.asgi:application
directory = /srv/demo.example.com/src/
environment = LANGUAGE=en_US.UTF-8,LANG=en_US.UTF-8,LC_ALL=en_US.UTF-8,PYTHONPATH='/srv/demo.example.com/env/'
user = www-data
socket=unix:///srv/demo.example.com/run/daphne.sock
numprocs = 2
Request
root@crm:# curl -v --no-buffer --unix-socket /srv/demo.example.com/run/daphne.sock "http://demo.example.com/dashboard/"
* Trying /srv/demo.example.com/run/daphne.sock...
* Connected to demo.example.com (/srv/demo.example.com/run/daphne.sock) port 80 (#0)
> GET /dashboard/ HTTP/1.1
> Host: demo.example.com
> User-Agent: curl/7.58.0
> Accept: */*
>
* Recv failure: Connection reset by peer
* stopped the pause stream!
* Closing connection 0
curl: (56) Recv failure: Connection reset by peer
Issue Analytics
- State:
- Created 4 years ago
- Reactions:5
- Comments:10 (3 by maintainers)
Top Results From Across the Web
python - Can you configure Supervisor + multiple Daphne ...
I'm trying to configure the following setup: Django w/ channels; Multiple Daphne processes as the ASGI server, with ssl endpoints ...
Read more >Channels: development issue with multiple daphne workers
I am trying to migrate a tornado project to django channel2. I have moved all essential parts and wired them up in channel....
Read more >Deploying — Channels 4.0.0 documentation
The Channels project maintains an official ASGI HTTP/WebSocket server, Daphne, ... You should run Daphne inside either a process supervisor (systemd, ...
Read more >Unable to get Django Channels Daphne Nginx Supervisor ...
I am not using Gunicorn. I just can't get it to work, server side processes are not my forte so if someone with...
Read more >Configuring ASGI Django Application using Daphne and ...
Daphne is a HTTP, HTTP2 and WebSocket protocol server for ASGI ... In order to daemonize this process, I used systemd process supervisor....
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I finally fixed my websocket connection. I discovered Ubuntu18.04 standard apt repositories provide redis v4, and Channels Redis requires >=v5.
@carltongibson thanks - it is in the Channels Redis docs, but i hadn’t thought to look there until i got logging fully working and found where thing broke! The Redis docs recommend installing from source, which i hadn’t done, as i was using Ansible for deployment and it was easier just to use apt.