【问题标题】:Timeout while starting Python application through Cloud Foundry通过 Cloud Foundry 启动 Python 应用程序时超时
【发布时间】:2016-01-30 00:08:22
【问题描述】:

我正在使用 Cloud Foundry CLI 在 IBM Bluemix 上推送烧瓶应用程序。 只要我运行cf push <APPNAME>,它就会创建 buildpack 和所有内容,但它会在尝试启动应用程序时不断崩溃。

我得到的错误如图:

App instance exited with guid 452bafde-cdaf-4794-8e33-f91802a3e2df payload: 
{"cc_partition"=>"default", 
 "droplet"=>"452bafde-cdaf-4794-8e33-f91802a3e2df", 
 "version"=>"1951c4c4-66e6-4f56-b302-541383014bd2", 
 "instance"=>"a8328f7525f247cd94fdaf23382fac78", 
 "index"=>0, 
 "reason"=>"CRASHED",
 "exit_status"=>-1, 
 "exit_description"=>"failed to accept connections within health check timeout", 
 "crash_timestamp"=>1454112272}

【问题讨论】:

  • 您是否使用no-route 运行此应用程序?您能否提供有关您的应用及其配置的更多信息?
  • 请添加“cf logs appname --recent”的输出。您可能需要重新创建问题以获取最新日志。

标签: python flask pip ibm-cloud cloud-foundry


【解决方案1】:

我遇到了同样的问题,在环顾四周后发现了这个gist,上面有一个用于云铸造的示例烧瓶项目。

我注意到在启动服务器时,示例将主机设置为“0.0.0.0”,这是我没有做的。

if __name__ == '__main__':
    app.run(host='0.0.0.0', port=PORT, debug=DEBUG)

进行更改后,我的应用程序运行良好。

【讨论】:

    【解决方案2】:

    想要搭载 drieprinter 的答案以获得更完整的实施 把它放在python文件的最底部

    import os
    
    port = os.getenv('PORT', '5000')
    if __name__ == "__main__":
        app.run(host='0.0.0.0', port=int(port))
    

    【讨论】:

      【解决方案3】:

      尝试通过调用cf push -t 180 或更改ma​​nifest.yml 中的health-check-type 来增加超时时间:

      ---
      applications:
      - name: ...
        health-check-type: process
      

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 2013-03-24
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多