3

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

cesidio
  • 35
  • 4

2 Answers2

2

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.

Ulysse BN
  • 10,116
  • 7
  • 54
  • 82
0

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.

bayfieldcoder
  • 158
  • 2
  • 8
  • Did you set BUILDPACK_URL to https://github.com/ddollar/heroku-buildpack-multi.git? You will also create a .buildpacks file, to tell heroku-buildpack-multi which other buildpacks to run. Feel free to post an issue to the repo if this doesn't help and I can try to help there. – bayfieldcoder Jun 19 '13 at 21:57
  • actually there were some problems with heroku last night, so forget about my last comment. thanks again for your quick response – cesidio Jun 20 '13 at 09:15