HewlettPackard/oneview-redfish-toolkit

Flask’s built-in server is not suitable for production - check alternatives

Closed this issue · 3 comments

Flask’s built-in server is not suitable for production - check alternatives

The action really isn't to replace flask -- but rather use a web server that isn't the flask web server. e.g. use cherrypy running the flask app.

################################################

CherryPy ##### << RECOMMENDED

###############################################

The changes to validate the Cherrypy being integrated with Flask in our application are on https://github.com/HewlettPackard/oneview-redfish-toolkit/tree/cherrypy_first_impl.

It is working with HTTP and HTTPS, depending on the parameters that we are passing.

We can have the application is started using cherryd instead of to use python.
Current approach:
#python3 oneview_redfish_toolkit/app.py --config oneview_redfish_toolkit/conf/redfish.conf --log-config oneview_redfish_toolkit/conf/logging.conf

New one using cherryd:
#cherryd -c oneview_redfish_toolkit/conf/redfish.conf -i oneview_redfish_toolkit/app

We have some links that can help us to understand the required changes:
https://stackoverflow.com/questions/14325954/cherrypy-getting-app-config-settings-when-starting-with-cherryd
https://stackoverflow.com/questions/5982638/using-cherrypy-cherryd-to-launch-multiple-flask-instances
https://stackoverflow.com/questions/1463510/deploying-cherrypy-daemon
https://docs.cherrypy.org/en/latest/advanced.html#make-your-cherrypy-application-a-wsgi-application

#####################################################

Gunicorn

#####################################################

Gunicorn doesn't have restart mechanism implemented.

To have it working it is required to have external tools like Nginx. It will be required more dependencies being added in the application and will require the manual configuration to have the tool running.
The integration requires more than just start the application using: #gunicorn --workers=2 -b 127.0.0.1:5000 oneview_redfish_toolkit.app:main

http://www.philchen.com/2015/08/08/how-to-make-a-scalable-python-web-app-using-flask-and-gunicorn-nginx-on-ubuntu-14-04
https://www.digitalocean.com/community/tutorials/how-to-serve-flask-applications-with-gunicorn-and-nginx-on-ubuntu-14-04

The issue #348 was created to perform the changes.