Since we are putting more things in the package with Prometheus, the time has come to add some resources towards removing unnecessary parts of the package.
Prime candidates to save a few KB's are:
All software definitions cloned from git can have specs removed (some of them also docs). GitLab Rails still needs the doc directory
Gems with native extensions need to have a build cleanup after
Further investigate which software definitions can be removed as they are used as a build dependency and not a runtime dependency
|Path|Size (MB)|Notes|
|------|-----|------|------|
|/opt/gitlab/embedded/service/gem|313|Lots of gems take 1-2 MB, but rugged is 40 MB, gemojione is 15 MB, ace-rails-ap is 12 MB|
|/opt/gitlab/embedded/lib/python3.4|122|
|/opt/gitlab/embedded/lib/ruby/gems|87|
A quick scan shows that the /opt/gitlab/embedded/lib/python3.4/test directory is 40.5 MB that can probably be cleaned.
I will first start by going through the software definitions and check which libraries are runtime dependencies and which can be removed and added to the build images as build dependencies.
got link from 8.16 release blog,
i noticed new messages appearing with gitlab-ctl reconfigure:
root@soa:/opt/gitlab/embedded/lib/ruby/gems/2.3.0/specifications# gitlab-ctl reconfigureIgnoring RedCloth-4.3.2 because its extensions are not built. Try: gem pristine RedCloth --version 4.3.2Ignoring allocations-1.0.5 because its extensions are not built. Try: gem pristine allocations --version 1.0.5Ignoring bcrypt-3.1.11 because its extensions are not built. Try: gem pristine bcrypt --version 3.1.11Ignoring charlock_holmes-0.7.3 because its extensions are not built. Try: gem pristine charlock_holmes --version 0.7.3Ignoring escape_utils-1.1.1 because its extensions are not built. Try: gem pristine escape_utils --version 1.1.1Ignoring ffi-1.9.17 because its extensions are not built. Try: gem pristine ffi --version 1.9.17Ignoring ffi-1.9.10 because its extensions are not built. Try: gem pristine ffi --version 1.9.10Ignoring ffi-yajl-2.3.0 because its extensions are not built. Try: gem pristine ffi-yajl --version 2.3.0Ignoring hamlit-2.6.1 because its extensions are not built. Try: gem pristine hamlit --version 2.6.1Ignoring http_parser.rb-0.6.0 because its extensions are not built. Try: gem pristine http_parser.rb --version 0.6.0Ignoring kgio-2.10.0 because its extensions are not built. Try: gem pristine kgio --version 2.10.0Ignoring libyajl2-1.2.0 because its extensions are not built. Try: gem pristine libyajl2 --version 1.2.0Ignoring RedCloth-4.3.2 because its extensions are not built. Try: gem pristine RedCloth --version 4.3.2Ignoring allocations-1.0.5 because its extensions are not built. Try: gem pristine allocations --version 1.0.5Ignoring bcrypt-3.1.11 because its extensions are not built. Try: gem pristine bcrypt --version 3.1.11Ignoring charlock_holmes-0.7.3 because its extensions are not built. Try: gem pristine charlock_holmes --version 0.7.3Ignoring ffi-yajl-2.3.0 because its extensions are not built. Try: gem pristine ffi-yajl --version 2.3.0Ignoring libyajl2-1.2.0 because its extensions are not built. Try: gem pristine libyajl2 --version 1.2.0Ignoring ffi-1.9.17 because its extensions are not built. Try: gem pristine ffi --version 1.9.17Ignoring ffi-1.9.10 because its extensions are not built. Try: gem pristine ffi --version 1.9.10Ignoring ffi-1.9.17 because its extensions are not built. Try: gem pristine ffi --version 1.9.17...
while i like that it does not attempt to build extensions again (some performance boost), this may be confusing for some users.
ps: two ffi versions installed is also weird, i wonder how they don't conflict, ruby can't load afaik two versions of same gem at the same time like nodejs can.
@marin not sure what you mean, but those are emitted with any other bundler related commands as well:
root@soa:/# gitlab-rake Ignoring RedCloth-4.3.2 because its extensions are not built. Try: gem pristine RedCloth --version 4.3.2Ignoring allocations-1.0.5 because its extensions are not built. Try: gem pristine allocations --version 1.0.5Ignoring bcrypt-3.1.11 because its extensions are not built. Try: gem pristine bcrypt --version 3.1.11Ignoring charlock_holmes-0.7.3 because its extensions are not built. Try: gem pristine charlock_holmes --version 0.7.3Ignoring RedCloth-4.3.2 because its extensions are not built. Try: gem pristine RedCloth --version 4.3.2Ignoring allocations-1.0.5 because its extensions are not built. Try: gem pristine allocations --version 1.0.5Ignoring bcrypt-3.1.11 because its extensions are not built. Try: gem pristine bcrypt --version 3.1.11Ignoring charlock_holmes-0.7.3 because its extensions are not built. Try: gem pristine charlock_holmes --version 0.7.3D, [2017-01-23T18:06:47.250945 #28045] DEBUG -- sentry: ** [Raven] cannot load such file -- haml_lint/rake_task excluded from capture due to environment or should_capture callbackrake aborted!LoadError: cannot load such file -- haml_lint/rake_task/opt/gitlab/embedded/service/gitlab-rails/lib/tasks/haml-lint.rake:2:in `<top (required)>'/opt/gitlab/embedded/service/gitlab-rails/Rakefile:10:in `<top (required)>'(See full trace by running task with --trace)D, [2017-01-23T18:06:47.355735 #28033] DEBUG -- sentry: ** [Raven] ["rake", "brakeman"] failed! excluded from capture due to environment or should_capture callbackrake aborted!["rake", "brakeman"] failed!/opt/gitlab/embedded/service/gitlab-rails/lib/tasks/gitlab/test.rake:13:in `block (3 levels) in <top (required)>'/opt/gitlab/embedded/service/gitlab-rails/lib/tasks/gitlab/test.rake:12:in `each' /opt/gitlab/embedded/service/gitlab-rails/lib/tasks/gitlab/test.rake:12:in `block (2 levels) in <top (required)>'/opt/gitlab/embedded/service/gitlab-rails/lib/tasks/test.rake:5:in `block in <top (required)>'/opt/gitlab/embedded/bin/bundle:22:in `load'/opt/gitlab/embedded/bin/bundle:22:in `<main>'Tasks: TOP => gitlab:test(See full trace by running task with --trace)root@soa:/#
note the above failure is because --without tests version of the gitlab-ce package was produced. ps can you point to MR where actual size trimming changes landed for 8.16?
I don't see any of those errors when I run any of the commands. But apprently you are doing some custom packaging of your own so that could be the issue. All the MR's are referenced in this issue.
@marin seems 8.16.1 fixed something. i checked the deb and indeed 8.16.0 had duplicate gem installs, 8.16.1 has just one ffi gem, while 8.16.0 had two. so with 8.16.1 gitlab-ctl reconfigure does not complain about gems, but gitlab-rake still does.
i'm sure removing /opt/gitlab/embedded/service/gem/ruby/2.3.0/gems dir has something to do with that, i.e that gem extensions are now installed only to /opt/gitlab/embedded/lib/ruby/gems/2.3.0/extensions/x86_64-linux/2.3.0 not both places.
however, gitlab-rake without arg invoking itself twice once for production then for test and then failng is happening in 8.15 as well, so filing new issue about that