XML for config? Really? My eyes hurt a bit ;) Definetly start with what Roberto suggested - run application instance not as emperor + fastrouter, but from command line with --http :8080, to verify if the app itself runs fine under uWSGI. Once you got it running verify that it gets subscribed - check fastrouter logs for "[uwsgi-subscription for ..." and also enable fastrouter stats socket (--fastrouter-stats) so you can check what domains are subscribed.
2013/7/23 Roberto De Ioris <[email protected]> > > > Hi > > > > I'm having trouble running a Django application with uwsgi - every > > request results in a nginx error such as: > > > > 2013/07/23 09:24:07 [error] 14306#0: *1 upstream prematurely closed > > connection while reading response header from upstream, client: > > 127.0.0.1, server: _, request: "GET / HTTP/1.1", upstream: > > > "uwsgi://unix:/home/gmf/working/bugle-frontend.git/run/uwsgi-router.sock:", > > host: "dev1.localhost" > > > > I have the same application running successfully with gunicorn, and > > though I would prefer to use a uwsgi emperor/vassal setup, switching to > > uwsgi has been unsuccessful. > > > > Apart from the above error, all I can say is that the application > > settings (DJANGO_SETTINGS_MODULE) are being imported successfully along > > with anything imported from within the settings module - if I remove > > all *.pyc files and then make a request, then I can see a "settings.pyc" > > and "local_settings.pyc" are created but no other "*.pyc" file, > > specifically no "urls.pyc" appears and this would obviously be necessary > > for a successful request. > > > > Not sure what to do next, any ideas for how to proceed are welcome. > > Django 1.5, uwsgi version 1.9.13 and 1.9.14 > > > > gmf > > > > Emperor Conf > > ============ > > > > <uwsgi> > > <emperor>/home/gmf/working/bugle-frontend.git/etc/vassals</emperor> > > > <fastrouter>/home/gmf/working/bugle-frontend.git/run/uwsgi-router.sock</fastrouter> > > <master/> > > <socket>/home/gmf/working/bugle-frontend.git/run/uwsgi.sock</socket> > > <logto>/home/gmf/working/bugle-frontend.git/log/uwsgi.log</logto> > > > <emperor-pidfile>/home/gmf/working/bugle-frontend.git/run/uwsgi.pid</emperor-pidfile> > > > > > <fastrouter-subscription-server>/home/gmf/working/bugle-frontend.git/run/uwsgi-broker.sock</fastrouter-subscription-server> > > </uwsgi> > > > > Vassal Conf > > =========== > > > > <uwsgi> > > <logto>/home/gmf/working/bugle-frontend.git/log/vassal0.log</logto> > > <chdir>/home/gmf/working/bugle-instance-skeleton.git</chdir> > > <socket-timeout>60</socket-timeout> > > <env>DJANGO_SETTINGS_MODULE=instance.settings</env> > > <harakiri>90</harakiri> > > <socket>/home/gmf/working/bugle-frontend.git/run/vassal0.sock</socket> > > <module>instance.wsgi</module> > > <post-buffering>2048</post-buffering> > > > <subscribe_to>/home/gmf/working/bugle-frontend.git/run/uwsgi-router.sock:dev1.localhost</subscribe_to> > > > <subscribe_to>/home/gmf/working/bugle-frontend.git/run/uwsgi-router.sock:dev2.localhost</subscribe_to> > > <vacuum/> > > <pythonpath>/home/gmf/working/bugle-instance-skeleton.git</pythonpath> > > > <pythonpath>/home/gmf/working/bugle-instance-skeleton.git/develop-src/johnny-cache</pythonpath> > > > > ... lots of pythonpath directives ... > > > > </uwsgi> > > > > Nginx Conf > > ========== > > > > upstream backend { > > server > > unix:/home/gmf/working/bugle-frontend.git/run/uwsgi-router.sock > > fail_timeout=0; > > } > > > > server { > > > > server_name _; > > listen 80; > > > > [...] > > > > location @cache_miss { > > # Pass some client identification headers back to dynamic > > server > > proxy_set_header Host $host; > > proxy_set_header X-Real-IP $remote_addr; > > proxy_set_header X-Forwarded-For > > $proxy_add_x_forwarded_for; > > proxy_set_header X-Scheme $scheme; > > proxy_redirect off; > > > > > > uwsgi_pass backend; > > include uwsgi_params; > > > > } > > } > > > > Emperor log > > =========== > > > > *** Starting uWSGI 1.9.14 (32bit) on [Tue Jul 23 11:36:13 2013] *** > > compiled with version: 4.6.3 on 23 July 2013 09:09:09 > > os: Linux-3.2.0-49-generic #75-Ubuntu SMP Tue Jun 18 17:40:13 UTC 2013 > > nodename: orbital > > machine: i686 > > clock source: unix > > pcre jit disabled > > detected number of CPU cores: 2 > > current working directory: /home/gmf/working/bugle-frontend.git/run > > detected binary path: /home/gmf/working/bugle-frontend.git/bin/uwsgi > > your processes number limit is 7825 > > your memory page size is 4096 bytes > > detected max file descriptor number: 1024 > > lock engine: pthread robust mutexes > > writing pidfile to /home/gmf/working/bugle-frontend.git/run/uwsgi.pid > > *** starting uWSGI Emperor *** > > uWSGI fastrouter bound on > > /home/gmf/working/bugle-frontend.git/run/uwsgi-router.sock fd 3 > > uWSGI fastrouter subscription server bound on > > /home/gmf/working/bugle-frontend.git/run/uwsgi-broker.sock fd 4 > > uwsgi socket 0 bound to UNIX address > > /home/gmf/working/bugle-frontend.git/run/uwsgi.sock fd 7 > > Python version: 2.7.3 (default, Apr 10 2013, 06:03:17) [GCC 4.6.3] > > *** has_emperor mode detected (fd: 6) *** > > [uWSGI] parsing config file vassal0.xml > > *** Python threads support is disabled. You can enable it with > > --enable-threads *** > > Python main interpreter initialized at 0x9bf1378 > > your server socket listen backlog is limited to 100 connections > > your mercy for graceful operations on workers is 60 seconds > > mapped 128008 bytes (125 KB) for 1 cores > > *** Operational MODE: single process *** > > *** no app loaded. going in full dynamic mode *** > > *** uWSGI is running in multiple interpreter mode *** > > spawned uWSGI master process (pid: 15782) > > spawned uWSGI worker 1 (pid: 15785, cores: 1) > > spawned uWSGI fastrouter 1 (pid: 15786) > > > > Vassal log > > ========== > > > > *** Starting uWSGI 1.9.14 (32bit) on [Tue Jul 23 11:36:13 2013] *** > > compiled with version: 4.6.3 on 23 July 2013 09:09:09 > > os: Linux-3.2.0-49-generic #75-Ubuntu SMP Tue Jun 18 17:40:13 UTC 2013 > > nodename: orbital > > machine: i686 > > clock source: unix > > pcre jit disabled > > detected number of CPU cores: 2 > > current working directory: > > /home/gmf/working/bugle-frontend.git/etc/vassals > > detected binary path: /home/gmf/working/bugle-frontend.git/bin/uwsgi > > your processes number limit is 7825 > > your memory page size is 4096 bytes > > detected max file descriptor number: 1024 > > lock engine: pthread robust mutexes > > uwsgi socket 0 bound to UNIX address > > /home/gmf/working/bugle-frontend.git/run/vassal0.sock fd 3 > > Python version: 2.7.3 (default, Apr 10 2013, 06:03:17) [GCC 4.6.3] > > *** Python threads support is disabled. You can enable it with > > --enable-threads *** > > Python main interpreter initialized at 0x8880830 > > your server socket listen backlog is limited to 100 connections > > your mercy for graceful operations on workers is 60 seconds > > mapped 144392 bytes (141 KB) for 1 cores > > *** Operational MODE: single process *** > > added /home/gmf/working/bugle-instance-skeleton.git/ to pythonpath. > > [...] > > WSGI app 0 (mountpoint='') ready in 1 seconds on interpreter 0x8880830 > > pid: 15784 (default app) > > *** uWSGI is running in multiple interpreter mode *** > > spawned uWSGI master process (pid: 15784) > > spawned uWSGI worker 1 (pid: 15787, cores: 1) > > > > > > _______________________________________________ > > uWSGI mailing list > > [email protected] > > http://lists.unbit.it/cgi-bin/mailman/listinfo/uwsgi > > > > > Sory, but can you make a simple setup without the fastrouter and the > subscription system to check if the django part is ok ? What you are > experiencing is the fastrouter closing the connection as no backend is > registered. Before starting dealing with it i would ensure the "simple > parts" are ok > > -- > Roberto De Ioris > http://unbit.it > _______________________________________________ > uWSGI mailing list > [email protected] > http://lists.unbit.it/cgi-bin/mailman/listinfo/uwsgi > -- Łukasz Mierzwa
_______________________________________________ uWSGI mailing list [email protected] http://lists.unbit.it/cgi-bin/mailman/listinfo/uwsgi
