在Heroku上安装GEOS

3
我正在尝试将一个使用RGeo gem的Rails应用程序(ruby 2.3.0,rails 4.2.6)部署到Heroku上,但我无法安装RGeo gem所依赖的底层GEOS库(请参见https://github.com/rgeo/rgeo#dependencies)。
根据Heroku自己的说明,可以通过使用heroku-geo-buildpack实现,但它没有起作用。 将BUILDPACK添加到应用程序中:
$ heroku buildpacks:set https://github.com/cyberdelia/heroku-geo-buildpack.git
$ heroku buildpacks:add heroku/ruby

构建过程看起来不错:

remote: Building source:
remote: 
remote: -----> geos/gdal/proj app detected
remote:        Using geos version: 3.4.2
remote:        Using gdal version: 1.11.1
remote:        Using proj version: 4.8.0_1
remote: -----> Vendoring geo libraries done
remote: -----> Ruby app detected
remote: -----> Compiling Ruby/Rails
remote: -----> Using Ruby version: ruby-2.3.0

测试依赖:

>>> require 'rgeo'
=> false
>>> RGeo::CoordSys::Proj4.supported?
=> true
>>> RGeo::Geos.supported?
=> false

你按照文档所说在添加语言相关的Buildpack之前是否运行了Buildpack?添加完Buildpack后,文档中说应该使用“heroku buildpacks”进行构建。 - Alexander Luna
@AlexanderLuna 是的,我在上面详细说明了我的过程。 - Yarin
尝试使用此链接在Heroku中安装GEOS:安装GEOS - vipin
2个回答

3
有关Heroku的特定geos buildpack存在问题,主要是因为geos的编译参数。详细信息可以查看此pull request,其中讨论了很多相关内容。解决方法是使用Webpack的分支,具体说明在此博客文章中有详细介绍。

步骤1:在项目根目录下创建.vendor_urls文件:

https://s3.amazonaws.com/diowa-buildpacks/geos-3.5.0-heroku.tar.gz
https://s3.amazonaws.com/diowa-buildpacks/proj-4.9.1-heroku.tar.gz

请将此文件添加到git,并确保以换行符结尾。
第二步:设置您的Heroku配置:
heroku buildpacks:set https://github.com/diowa/heroku-buildpack-rgeo-prep.git
heroku buildpacks:add https://github.com/peterkeen/heroku-buildpack-vendorbinaries.git
heroku buildpacks:add heroku/ruby
heroku config:set LD_LIBRARY_PATH=/app/lib

(查看 https://github.com/diowa/heroku-buildpack-rgeo-prep#setup)

最后,注意如果您已经安装了rgeo,则需要重新编译这个gem。您可以使用heroku repo插件来完成这个操作,运行heroku repo:purge_cache -a appname 然后再次部署。

(查看 http://www.diowa.com/blog/heroku/2016/02/26/using-rgeo-with-geos-on-heroku#deploy)


是的 - 非常感谢 @mlabarca,那个解决方案起作用了! - Yarin

0

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接