Closed browniebroke closed 7 years ago
I "resolved" this issue by swapping the order of the buildpacks in the .buildpacks
file:
https://github.com/heroku/heroku-buildpack-python.git#v62
https://github.com/cyberdelia/heroku-geo-buildpack.git#1.3
However, this causes other issues, at least collectstatic fails:
remote: -----> Preparing static assets
remote: Collectstatic configuration error. To debug, run:
remote: $ heroku run python manage.py collectstatic --noinput
Collectstatic is now run before geo-buildpack is installed.
Looking at the buildpack-multi source, it treats the last declared buildpack differently, so my workaround is probably invalid...
I am having trouble getting geodjango running too, the .heroku/vendor
folder seems to be missing.
After a bit of investigation, for some reason when using this buildpack alone the vendor
folder is created, but when the python buildpack is used afterwards it isn't.
For now as a temp workaround I've just forked the python buildpack and prepended this buildpack's compile script on the front and exported the appropriate env vars.
I'd investigate further but now the free postgres tier doesn't include support for postgis =/
I am having the same problem. Will do some investigation of my own.
My crude solution:
.buildpacks:
https://github.com/heroku/heroku-buildpack-python.git#v61
https://github.com/cyberdelia/heroku-geo-buildpack.git#1.3
https://github.com/heroku/heroku-buildpack-python.git#v61
Collectstatic fails the first time after a purge_cache, but succeeds the second time it tries.
And if you have any bin/post_compile
steps, then make sure to ignore the warnings generated in the first pass.
I have been able to reproduce this on dokku. It looks like the first time a clean build is done, the contents of the $BUILD_DIR don't make its way into the actual image. Once a build has succeeded and the build dir has the data cached, the subsequent builds DO get the data into $APP_VENDOR, and so it succeeds.
So a workaround when deploying for the first time (or with a cleaned build cache), is to do a build but not fail any checks for the GEOS libraries. Then, deploy again and it'll all be okay.
Heroku seem to have done some work to improve compatibility with multi build packs, but upgrading doesn't help with this issue.
However, I've applied @gareth-lloyd workaround, and it works for me.
For what it's worth, I've tried today to migrate to the official multi buildpacks from Heroku and the problem persists:
$ heroku buildpacks
=== Buildpack URLs
1. heroku/nodejs
2. https://github.com/cyberdelia/heroku-geo-buildpack.git#1.3
3. heroku/python
I'm also using the nodejs buildpack to run bower, and I noticed that the .heroku/node
doesn't vanish like .heroku/vendor
does:
~ $ ls -la .heroku/
total 24
drwx------ 4 u29867 dyno 4096 Jan 5 11:29 .
drwx------ 13 u29867 dyno 4096 Jan 5 11:31 ..
drwx------ 7 u29867 dyno 4096 Jan 5 11:28 node
drwx------ 8 u29867 dyno 4096 Jan 5 11:30 python
-rw------- 1 u29867 dyno 9 Jan 5 11:29 python-stack
-rw------- 1 u29867 dyno 14 Jan 5 11:29 python-version
I believe this line is to blame.
https://github.com/heroku/heroku-buildpack-python/blob/master/bin/steps/python#L18
@kennethreitz: does it mean we can expect a change/fix in the heroku python buildpack? I appreciate changing the line you're pointing at might impact all third parties buildpack like this one, meaning clearing the .heroku/vendor
is not the python's buildpack responsability?
@gareth-lloyd workaround is not applicable with Heroku multi-buildpack.
@browniebroke I am looking into the possibility of a fix this week.
The true problem here lies in the fact that the Python buildpack thinks the first push of an application is a stack change (I think). .heroku/vendor
is actually a pattern that was created by the Python buildpack, and that it fully utilizes internally for all extra-supported C libraries.
Closing this issue as it's not happening anymore. Haven't seen it in a while and I just tried to cause it again on our testing environment, the problem is gone.
Good news! I put some work into fixing it — glad to hear it is indeed fixed :)
This issue is probably related to #29, but the other way round. The first deploy with purged cache breaks my application (although it completes fine), and pushing an empty deploy immediately after fixes it. I'm using this buildpack with the default Heroku Python buildpack.
.buildpacks file:
Commands to reproduce
At this stage, my application is responding with Internal Server error and in the logs the exception raised is
ImproperlyConfigured: Could not import user-defined GEOMETRY_BACKEND "geos"
which means Django cannot find the geo libraries. I've noticed that the.heroku/vendor
folder is missing on my application:To get my application back up, I only need to run:
At this stage
.heroku/vendor
is back:I think it started happening when I upgraded to Cedar-14 from Cedar. This is a problem because yesterday I made a normal deploy and for some reason Heroku decided to clear the cache, breaking my application.
Not sure if due to the same root cause as #29 so opening a separate issue.