Skip to content
This repository has been archived by the owner on Dec 31, 2022. It is now read-only.

Commit

Permalink
Merge pull request #35 from guavapass/develop
Browse files Browse the repository at this point in the history
Caching bundle installs to speed up deployments
  • Loading branch information
ajgon committed Aug 30, 2016
2 parents 2567b71 + baa0f44 commit f13e4d1
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 4 deletions.
6 changes: 4 additions & 2 deletions libraries/helpers.rb
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,11 @@ def every_enabled_rds
end
end

def perform_bundle_install(release_path)
def perform_bundle_install(shared_path)
bundle_path = "#{shared_path}/vendor/bundle"

execute 'bundle_install' do
command '/usr/local/bin/bundle install --deployment --without development test'
command "/usr/local/bin/bundle install --deployment --without development test --path #{bundle_path}"
cwd release_path
end
end
Expand Down
1 change: 1 addition & 0 deletions recipes/configure.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
create_deploy_dir(application, File.join('shared', 'pids'))
create_deploy_dir(application, File.join('shared', 'scripts'))
create_deploy_dir(application, File.join('shared', 'sockets'))
create_deploy_dir(application, File.join('shared', 'vendor/bundle'))

databases = []
every_enabled_rds do |rds|
Expand Down
4 changes: 2 additions & 2 deletions recipes/deploy.rb
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
migration_command(framework.out[:migration_command])
migrate framework.out[:migrate]
before_migrate do
perform_bundle_install(release_path)
perform_bundle_install(shared_path)

fire_hook(:deploy_before_migrate, context: self,
items: databases + [scm, framework, appserver, worker, webserver])
Expand All @@ -61,7 +61,7 @@
end

before_symlink do
perform_bundle_install(release_path) unless framework.out[:migrate]
perform_bundle_install(shared_path) unless framework.out[:migrate]

fire_hook(:deploy_before_symlink, context: self,
items: databases + [scm, framework, appserver, worker, webserver])
Expand Down
4 changes: 4 additions & 0 deletions spec/unit/recipes/configure_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,10 @@
it 'creates shared/sockets' do
expect(chef_run).to create_directory("/srv/www/#{aws_opsworks_app['shortname']}/shared/sockets")
end

it 'creates shared/vendor/bundle' do
expect(chef_run).to create_directory("/srv/www/#{aws_opsworks_app['shortname']}/shared/vendor/bundle")
end
end

context 'Postgresql + Git + Unicorn + Nginx + Sidekiq' do
Expand Down

0 comments on commit f13e4d1

Please sign in to comment.