【问题标题】:How to get heroku to run my scripts to launch the app如何让 heroku 运行我的脚本来启动应用程序
【发布时间】:2017-02-26 01:00:39
【问题描述】:

我的应用程序基于全栈 Java MVC 框架构建,无需部署到容器。但是我需要运行一个脚本来构建和启动应用程序。

脚本的内容很简单:

#!/bin/sh
if [ ! -f target/dist/start ]; then
    mvn clean package
    cd target/dist
    unzip *.zip
else
    cd target/dist
fi
./run $*

脚本位于项目主文件夹中。

我在Procfile 中添加了以下命令,但它不起作用:

web: ./run_prod

当我在 heroku 上部署时,它说成功,但是当我访问我的应用时,它总是说:

Application error
An error occurred in the application and your page could not be served. If you are the application owner, check your logs for details.

heroku 日志文件显示:

2017-02-26T00:50:00.000000+00:00 app[api]: Build succeeded
2017-02-26T00:50:25.559742+00:00 heroku[router]: at=error code=H14 desc="No web processes running" method=GET path="/" host=todobackend-act.herokuapp.com request_id=59af9898-b6c7-4a51-ae0e-33ffae0d1f6d fwd="61.69.245.214" dyno= connect= service= status=503 bytes=
2017-02-26T00:50:26.533034+00:00 heroku[router]: at=error code=H14 desc="No web processes running" method=GET path="/favicon.ico" host=todobackend-act.herokuapp.com request_id=bf30ce34-edb0-46dc-870c-b92a24bc0cf5 fwd="61.69.245.214" dyno= connect= service= status=503 bytes=
2017-02-26T00:52:25.290301+00:00 heroku[router]: at=error code=H14 desc="No web processes running" method=GET path="/" host=todobackend-act.herokuapp.com request_id=0996409a-5024-4473-9616-1bc760c117e4 fwd="61.69.245.214" dyno= connect= service= status=503 bytes=
2017-02-26T00:52:26.102216+00:00 heroku[router]: at=error code=H14 desc="No web processes running" method=GET path="/favicon.ico" host=todobackend-act.herokuapp.com request_id=fd155207-cafc-420e-a0f1-0d3e6b73d4de fwd="61.69.245.214" dyno= connect= service= status=503 bytes=

有什么想法吗?

【问题讨论】:

    标签: java heroku deployment


    【解决方案1】:

    运行:

    heroku ps:scale web=1
    

    您的应用似乎在某个时候被缩小了(这可能是在崩溃后自动发生的)。

    【讨论】:

    • 其实我想知道它是否已经启动。为了启动应用程序。我需要cd target/dist && unzip *.zip && ./start
    猜你喜欢
    • 2023-01-20
    • 1970-01-01
    • 2014-12-20
    • 1970-01-01
    • 2018-05-26
    • 1970-01-01
    • 2015-03-25
    • 2021-10-06
    • 2021-03-30
    相关资源
    最近更新 更多