[英]Simpler way of installing native dependencies than Heroku buildpacks?
I have a rails app with a dependency on the project-honeypot
gem which in turn has the following dependencies according to my Gemfile.lock
: 我有一个Rails应用程序,它依赖于project-honeypot
gem,而根据我的Gemfile.lock
,它又具有以下依赖关系:
net-dns2
packetfu
network_interface
pcarub (~> 0.12)
When I push to my heroku app it won't install pcarub
. 当我推送到heroku应用程序时,将不会安装pcarub
。 Other sources lead me to the conclusion that I'm missing libpcap
and libpcap-devel
. 其他来源使我得出的结论是,我缺少libpcap
和libpcap-devel
。 I hope someone will correct me if I'm wrong here. 如果我错了,我希望有人能纠正我。
Unfortunately as far as I can see there is no way to run arbitrary apt-get
commands, apart from the complexity of heroku buildpacks . 不幸的是,据我所知,除了heroku buildpacks的复杂性之外,没有办法运行任意的apt-get
命令。 Is there any simpler solution? 有没有更简单的解决方案?
Heroku / pcarub install error: Heroku / pcarub安装错误:
Building native extensions. This could take a while...
ERROR: Error installing pcaprub:
ERROR: Failed to build gem native extension.
/app/vendor/ruby-2.0.0/bin/ruby extconf.rb
[*] Running checks for pcaprub_c code...
platform is x86_64-linux
checking for pcap_open_live() in -lpcap... no
checking for pcap_setnonblock() in -lpcap... no
creating Makefile
make "DESTDIR="
compiling pcaprub.c
pcaprub.c:8:18: fatal error: pcap.h: No such file or directory
#include <pcap.h>
^
compilation terminated.
make: *** [pcaprub.o] Error 1
Gem files will remain installed in /app/vendor/ruby-2.0.0/lib/ruby/gems/2.0.0/gems/pcaprub-0.12.0 for inspection.
Results logged to /app/vendor/ruby-2.0.0/lib/ruby/gems/2.0.0/gems/pcaprub-0.12.0/ext/pcaprub_c/gem_make.out
Heroku buildpacks turned out to be extremely simple to use. 事实证明,Heroku构建包的使用非常简单。 Heroku now provides first class support for multiple buildpacks . Heroku现在为多个buildpack提供一流的支持 。 I needed to set the ruby buildpack explicitly: 我需要显式设置ruby buildpack:
heroku buildpacks:set https://github.com/heroku/heroku-buildpack-ruby.git
Then added heroku-buildpack-apt ahead of the ruby buildpack: 然后在ruby buildpack之前添加heroku-buildpack-apt :
heroku buildpacks:add --index 1 https://github.com/ddollar/heroku-buildpack-apt.git
Then my dependency in a new file called Aptfile
in the root of my project: 然后,在我的项目根目录中,我依赖一个名为Aptfile
的新文件:
libpcap-dev
The next time I deployed Heroku used the new buildpack to apt-get install libpcap
before running bundle install. 下次部署Heroku时,在运行捆绑包安装之前,使用新的buildpack来apt-get install libpcap
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.