Ruby gem dependencies on offline server

Peter B picture Peter B · Jul 2, 2012 · Viewed 11.7k times · Source

I have a server that is totally disconnected from the Internet (for some strange security reasons).

How can I make the Ruby dependencies to various gems work in that environment? It might work with Bundler, but how do I install Bundler using gem without a Internet connection?

Answer

KL-7 picture KL-7 · Jul 2, 2012

You can download bundler as a .gem file from rubygems and install it on the server with

gem install /path/to/bundler.gem

Then you can pack all gems required for your application into ./vendor/cache directory with

bundle package

If now you deploy your app (along with ./vendor/cache directory) to the server and run

bundle install --local

bundler won't go to rubygems, but instead will install all gems from ./vendor/cache directory.

See bundler-package docs for more information.