ere*_*ere 11 ruby-on-rails heroku buildpack bower ruby-on-rails-4
我开始用我的Heroku应用程序撞墙了.
我很清楚slug大小,re:图像,PDF和其他材料的正常问题,但我的问题可能围绕着由凉亭或可能构建包带来的其他资产.
https://devcenter.heroku.com/articles/slug-compiler 多次部署后的Heroku Slug大小
我的Heroku compliled slug看起来像这样:
$ du -h --max-depth=1
4.0K ./.bower-tmp
30M ./tmp
24K ./features
236K ./config
195M ./public
4.0K ./log
34M ./bin
792K ./db
355M ./vendor
8.0K ./.heroku
22M ./app
64K ./lib
8.0K ./.bundle
136K ./.bower-registry
22M ./.bower-cache
24M ./node_modules
12K ./.profile.d
Run Code Online (Sandbox Code Playgroud)
到目前为止,最大的是供应商(355M),但我的本地供应商文件夹实际上是空的,因为是公共的(195M).
但是在heroku上它看起来像:
40M vendor/ruby-2.0.0
21M vendor/node
32K vendor/heroku
12K vendor/assets
103M vendor/jvm
192M vendor/bundle
195M public/assets (bower bloat?)
Run Code Online (Sandbox Code Playgroud)
我猜这是用于凉亭和PDF生成的几个构建包之一.
https://github.com/heroku/heroku-buildpack-nodejs
https://github.com/heroku/heroku-buildpack-ruby
https://github.com/razorfly/wkhtmltopdf-buildpack
Run Code Online (Sandbox Code Playgroud)
我的应用程序本身看起来很瘦22M,但我现在的heroku SLUG是298.4MB!du如果我不使用这些构建包,而是在构建之间迁移到本地计算机上的资产编译,那么单独的供应商目录就不止于此了?我不确定一个好的部署策略(/ slug饮食)应该是什么样的,任何想法都会受到高度赞赏.
更新:
我也试过从我读过的其他人那里重建那个slug,但是没有效果.编译后的团块大小保持不变.
heroku plugins:install https://github.com/heroku/heroku-repo.git
heroku repo:rebuild -a appname
Run Code Online (Sandbox Code Playgroud)
构建的GIST:https://gist.github.com/holden/b4721fc798bdaddf52c6
更新2(遵循drorb提出的优秀想法之后)
12K ./.profile.d
21M ./app
4.0K ./log
812K ./db
8.0K ./.heroku
236K ./config
195M ./public
19M ./.bower-cache
60K ./lib
253M ./vendor
4.0K ./.bower-tmp
128K ./.bower-registry
34M ./bin
30M ./tmp
24M ./node_modules
24K ./features
8.0K ./.bundle
Run Code Online (Sandbox Code Playgroud)
供应商
12K vendor/assets
193M vendor/bundle
21M vendor/node
32K vendor/heroku
40M vendor/ruby-2.0.0
Run Code Online (Sandbox Code Playgroud)
公共/资产(很长)
大小vendor/jvm为103M。由于您没有使用 JRuby,所以我可以找到使用它的唯一原因是使用 yui-compressor gem。查看heroku-buildpack-ruby,似乎在这种情况下安装了JVM:
def post_bundler
if bundler.has_gem?('yui-compressor') && !ruby_version.jruby?
install_jvm(true)
ENV["PATH"] += ":bin"
end
end
Run Code Online (Sandbox Code Playgroud)
如果你可以避免使用 yui-compressor,你应该能够节省 103M 的 slug 大小。
| 归档时间: |
|
| 查看次数: |
489 次 |
| 最近记录: |