I am using a Windows 7 x64 computer, with ChefDK 0.3.0-1 installed, with the berkshelf, and omnibus gems installed as well. I setup my Berksfile and metadata.rb files as such
metadata.rb
depends 'users', '~> 1.7'
depends 'sudo', '~> 2.6'
Berksfile
cookbook 'users', git: 'https://github.com/sethvargo-cookbooks/users.git', rel: 'cookbooks/users', tag: 'v1.7.0'
cookbook 'sudo', git: 'https://github.com/opscode-cookbooks/sudo.git', rel: 'cookbooks/sudo', tag: 'v2.6.0'
I set the environment variable in my System Environment Variables to:
BERKSHELF_PATH=C:/
However, when I issue the command:
> berks install
I get the following error:
C:\c\c\cookbook_test> berks install
Resolving cookbook dependencies...
Fetching 'addm_setup' from source at .
Fetching 'sudo' from https://github.com/opscode-cookbooks/sudo.git (at v2.6.0/cookbooks/sudo)
Git error: command `git filter-branch --subdirectory-filter "cookbooks/sudo" --force` failed. If this error persists, try removing the cache directory at 'C:/chef/.cache/git/6f5ef5c786d127e1b549253a13b5d48c181aedeb'.Output from the command:
Found nothing to rewrite
I figured out I can't use the Cygwin Git, either because I don't know what to configure for it or something, and that the Git from git-scm works so far. I'm also using Windows Command Prompt to execute these commands. I'm not sure what to do from here, or what this is trying to tell me.
Unfortunately, and fortunately, this was a simple answer. I was receiving the errors listed in the question because I had the
rel: 'cookbooks/sudo'
What that was doing was looking for a pre-existing repository, but that didn't exist. So, once I removed that, the cookbooks were downloaded and included for use.
The new results were:
C:\c\c\cookbook_test> berks install
Resolving cookbook dependencies...
Fetching 'cookbook_test' from source at .
Fetching 'sudo' from https://github.com/opscode-cookbooks/sudo.git (at v2.6.0)
Fetching 'users' from https://github.com/sethvargo-cookbooks/users.git (at v1.7.0)
Fetching cookbook index from https://supermarket.getchef.com...
Using cookbook_test (0.1.0) from source at .
Using sudo (2.6.0) from https://github.com/opscode-cookbooks/sudo.git (at v2.6.0)
Using users (1.7.0) from https://github.com/sethvargo-cookbooks/users.git (at v1.7.0)
Related
I am trying to install chef recipes on air-gapped server
I bundled gems listed in all recipes and prepared vendor/cache archive. Copying it into the server and running /opt/chef/embedded/bin/bunlde install --local successfully installed 233 gems but when i run chef-client -j boot.json it finds all gems and doesn't download but still run bundle install step and tries to access rubygems.org and fails
Running chef-client in debug mode doesn't reveal any gem name, its trying to download so i don't know what's missing.
Is there anyway i can skip this step or know which gem is missing ?
Part of the run after loading the cookbooks is to install the gems required in the cookbook metadata.rb.
The client prepare a Gemfile and launch a bundle install to check if the necessary gems are installed and up to date, that's the behavior of bundler and why it tries to connect to rubygems.org.
As said in the comments, vendoring all the gems on each server is far from being efficient, you'd better have an internal gem repository and point your cient to it.
That's nearly what you did, get all gems from your recipes, install them on an internal machine and run gem server.
That can be tedious, and there's other approaches allowing to mirror rubygem internally more easily described here
I have set up my aws environment succesfully. However i am having one probelem. In my Gemfile i have the following line:
gem 'activeadmin', :github => 'gregbell/active_admin'
When i do a git aws.push i can see the following error in the aws logs:
/usr/local/share/ruby/gems/2.0/gems/bundler-1.3.5/lib/bundler/source/git.rb:177:in `rescue in load_spec_files': git://github.com/gregbell/active_admin.git (at master) is not checked out. Please run `bundle install` (Bundler::GitError)
I was able to fix that problem by creating this file: .ebextensions/ruby.config
option_settings:
- option_name: BUNDLE_DISABLE_SHARED_GEMS
value: "1"
- option_name: BUNDLE_PATH
value: "vendor/bundle"
packages:
yum:
git: []
This packages everything into vendor/bundle and my app starts correctyl.
However I have two problems with this approach:
It takes very long to deploy because it needs to install all gems every time
I am not longer able to execute commands when I ssh into the EC2 instance. For example I have to start an rpush deamon. Locally this works with bundle exec rpush development but on EC2 this results in:
bundle exec rpush
/usr/local/share/ruby/gems/2.0/gems/bundler-1.3.5/lib/bundler.rb:284: warning: Insecure world writable dir /var/app/current/vendor/bundle/bin in PATH, mode 040777
git://github.com/gregbell/active_admin.git (at master) is not checked out. Please run bundle install
Is there an other way for installing the gems correctly and at the same time using the system gems? Or if that is not possible, how can I start rpush when the gems are bundled?
Update your Gemfile.lock (bundle install&& bundle update) in your local env. and push a commit with Gemfile and Gemfile.lock. Deploy to AWS again.
Can you check if using gem 'activeadmin', 'git://github.com:gregbell/active_admin' in your Gemfile works for you?
You can also get faster deployments utilizing vendor/cache by following the instructions given here:
http://blogs.aws.amazon.com/application-management/post/Tx2XVRWSS4E971S/Locally-Packaging-Gem-Dependencies-for-Ruby-Applications-in-Elastic-Beanstalk
What solved my problem: I modified the bundle install script and added the --deployment flag
Using openSUSE and Ubuntu with installed dependencies I can't clone the remote repository with Rugged::Repository.clone_at method and getting the error message:
Rugged::NetworkError: This transport isn't implemented. Sorry
The code:
credentials = Rugged::Credentials::SshKey.new(:privatekey=>'path/to/privatekey', :publickey=>'path/to/publickey', :passphrase=>'passphrase')
Rugged::Repository.clone_at 'ssh://github.com/vmoravec/repo', 'dir/to/destination', :credentials => credentials
My Gemfile for a rails project contais reference to the github repo like this:
gem 'rugged', git: 'git://github.com/libgit2/rugged.git', branch: 'development', submodules: true
The gem has been installed with command bundle install --path bundle/
The cloning does not work even with using bundle exec rails console
Installed system packages:
libssh2, libssh2-devel
openssl, libopenssl-devel, libopenssl
There is already similar question asked here on SO, but the solution does not work (although it's for MacOS I think): Getting Rugged::NetworkError on #connect
Removing the bundle/ directory and reinstalling the gems with bundle install --path bundle/ resolved the issue on both systems. It seems that the build system was not able for some reasons to detect the /usr/lib64/libssh2.so.1 dependency required for ssh transport. Carlos, thanks for the hint to use ldd rugged.so to check that.
Gemfile:
source "http://rubygems.org"
gem "nokogiri", :git => "git://github.com/tenderlove/nokogiri.git"
When I run bundle, the following error occurs:
Fetching git://github.com/tenderlove/nokogiri.git
Unfortunately, a fatal error has occurred. Please see the Bundler troubleshooting documentation at http://bit.ly/bundler-issues. Thanks!
C:/Ruby193/lib/ruby/gems/1.9.1/gems/bundler-1.1.4/lib/bundler/source.rb:592:in ``': No such file or directory - git clone "git://github.com/tenderlove/nokogiri.git" "C:/Ruby193/lib/ruby/gems/1.9.1/cache/bundler/git/nokogiri-d4bf05cb9e65f144f074351e5ebe3a0e44c00952" --bare --no-hardlinks (Errno::ENOENT)
How can I solve it?
It's reproducible not only with this gem but also with other gems: cucumber, capybara
I use Windows.
It was because I didn't have Git installed.
I installed Git and added it into PATH system variable. bundle became to work after that
For any other newbies out there, I installed Git on Windows 7 with msysgit.
Then in the msysgit command window (MINGW32) I moved to my rails project directory and ran bundle install and it worked fine.
Thanks for helping me with this Andrey.
we tried to install rake on our pc but there were following errors.. We even tried updating gems but in vain. We need to run some tasks on rake and dont know how to go abt it.
C:\Documents and Settings\nemanich\My Documents\gems>gem install rake-compi 0
.7.0.gem
ERROR: http://gems.rubyforge.org/ does not appear to be a repository
ERROR: Error installing rake-compiler-0.7.0.gem:
rake-compiler requires RubyGems version >= 1.3.5
C:\Documents and Settings\nemanich\My Documents\gems>gem install update_rubygems
.gem
ERROR: http://gems.rubyforge.org/ does not appear to be a repository
ERROR: could not find gem update_rubygems.gem locally or in a repository
Are you behind a proxy server? If so, set your HTTP_PROXY environment variable appropriately. This is the sort of error you get when the repository can't be contacted. For example:
set HTTP_PROXY=http://proxy.mycompany.com:8888
will set it temporarily.
I don't think that's the command to update RubyGems. Have you tried gem update --system? You might be able to install Rake after that.