Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to reduce heroku slug size?

My slug size is 89.5MB which is huge.

However the repository size is quite small:

$ du -hsc 
8.0M    . 
8.0M    total

Following this blog post: http://dazedthots.blogspot.com/2011/07/reducing-slug-size-heroku.html , there is a bug on Heroku with changing Gemfiles. Mine has changed several times including git dependencies but now, the only git dependency is "rails_admin". See below:

source 'http://rubygems.org'

gem 'rails',      '~> 3.1.0'
gem 'rails-i18n', '~> 0.1.3'
gem 'pg',         '~> 0.11.0'
gem 'rake',       '~> 0.8.7'
gem 'thin', '~> 1.2.11'
gem 'heroku', '~> 2.4.0'
gem 'squeel',     '~> 0.8.6'
gem 'devise', '~> 1.4.2'
gem 'slim-rails',  '~> 0.2.0'
gem 'simple_form', '~> 1.4.2'
gem 'will_paginate', '~> 3.0'
gem 'sunspot_rails', '~> 1.2.1'
gem 'jquery-rails',    '~> 1.0.12'
gem 'modernizr-rails', '~> 2.0.6'
gem 'rails_admin', git: 'https://github.com/sferik/rails_admin.git'
gem 'sass-rails',   '~> 3.1.0'
gem 'coffee-rails', '~> 3.1.0'
gem 'uglifier',     '~> 1.0.0'
gem 'newrelic_rpm'

I've contacted the Heroku support but no answer until now? Any idea?

like image 356
jbescoyez Avatar asked Aug 31 '11 11:08

jbescoyez


2 Answers

Finally, after 3 days, Heroku cleaned up my cache. Everything is fine now though my slug is still 54MB which seems too big.

Heroku confirmed there was no other solution than contacting them to resolve this issue. Hopefully, it will be resolved in a future version of bundler.

like image 198
jbescoyez Avatar answered Oct 04 '22 20:10

jbescoyez


I've been able to trim a few megabytes here and there by listing directories in the .slugignore file. That may help you stay under the 100mb limit until this issue gets resolved.

You may also want to experiment with pushing your changes into a new repository without history, since it looks like Heroku is penalizing you with the full size of the cloned git tree that you are referencing.

like image 30
M. Scott Ford Avatar answered Oct 04 '22 20:10

M. Scott Ford