在heroku雪松上安装GEOS

时间:2013-06-03 09:39:47

标签: ruby-on-rails ruby heroku geos rgeo

我们在heroku雪松堆栈上安装GEOS库时遇到了麻烦。

我们遵循了本指南:https://devcenter.spacialdb.com/Heroku.html但它无效。

我们注意到存储在提供的地理二进制文件中的路径(/ app / tmp / geos)是错误的,因此我们使用vulcan构建了自己的二进制文件。

我们相应更改了参数(BUNDLE_BUILD__RGEO),但我们无法使其正常工作。

我们甚至在我们的自定义rgeo gem中硬编码地理路径而没有任何成功

我们还尝试了其他的构建文件(https://github.com/roximity/heroku-buildpack-ruby-geos),但它们太旧了,很难让它们与heroku的版本保持同步

我们正在使用ruby 2.0.0-p195和Rails 3.2.13

2 个答案:

答案 0 :(得分:0)

我刚刚创建了heroku-buildpack-rgeo-prep来解决这个问题。

此buildpack将覆盖.bundle / config以将BUNDLE_BUILD__RGEO设置为当前构建路径。不幸的是,您无法设置BUNDLE_BUILD_RGEO = / app,因为您的项目实际上是在/ tmp / build_1890cktlpat5d之类的地方构建的。

希望这个buildpack可以减少在Heroku上使用RGeo的痛苦。

答案 1 :(得分:0)

RGeo gem的当前维护者之一。我们正在改善文档,并且我编辑了the part mentioning geos installation on heroku

为避免任何链接腐烂,以下是一种可行的解决方案:

echo 'libgeos-dev=3.7.1-1~pgdg18.04+1' > Aptfile # Use the version you want here
git add Aptfile
git commit -m 'Add Aptfile with libgeos'
heroku buildpacks:add --index=1 heroku-community/apt
# If you already have installed the gem earlier, you will need to purge your repo cache:
#   heroku plugins:install heroku-repo
#   heroku repo:purge_cache
git push heroku main
heroku console <<< 'puts "RGeo is configured with Geos !" if RGeo::Geos.capi_supported?;exit'

如果您还希望获得标准地理库(例如Proj4)的支持,则应考虑使用heroku-geo-buildpack。这样会比较慢,并且会遇到更大的麻烦,因为它将安装您可能不需要的库。