2016-12-16 133 views
1

我试图在使用RGeo gem的Heroku上部署一个Rails应用程序(ruby​​ 2.3.0,rails 4.2.6),但是我没有安装底层GEOS库这是RGeo宝石所依赖的(见https://github.com/rgeo/rgeo#dependencies)。在Heroku上安装GEOS

根据Heroku's own instructions,这应该可以通过使用heroku-geo-buildpack,但它不起作用。

ADD BUILDPACK到App:

$ 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 

test依赖:

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

你运行添加buildpack如文档说,语言之前buildpack?在添加buildpack之后,它说你应该使用“heroku buildpack”来构建它。 –

+0

@AlexanderLuna是我详细说明了我的过程 – Yarin

+0

试试这个链接,在heroku中安装GEOS:[安装GEOS](http://stackoverflow.com/questions/16893840/installing-geos-on-heroku-cedar) – vipin

回答

1

好像有问题在heroku上获得特定的geos buildpack,主要是因为geos的构建参数。有关完整的详细信息,您可以查看this pull request到许多讨论过的buildpack。在this blog post中详细描述了使用fork of the 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,并确保它以换行符结束。

第2步:设置您的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 

(SEE https://github.com/diowa/heroku-buildpack-rgeo-prep#setup

最后要注意的是,如果你已经安装了rgeo,你需要重新编译的宝石。您可以使用heroku repo plugin,运行heroku repo:purge_cache -a appname并再次部署。

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

+0

YES-非常感谢@mlabarca,该解决方案工作! – Yarin