-
Notifications
You must be signed in to change notification settings - Fork 123
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
nginx and uwsgi deployment #35
Comments
Hi @Lighiche to be honest, I was never running ceph-dash with nginx, only with apache. So I can't really point in the right direction. The error message also doesn't tell me much about what could be wrong. To answer your question: Yes, it's a flask based app and should work with any wsgi capable webserver. Are there any other logfiles or error messae that could hint on the problem? If you've copied the file from the contrib folder from to the toplevel dir, you need to change the line. sys.path.insert(0, os.path.join(os.path.dirname(__file__), '..', '..')) to sys.path.insert(0, os.path.join(os.path.dirname(__file__), '.')) Regards, |
Hi there, thanks for the reply. This is absolutely everything I have and everything I know to try. I copied files out of the contrib folder to: /opt/ceph-dash/
I've changed the lines slightly to reflect that I had moved the I have the cloned dir in this folder The only other error log I get is when I place nginx infront of uwsgi, I blanked out the hostname not that it really matters.
I already have nginx on these boxes serving something for me and there's a whole HA load balancing thing going on a step above on the network so I'd prefer not to then complicate it more with apache ya know. If I write a small helloworld flask app, I can serve that via flask and uwsgi with flask:
with uwsgi:uwsgi --http :5000 --wsgi-file hellworld.py --callable app --processes 4 --threads 2 --stats 127.0.0.1:9191
I've eventried using cephdash.conf
uwsgi.ini nginx error.log Response is still SoFor clarity AS ROOT starting with
On port 3000 I get
And the only log output for this is:
|
Running wsgi with nginx for dummiesSo ever wanted to know how to fix all the problems? FIX FOR 500 RESPONSE CODENginx is NOT starting any wsgi processes for you, I had to start this server manually. In order to get this to work from uwsgi the full path MUST be given to .wsgi file. All files owned by nginx in /etc/nginx/sites-enabled WORKINGuwsgi server doing the http business
WORKING
FIX FOR BAD GATEWAY 502 Bad Gateway (nginx can't find uwsgi server)start the uwsgi server and make sure the next fix 503 is in place FIX FOR BAD GATEWAY 503 (uwsgi server reachable but not able to process request)The point of wsgi protocol (natively supported by nginx) is that it can proxy_pass requests off to the uwsgi server, ** in a wsgi binary format ** the http is handled by the listening nginx port 5000. WORKING
Now start nginx with this config
The response for this is successful
FIX FOR USING .SOCK FILEIf uwsgi can't create the socket the server won't start. You can quickly find out if it started with NOTES
It's not ideal and there's probably a better way to either host that server with the same user running wsgi or have a group with shared membership access. WORKING
And comfirmation:
Finally change the nginx upsteam block and restart nginx and voilà, pay dirt.
|
Hi @Lighiche thank you for the detailed solution! Is this problem fixed for you and can I close this issue? I would also like to create a FAQ section in the README and link to this issue so that people who have the same problems can easily find it. Ok for you? Regards, |
This is fine can I have a link to it?
Also sorry for late reply I didn’t get this.
… On 7 Jan 2017, at 17:31, Christian Eichelmann ***@***.***> wrote:
Hi @Lighiche <https://github.com/Lighiche>
thank you for the detailed solution! Is this problem fixed for you and can I close this issue? I would also like to create a FAQ section in the README and link to this issue so that people who have the same problems can easily find it. Ok for you?
Regards,
Christian
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub <#35 (comment)>, or mute the thread <https://github.com/notifications/unsubscribe-auth/AHTweOyvG5yFNWGuHaq9wKycfCXmUeumks5rP8wAgaJpZM4Ju5CS>.
|
Hi, thanks! Regards, |
Hi there,
I'm wondering if the process of serving the app via nginx/uwsgi has been documented anywhere? I know there's a quick start run through on httpd. I've been trying for a few days on and off and I can't even seem to get it to serve directly from the uwsgi server. Via nginx I get 502 socket file cannot be created. And via uwsgi I just get internal server error.
It's likely I'm doing something dumb but is the app set up to just plugin the uwsgi.ini into the server as long as it's pointing to the .wsgi file and the projectdir? It's a flask based app correct? I've run through a bit of the documentation and I should be able to serve it at a bear minimum with uwsgi.
I can run it fine with the ceph-dash.py file so all dependencies are met and the likes.
Any help or tuts you can direct me to that apply to the structure of this app and how it should be served sort of like a step by step so's I know I'm not fecking it up.
Trying to start with uwsgi:
uwsgi --http :5000 --chdir /etc/nginx/sites-enabled/ceph-dash/ --wsgi-file /etc/nginx/sites-enabled/ceph-dash/cephdash.wsgi --callable application --master --uid nginx --gid nginx
Server starts:
As you can see I added print statements to sys.path and application within the .wsgi to check it was loading and it finds what it needs apparently. But mountpoint is still empty.
*** Operational MODE: single process *** ['/etc/nginx/sites-enabled/ceph-dash/app/', '.', '', '/usr/lib64/python27.zip', '/usr/lib64/python2.7', '/usr/lib64/python2.7/plat-linux2', '/usr/lib64/python2.7/lib-tk', '/usr/lib64/python2.7/lib-old', '/usr/lib64/python2.7/lib-dynload', '/usr/lib64/python2.7/site-packages', '/usr/lib/python2.7/site-packages'] <Flask 'app'> WSGI app 0 (mountpoint='') ready in 0 seconds on interpreter 0xe0b6d0 pid: 26487 (default app) *** uWSGI is running in multiple interpreter mode *** spawned uWSGI worker 1 (and the only) (pid: 26487, cores: 1)
Request gives internal server error:
[pid: 26487|app: 0|req: 1/1] 10.0.2.2 () {36 vars in 614 bytes} [Sun Aug 28 11:07:06 2016] GET / => generated 291 bytes in 49 msecs (HTTP/1.1 500) 2 headers in 84 bytes (1 switches on core 0)
Also tried with the .ini file:
uwsgi --ini uwsgi.ini
What am I doing wrong? Pretty sure it's going to come down to either wrong file in wrong place or uwsgi not pointing to the correct place.
Cheers
The text was updated successfully, but these errors were encountered: