Xenph Yan
Xenph Yan

Reputation: 83981

Capistrano bundle gems before sending to server

My servers don't have access to external resources (gems, etc), so I manually run

bundle package

then upload the code and run

bundle install --local

How can I get the same behaviour out of Capistrano? Using the Bundler recipe, tries to install the bundles on the server. Whereas I'd like to;

On the build machine

  1. Checkout from SVN
  2. run bundle package
  3. zip and upload the artifact

On the application server

  1. Expand the Zip artifact
  2. run bundle install --local
  3. start the server

I tried

after("deploy:update_code") do
    system("cd #{copy_cache} && bundle package")
end

But that runs the checkout and upload, there didn't seem to be a place to attach after the checkout, but before the zip.

Upvotes: 4

Views: 755

Answers (1)

Xenph Yan
Xenph Yan

Reputation: 83981

It seems the best way to do this is to, run bundle package on the development workstation, and then commit the bundled gems to source control, then run;

bundle install --deployment

Upvotes: 1

Related Questions