从heroku slugs中排除gems中的文件(使用.slugignore,heroku)

发布于 2024-12-14 04:37:34 字数 344 浏览 3 评论 0原文

我正在使用的 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

好倦 2024-12-21 04:37:34

在一般用例中,这不起作用,因为在安装 gem 文件之前会删除 .slugignore 匹配的文件。请参阅以下 Heroku 部署输出:

-----> Deleting 2 files matching .slugignore patterns.
-----> Ruby/Rails app detected
-----> Installing dependencies using Bundler version 1.3.0.pre.5
       Running: bundle install --without development:test --path vendor/bundle --binstubs vendor/bundle/bin --deployment
       Using rake (10.0.3)
       Using Platform (0.4.0)
       Using open4 (1.3.0)
       ...

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:

-----> Deleting 2 files matching .slugignore patterns.
-----> Ruby/Rails app detected
-----> Installing dependencies using Bundler version 1.3.0.pre.5
       Running: bundle install --without development:test --path vendor/bundle --binstubs vendor/bundle/bin --deployment
       Using rake (10.0.3)
       Using Platform (0.4.0)
       Using open4 (1.3.0)
       ...
站稳脚跟 2024-12-21 04:37:34

在 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 like vendor/bundle/ruby/1.9.1/gems/), so I believe you can slugignore the subpaths you need, though I haven't tried it.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文