Closed dghant1024 closed 10 years ago
sorry, but the config is completely wrong, i fear you do not have a clear situation about the Emperor, vassals and standard instances. I will try to make a list, but i suggest you to start over from an official quickstart.
Thanks unbit,
I have taken all your suggestions and cleaned the command that I was using along with editing the files to make appropriate corrections. The most important bullet, which was also the cause of most of my dismay, was what you mentioned about "binding the Emperor to an http address requires that address to be configured to route requests to some vassal." It seems that I have misunderstood the instructions here. Listed below is the adjusted command that I execute after reading your response:
/var/www/testbed/env/bin/uwsgi --ini /etc/uwsgi/emperor.ini --http 127.0.0.1:8000
Which still doesn't work. But the command that does work is below:
/var/www/testbed/env/bin/uwsgi --ini /etc/uwsgi/vassals/auth.ini --http 127.0.0.1:8000
What confuses me is that when I run the command directly using the 'auth.ini' file (listed above) everything works. The url (http://127.0.0.1:8000/testbed/auth/admin) is active and available. Though I have read many, many, parts of the the documentation over, and over, again I seem to be misinterpreting what I'm reading; leading me into an abyss-of-ignorance. This leads me to my next question. Is it possible to run uwsgi in 'Emperor' mode without configuring nginx? In my ignorant state I assume that what you mean by "binding the Emperor to an http address" is to use nginx (lighthttp, apache, cherokee, etc) as a proxy !?!? Thanks for your insight thus-far.
yes you can bind an http router/proxy from the Emperor (without the need of nginx or other webservers), but you need to configure it to route requests to vassals using some rule. The Emperor is used to spawn multiple uWSGI instances, so its http router must know to which of them the request must be passed. Generally you use the domain name as the key (something like domain example.com goes to socket :4040). Here you find the options of the http router: http://uwsgi-docs.readthedocs.org/en/latest/Options.html#plugin-http. The most powerful way is the subscription system: http://uwsgi-docs.readthedocs.org/en/latest/SubscriptionServer.html
The docs refer to the fastrouter, but the options are the same just rename --fastrouter-subscription-server to http-subscription-server and your http router will start accepting subscriptions from vassals.
Finally, if you plan to host a single app, do not use the Emperor, it makes no sense.
Thanks ubbit,
I plan on using this configuration for every Django web application I develop under (/var/www/testbed). This will enable me to develop/test multiple applications without restarting/reloading services etc. Your guidance was instrumental in assisting me because I'm not able to run a "configtest" to fault-check my configurations like I'm able to do for an Apache web server (httpd.conf). Also, this link enabled me to sell-the-deal to configure the emperor vessel(s) appropriately -- apparently, Roberto seems to be really sharp and good at was he does. I have listed my working configuration below:
emperor.ini
[uwsgi] shared-socket = 127.0.0.1:3031 http-subscription-server = 127.0.0.1:2626
fastrouter-subscription-server = 127.0.0.1:2626
fastrouter = =0
fastrouter-cheap = true
master = true emperor = /etc/uwsgi/vassals logto = /tmp/uwsgi.log
auth.ini
[uwsgi] subscribe2 = server=127.0.0.1:2626,key=localhost:8888 chdir =/var/www/testbed/project/auth module = auth.wsgi:application home =/var/www/testbed/env virtualenv =/var/www/testbed/env enable-threads = true pythonpath = /var/www/testbed/project/auth processes = 1 socket = 127.0.0.1:0 vacuum = true
Command execution:
/var/www/testbed/env/bin/uwsgi --ini emperor.ini --http :8888
When I run uswsgi services WITHOUT running it in emperor mode my django website runs just fine. No matter how I change my configuration I always get the error message my /tmp/uwsgi.log file: "--- no python application found, check your startup logs for errors ---" I have listed my configuration and error log below:
OS version: Linux raspberrypi 3.6.11+ #538 armv6l GNU/Linux Django version: 1.6.5 uwsgi version: 2.0.5.1
Virtual environment: /var/www/testbed/env Project location: /var/www/testbed/project/auth project tree:
file wsgi.py:
file /etc/uwsgi/emperor.ini:
file /etc/uwsgi/vessals/auth.ini:
Command being executed listed below:
Error file /tmp/uwsgi.log:
At this point, I'm grasping at straws. Out of all the reading that I have done I can't see why this keeps rendering the "Internal Server Error." I may have over looked something that why I've finally given in to my pride by posting my sorrows here. Since I've gotten this far I really do think that I have overlooked something very small. Any help would be greatly appreciated.