Ruby Gem Dependencies on Offline Server

Ruby gem dependencies on offline server

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.

How do you package a ruby application for offline installation?

You can tell bundler to vendor all the gems needed for your app, by running:

bundle install --deployment

That will create a vendor directory in the root of your application. Make sure you include this directory when moving the app to the standalone server. You will still need to install Ruby, RubyGems, and the bundler gem.

For Ruby and RubyGems you can download their respective installers. You can download a copy of the bundler with gem fetch

gem fetch bundler

This will download a gem file like bundler-1.6.5.gem, which you can install on the standalone server with:

gem install bundler-1.6.5.gem

gem install XYZ locally (without connection to the internet)

Try,

gem install --local path/to/file.gem

Ruby Bundle Install in deployment mode

bundle install will grab the gems from rubygems when run.

bundle package grabs the gems and packages them in vendor/cache.

The package command will copy the .gem files for your gems in the bundle into ./vendor/cache. Afterward, when you run bundle install, Bundler will use the gems in the cache in preference to the ones on rubygems.org.

http://bundler.io/bundle_package.html

How to execute Ruby program with locally installed gems?

You're missing bundle exec in front of your ruby someprogram.rb command.



Related Topics



Leave a reply



Submit