【问题标题】:Why changing heroku buildpack for existing app doesn't run bin/release为什么更改现有应用程序的 heroku buildpack 不会运行 bin/release
【发布时间】:2012-11-27 18:55:51
【问题描述】:

我在 heroku 上有一个带有默认 buildpack (apache) 的 php 应用程序,然后决定将其更改为 php-fpm + nginx buildpack (https://github.com/iphoting/heroku-buildpack-php-tyler/)。

我发出了更改命令:

heroku config:set BUILDPACK_URL=https://github.com/iphoting/heroku-buildpack-php-tyler.git

并推送:

git push heroku master

然后编译 slug,但所有二进制文件都无法执行“找不到命令”,因为应该使用 bin/release 更新的 PATH 配置变量没有更新。

相比之下,当使用此 buildpack 从头开始​​创建应用程序时,

heroku create -b https://github.com/iphoting/heroku-buildpack-php-tyler.git

一切都按预期运行(并且 PATH 存在并更新)。

我的假设是在更改配置变量 BUILDPACK_URL 后 bin/release 未运行,因此未设置 PATH 变量。

为了使应用程序正常工作,我必须手动添加 PATH 配置变量。有没有其他人遇到过这个?这是预期的行为吗?据我了解, bin/release 应该始终在 slug 编译后运行?

编辑:将 git url 更正为正确的“.git”

【问题讨论】:

    标签: heroku release slug buildpack


    【解决方案1】:

    您的假设是正确的,bin/releaseaddonsconfig_vars 属性仅取自应用程序首次部署时的构建包。详情请见https://devcenter.heroku.com/articles/buildpack-api#binrelease

    Heroku 正在迁移到一个新系统,用于构建包以添加配置变量,在应用的首次部署之后工作:https://devcenter.heroku.com/articles/labs-dot-profile-d

    如果 buildpack 将 .profile.d/buildpack_name.sh 复制到应用程序中,则该文件将在应用程序启动期间获取。这可用于设置 PATH 之类的东西。

    【讨论】:

    • 哦,现在我看到了关于第一次安装的那个难以捉摸的提示......我想我到目前为止错过了它。谢谢!,您估计什么时候可以从实验室毕业?
    • 我还假设你可以在 bin/compile 脚本中运行一些export PATH=...
    【解决方案2】:

    您的应用程序存储库中可能有一个 Procfile。如果您有现有的 Procfile,则 bin/release 不会覆盖其内容。只需将适当的行 (5-9) 从 https://github.com/iphoting/heroku-buildpack-php-tyler/blob/master/bin/release 复制到您的 Procfile 中。

    【讨论】:

    • 应用仓库中没有Procfile。
    猜你喜欢
    • 1970-01-01
    • 2018-02-16
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-10-03
    • 2018-01-22
    • 2021-11-12
    相关资源
    最近更新 更多