3

我正在开发一个 Eclipse Virgo buildpack,但是当我使用 Heroku 尝试它并推送一个琐碎的应用程序时,检测失败:

-----> Fetching custom git buildpack... done
!     Heroku push rejected, no Cedar-supported app detected

buildpack 的检测脚本在应用程序的根目录中本地运行良好:

$[...]virgo-buildpack/bin/detect .
Virgo Web

关于如何调试的任何提示?我尝试让检测脚本写入标准输出和标准错误,但输出没有出现在“heroku 日志”下。

我正在运行 Mac OS X 10.8.2、Ruby 1.9.3p374 和 gems 1.8.23。

更新:在前两个答案之后,我在驱动 detect.rb 脚本之前使用了 bash 检测脚本来安装丢失的 gem。我还更改了 buildpack 脚本以写入标准输出。

heroku push 更进一步,但仍然失败。我可以看到编译脚本正在退出,但是发布 bash 脚本在开始时有一个 echo 命令,并且这不会出现在输出中。

所以似乎没有调用发布脚本。

输出如下(# 表示注释以避免混乱):

-----> Fetching custom git buildpack... done
# detect script enter and exit
Virgo Web app detected
# compile script enter and exit
-----> Discovering process types
       Procfile declares types                                                                                                                                                                                                                                                                                                                                                                                             


                               -> (none)
# detect script enter and exit (again)
Virgo Web -> web

-----> Compiled slug size: 60.4MB
-----> Launching... !     Heroku push rejected, failure releasing code

heroku logs --tail 简单地显示:

2013-03-06T10:53:48+00:00 heroku[slugc]: Slug compilation started
2013-03-06T10:54:27+00:00 heroku[slugc]: Slug compilation failed: failure releasing code
4

2 回答 2

2

For a custom buildpack, the detect script doesn't really need to be that complicated because users will be specifying it manually with BUILDPACK_URL anyway. A sophisticated detect script really only makes sense for the default Heroku buildpacks because they need to detect if the buildpack applies for any given app.

If you want to completely punt on detection, you can get away with something like this:

#!/usr/bin/env bash
# bin/detect <build-dir>

echo "Vergo"
exit 0

Once you get that working (and work out any issues with compile and release), you can make it a little more intelligent. For example, you could detect if a certain file pattern exists:

#!/usr/bin/env bash
# bin/detect <build-dir>
if [ -f $1/index.jsp ]; then
  echo "Vergo" && exit 0
else
  echo "no" && exit 1
fi

Also, speaking of simplicity, it looks like you are basing your buildpack on the Ruby buildpack, which is one of the most complicated ones out there. You may want to take a look at the list of third-party buildpacks to see how most are done in simple bash.

于 2013-03-05T05:04:51.963 回答
1

目前有一些工具可以让这变得更容易。

  1. 这个构建包https://github.com/kr/heroku-buildpack-inline(帮助构建 buildpack 的构建包)

  2. heroku run bash是你最好的朋友。

使用内联 buildpack 将您的 build pack 推送到平台上,这样您就可以获得良好的日志记录,并使用heroku run bash它以便您可以在您将使用它的环境中实际修改您的 buildpack。

于 2013-03-01T20:16:48.117 回答