Skip to content

yoobaky/heroku-buildpack-rgeo-prep

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 

Repository files navigation

heroku-buildpack-rgeo-prep

This buildpack overwrites Heroku's default .bundle/config to set BUNDLE_BUILD__RGEO to Heroku's build directory.

This is needed because projects are actually built somewhere like /tmp/build_1890cktlpat5d.

Setup

Create this .vendor_urls file in the root of your project:

https://s3.amazonaws.com/diowa-buildpacks/geos-3.5.0-heroku.tar.gz
https://s3.amazonaws.com/diowa-buildpacks/proj-4.9.1-heroku.tar.gz

Add this file to git and make sure it ends with a newline.

Now, set up your Heroku configuration:

heroku buildpacks:set https://github.com/diowa/heroku-buildpack-rgeo-prep.git
heroku buildpacks:add https://github.com/peterkeen/heroku-buildpack-vendorbinaries.git
heroku buildpacks:add heroku/ruby
heroku config:set LD_LIBRARY_PATH=/app/lib

If you haven't already set up your Heroku database for postgis, you need to run the following steps. You currently must have a production level database to enable postgis.

Since postgis uses different settings in the database.yml, you need to modify the DATABASE_URL variable. Run the following command and extract the necessary components out of it:

$ heroku config:get DATABASE_URL
postgres://<username>:<password>@<host>:<port>/<database>

With those variables, run the following command

$ heroku config:set DATABASE_URL="postgis://<username>:<password>@<host>:<port>/<database>?postgis_extension=true&search_schema_path=public,postgis"

Enable PostGIS

$ heroku pg:psql
=> CREATE EXTENSION postgis;

Deploy

git push heroku master

Verify it worked

$ heroku run console

>> RGeo::Geos.supported?
=> true
>> RGeo::CoordSys::Proj4.supported?
=> true

If both of these are true, you should be ready to go.

References

Credits

This solution draws from many people's research including

About

A buildpack that allows the RGeo gem to be built successfully on Heroku.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Shell 100.0%