Using RGeo with GEOS on Heroku with apt-get
Posted by Geremia Taglialatela on 01 August 2017
Here it is a new, super-easy approach to use Rgeo with GEOS on Heroku, by using the amazing
Update! August, 13th 2019
Add a note about
LD_LIBRARY_PATH variable and the Rake Task
1. Add Aptfile
At the root of your repository, add a file called
Aptfile with the following content:
Make sure it ends with a newline.
2. Add the heroku-buildpack-apt buildpack
Method 1: Using app.json
You need to add the following entries:
Method 2: Using the console
3. Unset LD_LIBRARY_PATH
If you have previously set the
LD_LIBRARY_PATH variable, please unset that
Deploy to Heroku. Please note that if you have already installed rgeo, you need to recompile the gem.
Check the deploy log:
You can force recompiling by using the heroku repo plugin, running
heroku repo:purge_cache -a appname and deploying again.
You can check that everything is working by running
heroku run console:
6. Optional Release task
You may be interested in checking that RGeo properly supports GEOS at deploy time. If something goes wrong, the deploy will fail.
release entry to your
Create a rake task:
An APT package may not be up to date with the latest version of the library it includes. In the before example, you will get GEOS 3.5.0, but (at the moment I’m writing) version 3.6.2 is out.
If you need newer versions of your libraries, you could use the following approach: Compile libraries on Heroku with Vesuvius.