4

rake assets:precompile is fast (<10 seconds) both locally and when I run it on heroku:

heroku run time rake assets:precompile --trace (clean first)

During deploy to heroku it takes around 10 minutes.

How do I figure out what the problem is here and fix it?

For reference I have tried all these:

We are on Rails 3.2.13, Ruby 2.0.0p353

Community
  • 1
  • 1
blu
  • 12,905
  • 20
  • 70
  • 106
  • Got some gists of the trace/gemfile? If you are using something like turbo-sprockets-rails, then you should see fast local compiles as long as you are only working with a partial recompilation. – Sebastian Iorga Mar 13 '14 at 14:33

1 Answers1

0

You should try storing your assets in memcached/redis database so you only need to compile the ones that have changed in each release you deploy:

Setup a redis/memcached database w/ Heroku (http://addons.heroku.com/) or use the one you already have

Configure an Asset cache store (via config/environments/production.rb):

config.assets.cache_store = [ :redis_store,  {
  url: ENV['REDIS_URL'] || 'redis://127.0.0.1/0',
  namespace: 'assets'
}]

We have been able to get our asset precompilations times down < 30sec using this method from several minutes.

Winfield
  • 18,985
  • 3
  • 52
  • 65
  • 1
    This does not address the root problem and only works until you change some asset related configuration and need to recompile everything. – Gunchars Oct 27 '14 at 22:42