Installing GEOS on heroku cedar
我们无法在heroku雪松堆栈上安装GEOS库。
我们遵循了以下指南:https://devcenter.spacialdb.com/Heroku.html,但该方法不起作用。
我们注意到提供的geos二进制文件中存储的路径(/ app / tmp / geos)错误,因此我们使用vulcan构建了自己的二进制文件。
我们相应地更改了参数(BUNDLE_BUILD__RGEO),但无法使其正常工作。
我们甚至在自定义rgeo gem中对geos路径进行了硬编码,但均未成功
我们还尝试了其他构建脚本(https://github.com/roximity/heroku-buildpack-ruby-geos),但是它们太旧了,很难与heroku的最新脚本保持同步
我们正在使用ruby 2.0.0-p195和Rails 3.2.13
RGeoruby的当前维护者之一。我们正在改善文档,并且我已经编辑了有关在heroku上安装geos的部分。
为避免任何链接腐烂,以下是一种可行的解决方案:
1 2 3 4 5 6 7 8 9 | 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。这会稍慢一些,而且您会遇到更大的麻烦,因为它将安装您可能不需要的库。
我刚刚创建了heroku-buildpack-rgeo-prep来解决此问题。
此buildpack覆盖.bundle / config,以将BUNDLE_BUILD__RGEO设置为当前构建路径。不幸的是,您无法设置BUNDLE_BUILD_RGEO = / app,因为您的项目实际上是在/ tmp / build_1890cktlpat5d之类的地方构建的。
希望此构建包将使在Heroku上使用RGeo的痛苦减轻得多。