Pregunta

we have troubles in installing the GEOS library on heroku cedar stack.

We followed this guide: https://devcenter.spacialdb.com/Heroku.html and it didn't work.

We noticed that the path (/app/tmp/geos) stored in the provided geos binaries was wrong, so we built our own binaries with vulcan.

We changed parameters (BUNDLE_BUILD__RGEO) accordingly, but we weren't able to make it work.

We even hardcoded geos paths in our custom rgeo gem without any success

We also tried other buildscripts (https://github.com/roximity/heroku-buildpack-ruby-geos) but they are too old and it will be difficult to keep them up to date with heroku's one

We are using ruby 2.0.0-p195 and Rails 3.2.13

¿Fue útil?

Solución

I just created heroku-buildpack-rgeo-prep to address this problem.

This buildpack overwrites .bundle/config to set BUNDLE_BUILD__RGEO to the current build path. Unfortunately, you can't set BUNDLE_BUILD_RGEO=/app because your project is actually built somewhere like /tmp/build_1890cktlpat5d.

Hopefully, this buildpack will make it much less painful to use RGeo on Heroku.

Otros consejos

One of the current maintainer of the RGeo gem. We're improving documentation, and I've edited the part mentioning geos installation on heroku.

To avoid any link rot, here's a solution that should work:

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'

And if you also want support from the standard geographic libraries (such as Proj4), you should consider using the heroku-geo-buildpack. This will be a bit slower and you'll have a bigger slug since it will install libraries you may not need.

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top