2013-03-01 30 views
2

我正在開發一個Eclipse Virgo buildpack但是當我與Heroku的嘗試,並推trivial app,檢測失敗:如何調試定製的Heroku buildpack:發行腳本未被驅動

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

的buildpack的檢測腳本本地工作細在應用程序的根目錄中:

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

有關如何調試的任何提示?我嘗試讓偵測腳本寫入stdout和stderr,但是輸出不會出現在「heroku日誌」下。

我使用的是Mac OS X 10.8.2,Ruby 1.9.3p374和gems 1.8.23。

更新:繼前兩個答案之後,我使用bash檢測腳本在驅動detect.rb腳本之前安裝缺失的gem。我還更改了buildpack腳本以寫入標準輸出。

heroku推得到更多,但仍然失敗。我可以看到編譯腳本退出,但釋放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的日誌 - 尾簡單地表示:

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 

回答

1

Currnetly有一些工具,使這個更容易。

  1. 此版本包https://github.com/kr/heroku-buildpack-inline(A構建包,以幫助構建buildpack)

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

使用內聯buildpack,這樣就可以得到良好的記錄,並使用heroku run bash,使您可以actaully在您將在使用它的環境,你的buildpack鼓搗上推你構建包的平臺。

+0

有趣的想法,但是當我推入平凡的應用程序加內置的buildpack,我得到同樣的失敗(Heroku推拒絕,沒有雪松支持的應用程序檢測到)。這並不奇怪,因爲heroku-buildpack-inline只是委託給內聯的buildpack。 但是,heroku運行bash可能會發現一個有用的線索 - 當我克隆組合的應用/內聯buildpack並嘗試運行它時,Ruby抱怨nokogiri gem沒有安裝。當我安裝它時,檢測腳本完美運行。所以我想我需要配置buildpack,以便heroku安裝必要的寶石。 – 2013-03-04 14:08:40

+0

我更新了Gemfile和Gemfile.lock,以確保表達nokogiri依賴關係,但在推向heroku時仍然會出現同樣的錯誤。 – 2013-03-04 14:19:38

+0

令人費解的是,環境變量PORT設置在heroku運行bash下,但是當推送到heroku驅動器檢測/編譯/釋放時,似乎沒有設置AFAICT。 – 2013-03-05 16:06:30

2

對於自定義buildpack,detect腳本並不需要那麼複雜,因爲用戶將會用BUILDPACK_URL手動指定它。複雜的detect腳本真的只對默認的Heroku構建包有意義,因爲它們需要檢測構建包是否適用於任何給定的應用程序。

如果你想在檢測完全撐船,你可以逃脫這樣的:

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

echo "Vergo" 
exit 0 

一旦你得到工作(並與compilerelease制定出任何問題),你可以把它更聰明一點。例如,你可以,如果某個文件模式存在檢測:

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

而且,簡單的說,它看起來像你的Ruby buildpack,這是最複雜的在那裏的一個基礎的buildpack。你可能想看看list of third-party buildpacks,看看大多數是在簡單的bash中完成的。

+0

請注意,我需要堅持使用當前用於XML解析的Ruby實現,並且因爲我想跟蹤由Ruby編寫而成的CloudFoundry buildpack。 – 2013-03-05 15:36:36

+0

我的建議取得了長足的進步。在調用detect.rb之前,我現在在bash detect腳本中安裝缺失的gem。在slug彙編中,我已經達到了「失敗釋放代碼」的程度。 – 2013-03-05 15:38:56

+0

與'detect'的建議類似,試着簡化你的'release'腳本(或者一起刪除它)。期待類似[this](https://devcenter.heroku.com/articles/buildpack-api#binrelease)返回YAML。另外,在'detect'中安裝gems有點奇怪。由於它是一個定製的buildpack,它在實踐中可能並不重要,但是'detect'應該是超級快速的,不會對底層系統做任何改變。實際上,我認爲甚至不能保證它會在'compile'或'release'的同一個系統上運行。 – ryanbrainard 2013-03-05 18:40:12

相關問題