1

I'm trying to configure uWSGI for an application (Django) that uses http & websocket queries.
Here is the uWSGI ini file that I did to achieve this

[uwsgi]
ini = :runserver
ini = :wsserver

[default]
userhome = /home/myuser
virtualenv = %(userhome)/.virtualenvs/myapp
chdir = %(userhome)/Documents/myapp
master = true
no-orphans = true
uid = www-data
gid = www-data
threads = 1
env = DJANGO_SETTINGS_MODULE=myapp.settings
vacuum = true

[runserver]
ini = :default
socket = /tmp/myapp.sock
module = wsgi_django
buffer-size = 32768
processes = 4

[wsserver]
ini = :default
http-socket = /tmp/myapp_websocket.sock
module = wsgi_websocket
processes = 2
http-websockets = true
gevent = 1000

As you can see I'm including both my services runserver & websocket from uwsgi.
I see nginx and uwsgi communicating between them but nginx always returns me

NetworkError: 502 Bad Gateway

I see no error in uwsgi log but if I comment one of them, the other works.

Can somebody help me to debug that ?

Pierre de LESPINAY
  • 44,700
  • 57
  • 210
  • 307
  • it looks like you want to spawn two unrelated instances, while effectively you are spawning a single one. Remove the [uwsgi] section and invoke 2 different instances using the uwsgi --ini file:section syntax or the Emperor – roberto Apr 15 '14 at 15:15
  • Yeah that's about what I did finally but I don't find this very maintainable. I wanted to regroup these 2 instances in one config file because they are linked to the same application, and their default values only applies to them... I though uWSGI allows to configure multiple instances in one file. – Pierre de LESPINAY Apr 15 '14 at 15:29
  • you can maintain the two configs in the same file, just ensure to spawn 2 different instances pointing to the same file but different sections – roberto Apr 15 '14 at 15:41
  • I see, as I'm in emperor mode I don't know how to specify the sections to load... – Pierre de LESPINAY Apr 15 '14 at 15:49

1 Answers1

0

I ended up by using 2 different files and repeating the common settings on each

Pierre de LESPINAY
  • 44,700
  • 57
  • 210
  • 307