Skip to content
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 web server #352

Closed
kizniche opened this issue Dec 21, 2017 · 4 comments
Closed

Nginx web server #352

kizniche opened this issue Dec 21, 2017 · 4 comments

Comments

@kizniche
Copy link
Owner

This is a continuation of #305

With v5.5.0 about to be released, there has been one issue holding it back, and that is Apache2 returning a 400: Bad Request error when a backup file/database is uploaded from the Export/Import page.

This wasn't an issue all throughout testing. It was working flawlessly. Then, last night when I was about to make a release, I went to the Export/Import page and tried to restore a database and it gave that error. I spent many hours trying to diagnose the issue, without success.

With that, I think I'm through with Apache2 and would like to attempt to get the Flask frontend running on nginx+wsgi. Previously I was unable to get this working. However, I just recently was able to get nginx running the app. Below is how I did that.

Install Mycodo normally according to the instructions in the README, then create ~/Mycodo/wsgi.py with these contents:

from mycodo.start_flask_ui import app

if __name__ == "__main__":
    app.run()

Activate the virtualenv and start the server:

source ~/Mycodo/env/bin/activate
uwsgi --socket 0.0.0.0:5000 --protocol=http -w wsgi:app

Go to http://IP-ADDRESS:5000 and the frontend loads

I'll be working on this and determining if it's stable and if this should be the default web server of 5.5.0 and onward.

@kizniche
Copy link
Owner Author

So far nginx appears much faster than apache2

@kizniche
Copy link
Owner Author

I haven't been having success with the uwsgi module, but when I just tried gunicorn from this tutorial I was able to get the mycodo frontend working! Details to come.

@pukkita
Copy link

pukkita commented Dec 24, 2017

Congrats! nginx runs circles around apache2 performance.

@kizniche
Copy link
Owner Author

So far I've enjoyed working with nginx. I haven't had any issues so far and it appears faster. I'd like to do a side-by-side speed comparison with pre-4.4.19 and 5.5.0 with the profiler I made a while back to analyze page loading times (back when Mycodo pages took sometimes up to minutes to load, I needed a way to test my code improvements).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants