heroku deploy taking very long
Asked Answered
D

2

7

We've got a fairly large app that's going up on heroku... It's an app using browsercms as the base, and it's built on top of that. The Gemfile isn't that big (we don't have more gems than our average app) but for some reason, deploying takes 15 minutes. Compiling and pushing assets to s3 (via assetsync) takes about 5 minutes due to all the assets, but the remaining 10 minutes is spent during this:

----> Heroku receiving push   
-----> Removing .DS_Store files
-----> Ruby/Rails app detected
-----> Using Ruby version: ruby-1.9.3
-----> Installing dependencies using Bundler version 1.2.0
       Running: bundle install --without development:test --path vendor/bundle --binstubs bin/ --deployment

Anyone have any clue why this part takes so long? The gemfile lock is in the repo, and pushed to heroku, and here's a gist of our gemfile: https://gist.github.com/aa44bbb06eed97736c20

EDIT: We're on rails 3.2.7

Delldella answered 15/9, 2012 at 19:26 Comment(3)
Have you tried vendoring your gems? Try using bundle package to cache the downloaded .gem files, and then run git add . && git commit -m "Vendor in Gems to add them to your repository. This should make the Gem installation instant (assuming that is the bottleneck).Linebacker
It could also be the asset compilation stage, in which case you would want to run rake assets:precompile && git commit -a -m "Recompile assets" before every deploy.Linebacker
Vendoring the gems helped a smidgen... and precompiling locally didn't really save time - it took about just as long.Delldella
S
2

When bundler uses a gem that has a git repo it will download the entire git repo in order to include the gem, not just the master branch or whatever branch is the main branch.

We had this same issue with the rails_admin gem by sferik.

It might help if you specify a specific branch like so:

gem "browsercms", "3.5.3", git: 'git://github.com/josiahivey/browsercms.git', :branch => 'master'

One way to tell is to look at the compiled slug size before and after you make a change. In our case, rails_admin was responsible for about 30mb of our slug size. Heroku has a 100mb slug size limit too, just FYI.

You may also try running the bundle pack command like this:

bundle pack --all

This will put all your gems (supposedly the git ones too, because of the --all switch) into your vendor/cache directory.

As indicated in this github isssue for the bundler project (look at the end, where a heroku guy responds):

https://github.com/carlhuda/bundler/issues/67

Sheelagh answered 19/9, 2012 at 19:1 Comment(1)
Specifying the branch saved a couple megs at best. We're currently at a 55 meg slug size (a lot of that being browsercms).Delldella
D
0

Two things sped up this process. Bundler 1.2.1 seemed to help, and turbo sprockets saved a good couple minutes. It's tolerable now.

Delldella answered 15/10, 2012 at 19:5 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.