Two scenarios:
1. have the source code locally so chef only have to compile it2. have the package file locally so chef only have to install it using the package manager
Have the source code locally:
This was the first experiment so dont expect any code quality on it. (its added as a todo task already)1. Create folder - cookbooks/nodejs/files
2. Create folder - cookbooks/nodejs/files/default
3. Download http://nodejs.org/dist/v0.8.6/node-v0.8.6.tar.gz (nodejs source)
4. Move the tar file to default folder
5. Comment the following lines from /cookbooks/nodejs/recipes/install_from_source.rb
#remote_file "/usr/local/src/#{nodejs_tar}" do
# source nodejs_src_url
# checksum node['nodejs']['checksum']
# mode 0644
#end
6. Add the following lines instead
cookbook_file "/usr/local/src/#{nodejs_tar}" do
action :create
source "node-v0.8.6.tar.gz"
mode 0644
end
7. destroy the VM and initialize it again using 'vagrant up'
8. Done!!
Todo:
1. Update the recipe to have this as a config option so I can propose the change back to the author of the recipe2. Make the same changes on the install_from_package.rb
It still takes too long to startup (430seconds) and i suspect that most of that time is spent on downloading build-essential tools and compiling node from source. I hope this will be fixed once i introduce locally saved packaged file.