AWS Elastic Beanstalk - Script timed out before returning headers: application.py

后端 未结 2 984
野的像风
野的像风 2020-12-04 17:05

I have an existing Elastic Beanstalk flask app on AWS that occasionally will not initialize and gives the following error:

[Mon Jan 23 10:06:51.550205 2017]          


        
相关标签:
2条回答
  • 2020-12-04 17:25

    Many thanks to @GrahamDumpleton for his help. The solution I used was:

    -Edit the wsgi.conf file found at /etc/httpd/conf.d/wsgi.conf on the Elastic Beanstalk EC2 instance.

    To do this I used the command sudo -e /etc/httpd/conf.d/wsgi.conf to open the editor, hit INSERT to start editing, and added WSGIApplicationGroup %{GLOBAL} anywhere in the file. I then his ESCAPE and used the command :wq to save the changes.

    After this I selected Restart App Servers from the Action drop-down of the Elastic Beanstalk console. After this, the program would load and give the AH00094: Command line: '/usr/sbin/httpd -D FOREGROUND' message, but not the error messages afterwards. In addition, the application would receive SQS messages and run as expected.

    One thing to note, is that it appears the wsgi.conf file will revert if any configuration changes are made to the Elastic Beanstalk configuration. I'm not sure of a way around this, but if I find something I'll post it here.

    Thanks again to @GrahamDumpleton for his prompt response and help in solving this issue!

    0 讨论(0)
  • 2020-12-04 17:33

    The @user2752159's answer highlights the issue however I am going to add this to show how to overcome this issue in the context of AWS Beanstalk (ie. if a new instance or you deploy more code then the problem will remain fixed, rather than having to ssh into the box each time to modify wsgi.conf).

    Create the file. (note it ends with *.config and not conf)

    nano .ebextensions/<some_name>.config 
    

    add the following to some_name.config (mod_wsgi docs)

    files:
      "/etc/httpd/conf.d/wsgi_custom.conf":
        mode: "000644"
        owner: root
        group: root
        content: |
          WSGIApplicationGroup %{GLOBAL}
    

    add to git

    git add .ebextensions/<some_name>.config
    git commit -m 'message here'
    

    deploy to beanstalk

    eb deploy
    

    Now each time you deploy, WSGIApplicationGroup %{GLOBAL} will be added to wsgi_custom.conf, fixing the issue.

    0 讨论(0)
提交回复
热议问题