簡體   English   中英

在heroku上運行passenger_native_support.so

[英]Running passenger_native_support.so on heroku

當我在heroku上使用Passenger 5.3.1部署Rails 3應用程序時,我在日志中看到以下失敗的下載

無法下載https://oss-binaries.phusionpassenger.com/binaries/passenger/by_release/5.3.1/rubyext-ruby-2.2.7-x86_64-linux.tar.gz :請求的URL返回錯誤:找不到404

無法下載https://s3.amazonaws.com/phusion-passenger/binaries/passenger/by_release/5.3.1/rubyext-ruby-2.2.7-x86_64-linux.tar.gz :請求的URL返回錯誤:403禁止的

有人可以建議我如何解決這個問題嗎? 我檢查了所說的URL,並且文件位於其他URL(我的應用嘗試從中下載的路徑略有錯誤)。 我可以在某處配置下載URL嗎?

由於在heroku上缺少SSH訪問,因此我不確定從何處去。

我也不確定要禁用PASSENGER_DOWNLOAD_NATIVE_SUPPORT_BINARY = 0的優勢,以及在部署到heroku時在哪里進行配置。

日志:

2018-05-22T14:22:02.337983 + 00:00 app [web.1]:->為您的平台下載Phusion客運代理二進制文件2018-05-22T14:22:02.709603 + 00:00 app [web.1 ]:2018-05-22T14:22:02.709640 + 00:00 app [web.1]:->安裝Nginx 1.14.0引擎2018-05-22T14:22:02.779900 + 00:00 app [web.1] :2018-05-22T14:22:02.779946 + 00:00 app [web.1]:-------------------------- 2018-05 -22T14:22:02.779967 + 00:00 app [web.1]:2018-05-22T14:22:02.792581 + 00:00 app [web.1]:[passenger_native_support.so]嘗試為當前用戶進行編譯( u56245)和Ruby解釋器... 2018-05-22T14:22:02.792586 + 00:00 app [web.1]:(將PASSENGER_COMPILE_NATIVE_SUPPORT_BINARY = 0設置為禁用)2​​018-05-22T14:22:03.114593 + 00:00 app [web.1]:警告:編譯未成功。 要了解原因,請閱讀以下文件:2018-05-22T14:22:03.114653 + 00:00 app [web.1]:/tmp/passenger_native_support-fgpk65.log 2018-05-22T14:22:03.114732 + 00:00 app [web.1]:[passenger_native_support.so]查找當前Ruby解釋器的下載... 2018-05-22T14:22:03.114766 + 00:00 app [web.1]:(將PASSENGER_DOWNLOAD_NATIVE_SUPPORT_BINARY = 0設置為禁用)2​​018 -05-22T14:22:03.837288 + 00:00應用程序[web.1]:無法下載https://oss-binaries.phusionpassenger.com/binaries/passenger/by_release/5.3.1/rubyext-ruby-2.2。 7-x86_64-linux.tar.gz :請求的URL返回錯誤:404未找到2018-05-22T14:22:03.837312 + 00:00 app [web.1]:嘗試下一個鏡像... 2018-05-22T14 :22:04.331785 + 00:00應用程序[web.1]:無法下載https://s3.amazonaws.com/phusion-passenger/binaries/passenger/by_release/5.3.1/rubyext-ruby-2.2.7- x86_64-linux.tar.gz :請求的URL返回錯誤:403 Forbidden 2018-05-22T14:22:04.332030 + 00:00 app [web.1]:[passenger_native_support.so]將不會使用(無法編譯或下載) 2018-05-22T14:22:04.332036 + 00:00 app [web.1]:->乘客仍將正常運行。 2018-05-22T14:22:04.410350 + 00:00 app [web.1]:================ Phusion乘客獨立Web服務器已啟動========= ====== 2018-05-22T14:22:04.410358 + 00:00 app [web.1]:PID文件:/app/passenger.11176.pid 2018-05-22T14:22:04.410360 + 00:00 app [web.1]:日志文件:/app/log/passenger.11176.log 2018-05-22T14:22:04.410361 + 00:00 app [web.1]:環境:生產

