Reputation: 849
I'm trying to deploy my Django application with supervisor. When I launch supervisor it starts daphne correctly, however the worker servers are not launched.
Here's a code sample of supervisor.conf (the workers block):
[program:runworker]
command=python /home/django/environment/myproject/manage.py runworker
stopsignal=KILL
killasgroup=true
The browser waits a long time and then it shows:
503 Service Unavailable
Worker server failed to respond within time limit.
I could also add that if I launch the processes independently (not using any process control system ) it actually works. I'm behind an Nginx reverse proxy, but I don't think that's the issue at all..
Here's the output of Supervisor:
2016-08-17 19:01:09,439 INFO supervisord started with pid 3473
2016-08-17 19:01:10,441 INFO spawned: 'runworker' with pid 3477
2016-08-17 19:01:10,442 INFO spawned: 'daphne' with pid 3478
2016-08-17 19:01:11,421 DEBG 'daphne' stderr output:
2016-08-17 23:01:11,421 INFO Starting server at 0.0.0.0:9000, channel layer myproject.asgi:channel_layer
2016-08-17 19:01:11,519 INFO success: runworker entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)
2016-08-17 19:01:11,519 INFO success: daphne entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)
2016-08-17 19:01:11,591 DEBG 'runworker' stderr output:
2016-08-17 23:01:11,591 - INFO - runworker - Running worker against channel layer default (asgi_redis.core.RedisChannelLayer)
2016-08-17 19:01:11,592 DEBG 'runworker' stderr output:
2016-08-17 23:01:11,592 - INFO - worker - Listening on channels http.request, websocket.connect, websocket.disconnect, websocket.receive
Upvotes: 3
Views: 2238
Reputation: 4230
You have to increase time limit and increasing capacity throughput is higher than 100 messages a second
CHANNEL_LAYERS = {
"default": {
"BACKEND": "asgi_redis.RedisChannelLayer",
"CONFIG": {
"hosts": [(XXX, XXX)],
"channel_capacity": {
"http.request": 200,
"websocket.send*": 20,
},
},
"ROUTING": "XXXXXchannel_routing"
},
}
Upvotes: 1
Reputation: 5844
You probably need to set the DJANGO_SETTINGS_MODULE environment variable.
This answer provides an example: https://stackoverflow.com/a/26732916/4193
Upvotes: 1