将 H2O Wave 应用程序部署到 Heroku?

问题描述

我对部署 Python Web 应用程序比较陌生,但我试图将我的 H2O wave 应用程序部署到 Heroku,但一直遇到问题,而且我在文档中找不到太多帮助。

如果我使用命令(在用于 wave 的 SDK 中)启动服务器,则在本地一切正常:

$ ./waved
2021/01/22 10:26:38 # 
2021/01/22 10:26:38 # ┌─────────────────────────┐
2021/01/22 10:26:38 # │  ┌    ┌ ┌──┐ ┌  ┌ ┌──┐  │ H2O Wave
2021/01/22 10:26:38 # │  │ ┌──┘ │──│ │  │ └┐    │ 0.11.0 20210118061246
2021/01/22 10:26:38 # │  └─┘    ┘  ┘ └──┘  └─┘  │ © 2020 H2O.ai,Inc.
2021/01/22 10:26:38 # └─────────────────────────┘
2021/01/22 10:26:38 # 
2021/01/22 10:26:38 # {"address":":10101","t":"listen","webroot":"/Users/kenjohnson/Documents/TTT/H2O Wave/wave/www"}
2021/01/22 10:26:39 # {"addr":"127.0.0.1:64065","route":"/tennis-pred","t":"ui_add"}
2021/01/22 10:46:04 # {"host":"http://127.0.0.1:8000","route":"/counter","t":"app_add"}

然后在项目运行的根目录下:

uvicorn tennis_pred_app:main

对于部署,除了我的 wave python 文件之外,我只有一个 requirements.txt 和一个 Procfile

web: uvicorn tennis_pred_app:main --host 0.0.0.0 --port 10101

这是我的 foo (tennis_pred_app.py) 的样子(简化版):

from h2o_wave import Q,main,app,ui

@app("/tennis-pred")
async def serve(q: Q):
    show_form(q)
    await q.page.save()

我目前遇到的错误是:

2021-01-22T00:28:41.000000+00:00 app[api]: Build started by user x
2021-01-22T00:31:07.040695+00:00 heroku[web.1]: State changed from crashed to starting
2021-01-22T00:31:06.879674+00:00 app[api]: Deploy 1dc65130 by user x
2021-01-22T00:31:06.879674+00:00 app[api]: Release v23 created by user x
2021-01-22T00:31:26.580199+00:00 heroku[web.1]: Starting process with command `uvicorn tennis_pred_app:main --host 0.0.0.0 --port 20819`
2021-01-22T00:31:30.299421+00:00 app[web.1]: INFO:     Uvicorn running on http://0.0.0.0:20819 (Press CTRL+C to quit)
2021-01-22T00:31:30.299892+00:00 app[web.1]: INFO:     Started parent process [4]
2021-01-22T00:31:46.000000+00:00 app[api]: Build succeeded
2021-01-22T00:32:27.041954+00:00 heroku[web.1]: Error R10 (Boot timeout) -> Web process failed to bind to $PORT within 60 seconds of launch
2021-01-22T00:32:27.093099+00:00 heroku[web.1]: Stopping process with SIGKILL
2021-01-22T00:32:27.199933+00:00 heroku[web.1]: Process exited with status 137
2021-01-22T00:32:27.242769+00:00 heroku[web.1]: State changed from starting to crashed

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)