TL; DR :通過將Ruby升級到捆綁的版本,可以使用oss-binaries.phusionpassenger.com中的預編譯二進制文件,例如,如果您使用Passenger gem v.5.3.1 ,則可以升級到v2.2.8 ,或者通過降級passenger gem如果您希望繼續使用Ruby 2.2.7,請升級v5.1.9

但是, 二進制文件對於乘客操作並不重要 如日志所述: Passenger will still operate normally. 沒有二進制文件乘客嘗試下載也是可以的 -他們不會為每個Ruby版本發布二進制文件。 您可以安全地將PASSENGER_COMPILE_NATIVE_SUPPORT_BINARY = 0和PASSENGER_DOWNLOAD_NATIVE_SUPPORT_BINARY = 0設置為兩者都靜音-這在Heroku應用程序的Config Vars設置中。

詳細信息乘客編譯問題:乘客無法在Heroku上編譯本機二進制文件,至少在新的heroku-16堆棧上。 通過執行以下操作,我們可以檢查/tmp/passenger_native_support-fgpk65.log,然后檢查mkmf.log:

heroku run bash 
bundle exec passenger start # just to make it fill the error log file
# hit [ctrl-c]
cat /tmp/passenger_native_support-*.log

其輸出如下所示:

# /app/vendor/ruby-2.3.1/bin/ruby /app/vendor/bundle/ruby/2.3.0/gems/passenger-5.3.4/src/ruby_native_extension/extconf.rb
checking for alloca.h... *** /app/vendor/bundle/ruby/2.3.0/gems/passenger-5.3.4/src/ruby_native_extension/extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of necessary
libraries and/or headers.  Check the mkmf.log file for more details.  You may
need configuration options.

目前尚不清楚mkmf.log文件在哪里,但是我們可以通過運行/app/vendor/bundle/ruby/2.3.0/gems/passenger-5.3.4/src/ruby_native_extension/extconf.rb來使其顯示在當前目錄中使用與上面的日志相同的命令來手動進行:

/app/vendor/ruby-2.3.1/bin/ruby /app/vendor/bundle/ruby/2.3.0/gems/passenger-5.3.4/src/ruby_native_extension/extconf.rb
cat mkmf.log

然后我們有這個:

"gcc -o conftest -I/app/vendor/ruby-2.3.1/include/ruby-2.3.0/x86_64-linux -I/app/vendor/ruby-2.3.1/include/ruby-2.3.0/ruby/backward -I/app/vendor/ruby-2.3.1/include/ruby-2.3.0 -I/app/vendor/bundle/ruby/2.3.0/gems/passenger-5.3.4/src/ruby_native_extension     -O3 -fno-fast-math -g -Wall -Wextra -Wno-unused-parameter -Wno-parentheses -Wno-long-long -Wno-missing-field-initializers -Wunused-variable -Wpointer-arith -Wwrite-strings -Wdeclaration-after-statement -Wimplicit-function-declaration -Wdeprecated-declarations -Wno-packed-bitfield-compat -Wno-maybe-uninitialized  -fPIC -g conftest.c  -L. -L/app/vendor/ruby-2.3.1/lib -Wl,-R/app/vendor/ruby-2.3.1/lib -L. -fstack-protector -rdynamic -Wl,-export-dynamic     -Wl,-rpath,'/../lib' -Wl,-R'/../lib' -lruby  -lpthread -lgmp -ldl -lcrypt -lm   -lc"
sh: 1: gcc: not found
checked program was:
/* begin */
1: #include "ruby.h"
2:
3: int main(int argc, char **argv)
4: {
5:   return 0;
6: }
/* end */

因此,根本問題是gcc在heroku-16堆棧運行時中不可用-這可能是有目的的。 盡管看起來有可能在這里提供gcc並不容易,但是如果我們可以解決這個問題,我就不會這么做。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM