capistrano / bundler

Bundler support for Capistrano 3.x
MIT License
219 stars 83 forks source link

Speed up `bundle install` when gems did not change #99

Closed vassilevsky closed 6 years ago

vassilevsky commented 6 years ago

Hello everyone!

Bundler has the --local flag that disables expensive network requests. Makes sense to try it first.

If gems are not yet installed on the server, it will fail. In this case, the "normal" command will be executed. It will download new gems.

The drawback of this solution is that the local command is not printed. Doesn't look like a big deal though. The "normal" command is printed. Please do let me know if it's better to print the original as well, and how, because I don't have a clear idea.

I have tested this change on a real project. Deployment time dropped by ~20 seconds. The server is in Moscow.

capistrano-bot commented 6 years ago

Thanks for the PR! This project lacks automated tests, which makes reviewing and approving PRs somewhat difficult. Please make sure that your contribution has not broken backwards compatibility or introduced any risky changes.

Generated by :no_entry_sign: Danger

vassilevsky commented 6 years ago

I have discovered #95 and realised that this PR is not necessary.

I have collected some timings from the commands. The project has 264 gems in total. All commands ran on the bundle directory that already contained all required gems (from previous installs).

bundle install --path /path/to/project/shared/bundle --without development test --deployment --quiet         # 30.127s
bundle install --path /path/to/project/shared/bundle --without development test --deployment --quiet --local #  4.540s
bundle check --path /path/to/project/shared/bundle                                                           #  1.794s

So bundle check is clearly the winner here. Making it work is the way to go.