aaronrenner / heroku-buildpack-rgeo-prep

A buildpack that allows the RGeo gem to be built successfully on Heroku.
17 stars 16 forks source link

add gems post-buildpack #1

Open carendt242 opened 11 years ago

carendt242 commented 11 years ago

to save others a few hours of frustration, you should mention that you should add the rgeo & rgeo-activerecord gems on a second push after the initial push of the buildpack.

your instructions did not work until i followed the exact sequence laid out in the spatial DB instructions. even there, it's not explicitly mentioned, which it probably should be. (for example, those of us who have it running successfully on localhost would already have the gems in Gemfile.)

thanks!

jhirn commented 11 years ago

+1 on this. We also lost some time because we didn't realize this until after. A note in the README would be nice but it would be even better to avoid it all together.

Can't complain too much, glad I didn't have to write this buildpack myself. Thx @aaronrenner

ZavenArra commented 10 years ago

can't figure out how to remove rgeo and rgeo-activerecord gems for an initial push, and then add them back in, since this causes RGeo not found errors for my pre-existing code and stops the deployment.

ZavenArra commented 10 years ago

never would have figured it out without this issue! thanks @carendt242 on this one. here's what I had to do. Since I already have rgeo, rgeo-activerecord, and activerecord-mysql2spatial-adapter in my Gemfile, I had to configure to be able to push to heroku without these gems. That means remove all three (actual rego and rego-activerecord dependencies of activerecord-mysql2spatial-adapter) and skip the asset pipeline precompile - by creating an empty manifest.yml in public/assets/. the asset precompile step was causing heroku to exit on a missing RGeo object error in one my models. Then bundle install, commit, and push to heroku. I then did heroku config:set BUNDLE_BUILD__RGEO="--with-geos-dir=/app --with-proj-dir=/app" (not sure if completely necessary) Then re-enabling rgeo, rgeo-activerecord, and activerecord-mysql2spatial-adapter in Gemfile, bundle install, commit, push to heroku - this triggers the rgeo install with the items installed by the buildpack. RGeo::Geos.supported? at the console gives true, good to go.

aaronrenner commented 10 years ago

I'm not currently working on a project that uses this buildpack, so I haven't had time to refine and update these instructions. If you have some changes to the readme, please send me a pull request and I'll merge it in. Thanks.

gyllen commented 10 years ago

I also run in to this. Is there anyway to force a reinstall of a pushed gem on heroku. Really do not want to go through the trouble you had @deepwinter.

radcliff commented 10 years ago

https://github.com/radcliff/drought-monitor-api/commits/master

take a look at this repo, notice how i dont add rgeo and related gems until a few commits in? thats because you have to push the dependencies to heroku first and tell heroku the correct path BEFORE pushing the commit with the rgeo gem installed in the app. really crazy i know

i will find the exact sequence of the install and send it to you tomorrow good luck, and dont pull your hair out, it's totally possible!

On 7/23/14, 8:34 PM, Johan Gyllenspetz wrote:

I also run in to this. Is there anyway to force a reinstall of a pushed gem on heroku. Really do not want to go through the trouble you had @deepwinter https://github.com/deepwinter.

— Reply to this email directly or view it on GitHub https://github.com/aaronrenner/heroku-buildpack-rgeo-prep/issues/1#issuecomment-49964025.

gyllen commented 10 years ago

So I already have a working repo.This was my somewhat hacky solution. My first thought was to just install a version from github and make it pull from there in the Gemfile. However rgeo add the tag nonrelease to the version number which makes dependencies with postgis adapter a no go. So here is what I did. Do it on your on risk since I guess there is a reason for the nonrelease tag.

Add following line to your gem file

gem 'rgeo', git: 'https://github.com/gyllen/rgeo'

Then do

bundle install

Push to heroku (stuff will rebuild). You can now remove the line with my fork.

bundle install

Push to heroku again

johnlinvc commented 9 years ago

I wasted several hours on this issue as well.

The problem is that I didn't realize that I need to install this buildpack until I deploy and see the code breaks.

I tried @gyllen 's solution but in vain. But since I use rgeo only without it's adapters, I end up using the version straight from github

gem 'rgeo', github: 'rgeo/rgeo'

And this solve the problem. I also discover that if I successfully reinstall rgeo with geos support. heroku will show Removing (extensions) in the deploy output.

so the install steps for who already installed rgeo on heroku before install this buildpack should be

  1. Install this buildpack with the instruction.
  2. Deploy.
  3. Change the Gemfile to use rgeo straight from source.
  4. Deploy again.
jszwedko commented 9 years ago

Following @johnlinvc's suggestions allowed this to work for me though it is unclear exactly why.

bartolsthoorn commented 8 years ago

Alternative method: After pushing the new buildpacks, run the following commands:

heroku plugins:install heroku-repo
heroku repo:gc -a appname
heroku repo:purge_cache -a appname

And deploy again. The commands above will remove the installed gems on heroku. When you deploy again a fresh bundle install will install all gems again.