从heroku slugs中排除gems中的文件(使用.slugignore,heroku)
我正在使用的 Rails 3.0.x 项目使用了一个 gem,其中包含 Heroku 部署不需要的大量测试数据。我想将其从 Heroku slug 中排除,因为它为 slug 添加了几十兆(并且多次使我们超过 100mb 大小限制,我们的 slug 由于其他原因很大。)
我尝试使用以下方法执行此操作.slugignore 机制,但我找不到一种方法让它排除 gems 中的文件而不是应用程序中的文件。这是一个在bamboo stack上运行的rails 3.0.x应用程序,但如果这些版本中有解决方法/过程,我会升级到rails 3.1和/或cedar stack。
关于解决此问题的其他建议(不是“使巨大的宝石变小”)也很棒并且非常受欢迎。
A rails 3.0.x project I am working with uses a gem that contains a large amount of test data that isn't needed for the heroku deployment. I would like to exclude this from the heroku slug, as it adds a few dozen megs to the slug (and has pushed us past the 100mb size limit several times, our slug is large for other reasons.)
I've tried doing this using the .slugignore mechanism, but I can't find a way to have it exclude files in gems as opposed to files in the app. This is a rails 3.0.x application running on the bamboo stack, but I would upgrade to rails 3.1 and/or the cedar stack if there was a workaround / procedure in those versions.
Other suggestions about fixing this that aren't 'make the huge gem smaller' are also great and extremely welcome.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
在一般用例中,这不起作用,因为在安装 gem 文件之前会删除 .slugignore 匹配的文件。请参阅以下 Heroku 部署输出:
In general use case this will not work because .slugignore matched files are being deleted before installing gem files. See the following bit of heroku deployment output:
在 cedar stack 上,gems 安装到您的
vendor
文件夹中(实际路径类似于vendor/bundle/ruby/1.9.1/gems/
),所以我相信您可以slugignore你需要的子路径,虽然我还没有尝试过。On cedar stack the gems are installed into your
vendor
folder (the actual path is something likevendor/bundle/ruby/1.9.1/gems/
), so I believe you can slugignore the subpaths you need, though I haven't tried it.