-
Notifications
You must be signed in to change notification settings - Fork 1.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Bundler cache (including compact index) is written to /app and into the slug #1117
Comments
Related support ticket 958280 |
I looked into this heavily for #1118 The cache is only used at On first bundle install the cache is downloaded and written here https://github.com/rubygems/rubygems/blob/be08d8307eda3b61f0ec0460fe7fbcf647b526e6/bundler/lib/bundler/compact_index_client/updater.rb#L64 Where Based on this it seems that making these files available at runtime add nothing (because people don't The other question is: Is it helpful to preserve these between deploys? It depends on how frequently the etag is invalidated. @hone knows more about the whole compact index so he might have some insight. My very unscientific attempt to answer this question was to deploy an app to heroku today and see if it has the same etag or not:
So it looks like there may be some benefit to keeping them around. I think it's worth benchmarking the download of the index. If it's already on us-east and coming from S3 then there's no speed benefit from putting it in the cache. For CNB where there's the local install case to think about, it's likely a good idea to cache it (even if it's fast). This does make me vaguely wish there was some kind of cross-app cache or mechanism since it seems wasteful to duplicate this across N caches (where N is number of apps on the platform). |
Etag still valid:
|
Etag still valid
|
I'm unsure if this also happens in the CNB as well. Need to investigate if this is still an issue or not |
I'm currently auditing official/popular buildpacks for compatibility with potentially changing the build directory to
/app
in the future.One of the potential source of problems for such a move, is that files written to
/app
(or to$HOME
, which is/app
during the build) will now be included in the slug, when previously they were not. As such, I'm checking what files are left behind by buildpacks in/app
, using this buildpack which lists the contents of/app
at build time:https://github.com/edmorley/heroku-buildpack-list-app-dir
Testing the Ruby getting started guide with the Ruby buildpack + the above buildpack, I see that the bundler cache (
~/.bundle/cache/compact_index
) is being written to/app
. Once the build directory is/app
, this would cause the slug size to increase, potentially pushing apps closer to the limit. For the getting started guide this cache is only 18MB, but it doesn't have as many dependencies as some typical Rails apps.It seems there are few options:
$CACHE_DIR
instead/tmp
instead of$HOME
, or else (b) delete it from$HOME
at the end of the buildThe text was updated successfully, but these errors were encountered: