Reputation: 18207
I was using serverspec in a VM where internet is available and it was so nice.
But when we need to give the script to testers they have to install it in a machine where internet is not available.
I was trying to install in a local folder in a VM where internet available then installed in test VM. But when i run Serverspec-init it says rspec is not found.
Seems some dependent gems also need to be installed before using it.
Is it not possible to install the whole bundle as one step? How to do that?
Upvotes: 0
Views: 366
Reputation: 7956
Managing gems on a server that doesn't have internet access is definitely a challenge.
One relatively-straightforward way to do what you need is to make use of the vendor/cache
directory in your application and make bundle
know about it when using bundle install
by using the --local
flag.
First, download the gem archive (.gem
file extension) of the bundler
gem by going to its Rubygems page and clicking the "download" link in the bottom right. You'll need to upload that file to your test server and run $ gem install bundler-1.12.15.gem
from the command line.
Now you need to get the .gem
archives for serverspec, its dependencies, and all of its dependencies' dependencies, and put them inside your application in the vendor/cache
directory (create those with $ mkdir -p vendor/cache
) if they don't exist.
Now when you deploy the application to the server, with these .gem
files in vendor/cache
, run bundle install --local
. This will install the gems. You can see the official documentation of the --local
option at the bundler docs.
Upvotes: 2