Skip to content

Process stops responding on AWS EC2 after a few hours #1

@Naras

Description

@Naras

Python REST service started with commands:

export FLASK_APP=knowledgeTreeJsonRestService.py
nohup flask run --host=0.0.0.0 &

This works for a while and responds to REST requests, but stops responding after a few hours.

Needed: a mod_wsgi daemon process.

Method:
[(ref)](: http://www.datasciencebytes.com/bytes/2015/02/24/running-a-flask-app-on-aws-ec2/)

  1. Create knowledgetree.wsgi
import sys
sys.path.insert(0, '/var/www/html/knowledgetree')
from application import app as application
  1. Add directive to /etc/apache2/sites-enabled/000-default.conf
WSGIDaemonProcess knowledgetree threads=5
WSGIScriptAlias /knowledgetree /var/www/html/knowledgetree/knowledgetree.wsgi
WSGIPassAuthorization On

<Directory knowledgetree>
    WSGIProcessGroup knowledgetree
    WSGIApplicationGroup %{GLOBAL}
    Order deny,allow
    Allow from all
</Directory>
  1. create symlink
    sudo ln -sT ~/knowledgetree/var/www/html/knowledgetree
  2. Restart apache.
    sudo apachectl restart

Problem: works for urls where no login is required. But application contains @auth.login required for most endpoints.
Behaviour: Apache repeatedly asks for credentials and does not pass it on to the Python application. It should have passed on the credentials to the app since we have WSGIPassAuthorization On

Thus the WSGI process does not work for our purposes.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions