Chef solo with berkshelf: cookbook not resolved - vagrant

I've created this Vagrantfile's provioner section:
config.vm.provision "chef_solo" do |chef|
chef.add_recipe "wildfly"
end
I'm getting this error:
==> default: Error Resolving Cookbooks for Run List:
==> default:
==> default: Missing Cookbooks:
==> default: ------------------
==> default: No such cookbook: wildfly
So, I've created a Berksfile and a metadata.rb files:
Berksfile:
source 'https://supermarket.chef.io'
metadata
metadata.rb:
name 'webapi'
maintainer 'The Authors'
maintainer_email 'you#example.com'
license 'all_rights'
description 'Installs/Configures webapi'
long_description 'Installs/Configures webapi'
version '0.1.0'
depends 'java_se', '~> 9.0.1'
depends 'wildfly', '~> 0.4.0'
So, then I've performed berks install command. The first issue I've detected is that I don't quite detect where berks has placed cookbooks. It seems that it works right, nevertheless, I don't find where cookbooks dependencies are located, I mean, a .\cookbooks folder is not created after performing berks install command.
Resolving cookbook dependencies...
Fetching 'olingo' from source at .
Fetching cookbook index from https://supermarket.chef.io...
Using apt (6.1.4)
Using homebrew (4.2.0)
Using java (1.50.0)
Using java_se (9.0.1)
Using ohai (5.2.0)
Using olingo (0.1.0) from source at .
Using wildfly (0.4.0)
Using yum (5.1.0)
Using windows (3.4.0)
Regardless of that, I've performed vagrant provision again, and wildfly cookbook is not resolved:
The cookbook path 'D:/projects/swiller/querydsl/olingo/infrastructure/cookbooks' doesn't exist. Ignoring...
Running provisioner: chef_solo...
==> default: Error Resolving Cookbooks for Run List:
==> default:
==> default: Missing Cookbooks:
==> default: ------------------
==> default: No such cookbook: wildfly

You either need to use the vagrant-berkshelf plugin, or use the berks vendor command to write all the cookbooks to a folder and then point Vagrant at that (which is what the plugin does internally). berks install only downloads them to your workstation, it doesn't put the cookbooks in a place/format that anything other than Berkshelf understands.

Related

Chef-zero provision: unlocated cookbook

I'm getting this message:
==> default: ================================================================================
==> default: Recipe Compile Error
==> default: ================================================================================
==> default:
==> default: Chef::Exceptions::RecipeNotFound
==> default: --------------------------------
==> default: could not find recipe default for cookbook olingo
==> default: System Info:
==> default: ------------
==> default: chef_version=13.6.4
==> default: platform=centos
==> default: platform_version=7.4.1708
==> default: ruby=ruby 2.4.2p198 (2017-09-14 revision 59899) [x86_64-linux]
==> default: program_name=chef-client worker: ppid=4729;start=20:31:47;
==> default: executable=/opt/chef/bin/chef-client
As you can see, chef is not able to find olingo cookbook.
My vagrant chef-zero provision section is:
config.vm.provision "chef_zero" do |chef|
chef.cookbooks_path = "berks-cookbooks"
chef.data_bags_path = "data_bags"
chef.nodes_path = "nodes"
chef.roles_path = "roles"
chef.add_recipe "olingo" <<<<1>>>>
end
As you can see at <<<<1>>>>, I've specified that chef installs olingo cookbook. As you can see, I'm using chef-zero as well.
In order to download all cookbook dependencies, I'm using berkshelf tool. So I've created a Berksfile:
source 'https://supermarket.chef.io'
metadata
and metadata.rb:
name 'olingo' <<<2>>>
maintainer 'The Authors'
maintainer_email 'you#example.com'
license 'all_rights'
description 'Installs/Configures webapi'
long_description 'Installs/Configures webapi'
version '0.1.0'
depends 'java_se', '~> 8.141.0'
depends 'wildfly', '~> 0.4.0'
So, then I perform berks vendor and a berks-cookbooks folder is created filled with all olingo dependencies, but no olingo cookbook is located there.
So, it seems olingo cookbook is not available when chef_client tries to install olingo cookbook.
Any ideas?

Unable to run unicorn app server on a vagrant box

I have a vagrant box on which RVM is already installed with ruby 2.0.0-p247. I have packaged the vagrant box and using that box as a base box.
Now I am trying to git clone a github private repo and start the unicorn app server, chef is errors out,here is the output of the error
==> default: stdin: is not a tty
==> default: /opt/chef/embedded/lib/ruby/site_ruby/1.9.1/rubygems/dependency.rb:247:in `to_specs': Could not find chef (>= 0) amongst [bundler-1.7.7, bundler-unload-1.0.2, executable-hooks-1.3.2, gem-wrappers-1.2.7, rubygems-bundler-1.4.4, rvm-1.11.3.9] (Gem::LoadError)
==> default: from /opt/chef/embedded/lib/ruby/site_ruby/1.9.1/rubygems/dependency.rb:256:in `to_spec'
==> default: from /opt/chef/embedded/lib/ruby/site_ruby/1.9.1/rubygems.rb:1231:in `gem'
==> default: from /usr/bin/chef-solo:22:in `<main>'
Chef never successfully completed! Any errors should be visible in the
output above. Please fix your recipes so that they properly complete.
I am not able to debug the issue. Its ubuntu 14.04 box. Kindly help me out
Use the vagrant-omnibus plugin to install Chef. This will give Chef its own isolated Ruby environment separate from your RVM setup.

Chef template file file not found

My vagrant failed when provisioning with template.
template "/var/.s3cfg" do
source "s3cfg.erb"
owner "root"
group "root"
mode "0644"
end
in that cookbook directory, file templates/default/s3cfg.erb exists.
But strangely it's work successfully on opswork amazon, so it might be vagrant, vagrant-cachier, vagrant-berkshelf, berkshelf, or chef error.
Any idea how to check?
My environment:
$: vagrant -v
Vagrant 1.6.5
$: vagrant plugin list
vagrant-berkshelf (3.0.1)
vagrant-cachier (0.9.0)
vagrant-login (1.0.1, system)
vagrant-omnibus (1.4.1)
vagrant-share (1.1.1, system)
$: chef -v
Chef Development Kit Version: 0.2.2
$: berks -v
3.1.5
vagrant box is ubuntu-precise 12.04
Apparently the cause is because chef default location of provisioning path located at /tmp/vagrant-chef. In the middle of the chef execution, somehow the /tmp/ folder cleaned. Hence the missing file.
By changing the location of chef.provisioning_path to other folder than /tmp/, it worked normally.

vagrant omnibus behind proxy

Ok, I'm trying to update chef-client with vagrant omnibus and proxyconf. I figured it would pull the proxy from the proxyconf, but it doesn't look that way. Here is my plugin list:
vagrant plugin list
vagrant-login (1.0.1, system)
vagrant-omnibus (1.4.1)
- Version Constraint: 1.4.1
vagrant-proxyconf (1.3.2)
- Version Constraint: 1.3.2
vagrant-share (1.1.0, system)
and my Vagrant file:
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
config.omnibus.chef_version = :latest
if Vagrant.has_plugin?("vagrant-proxyconf")
config.proxy.http = "my proxy"
config.proxy.https = "my proxy"
end
When i run it with vagrant up, the machine does not have an updated chef-client. I tried using the recipe[omnibus_updater] in my run list it still fails because another recipe is failing with a compile failure (because of the older version of chef-client, what a pain in the butt). Any ideas? Other than creating a new virtual box?
Update:
Running in debug mode doesn't show any errors using :latest. Updating to 11.12.8 gives the below error
vagrant-omnibus:
* '11.12.8' is not a valid version of Chef.
Logging into the vm shows $HTTP_PROXY and $HTTPS_PROXY set properly. Running the commands on the built vm works:
chef-client -v
Chef: 10.14.2
sudo gem update chef
chef-client -v
Chef: 11.12.8
Thing 1:
:latest does not error out when it fails to grab the artifact. Switching to a named version starts to fail to find the artifact which leads me to believe that it isn't getting through the proxy.
Thing 2:
I think this is a problem with omnibus in windows. I've found this pull that may fix it? https://github.com/schisamo/vagrant-omnibus/pull/89. I think this plug-in isn't using the settings set by poxy-conf.
CURRENTLY USING THIS WORKAROUND:
Set you http proxy in the windows cmd line
SET HTTP_PROXY=http://username:password#proxy:port

Vagrant with librarian-chef installing ruby via ruby_build & rbenv

over the last few weeks i have had to reinstall my whole working environment a few times and it can take a while so now i have an ambitious idea to use vagrant and librarian-chef to create my working environment so that all i have to do is run a bash script and viola i am in.
so the first time i did this was solo vagrant i went in and did everything and packaged it and it was great for only a while.. the package was 600mb so next idea was to have chef do it all. but i have never worked with chef before so i found librarian-chef basically i librarian-chef init and it makes a cheffile that you can specify cookbooks mine looks like this
site 'http://community.opscode.com/api/v1'
cookbook 'apt'
cookbook 'git'
cookbook 'build-essential'
cookbook 'ruby_build',
git: 'git://github.com/fnichol/chef-ruby_build'
cookbook 'rbenv',
git: 'git://github.com/fnichol/chef-rbenv'
cookbook 'sqlite',
git: 'git://github.com/opscode-cookbooks/sqlite.git'
cookbook 'nodejs',
git: 'http://github.com/mdxp/nodejs-cookbook'
cookbook 'mysql',
git: 'git://github.com/opscode-cookbooks/mysql.git'
cookbook 'redis',
git: 'git://github.com/brianbianco/redisio.git'
cookbook 'zlib',
git: 'git://github.com/opscode-cookbooks/zlib'
cookbook 'wkhtmltopdf',
git: 'git://github.com/firstbanco/chef-wkhtmltopdf.git'
and you tell vagrant and chef to build these when you call vagrent up
in the vagrantfile
config.vm.provision :chef_solo do |chef|
chef.cookbooks_path = ["cookbooks","site-cookbooks"]
chef.add_recipe "apt"
chef.add_recipe "build-essential"
chef.add_recipe "git"
chef.add_recipe "ruby_build"
chef.add_recipe "rbenv::install"
chef.add_recipe "sqlite"
chef.add_recipe "nodejs"
chef.add_recipe "mysql"
chef.add_recipe "redis"
chef.add_recipe "zlib"
chef.add_recipe "wkhtmltopdf"
end
now i was wondering if i could get ruby_build to install 1.9.3-p290 i found this question which seemed to have the answer but i am getting the following
Running chef-solo...
stdin: is not a tty
[2013-05-23T14:31:18+00:00] INFO: *** Chef 10.14.2 ***
[2013-05-23T14:31:18+00:00] INFO: Setting the run_list to ["recipe[apt]", "recipe[build-essential]", "recipe[git]", "recipe[ruby_build]", "recipe[rbenv::install]", "recipe[sqlite]", "recipe[nodejs]", "recipe[mysql]", "recipe[redis]", "recipe[zlib]", "recipe[wkhtmltopdf]"] from JSON
[2013-05-23T14:31:18+00:00] INFO: Run List is [recipe[apt], recipe[build-essential], recipe[git], recipe[ruby_build], recipe[rbenv::install], recipe[sqlite], recipe[nodejs], recipe[mysql], recipe[redis], recipe[zlib], recipe[wkhtmltopdf]]
[2013-05-23T14:31:18+00:00] INFO: Run List expands to [apt, build-essential, git, ruby_build, rbenv::install, sqlite, nodejs, mysql, redis, zlib, wkhtmltopdf]
[2013-05-23T14:31:18+00:00] INFO: Starting Chef Run for precise64
[2013-05-23T14:31:18+00:00] INFO: Running start handlers
[2013-05-23T14:31:18+00:00] INFO: Start handlers complete.
================================================================================
Recipe Compile Error
================================================================================
Chef::Exceptions::RecipeNotFound
--------------------------------
could not find recipe ruby_build for cookbook rbenv
[2013-05-23T14:31:19+00:00] ERROR: Running exception handlers
[2013-05-23T14:31:19+00:00] ERROR: Exception handlers complete
[2013-05-23T14:31:19+00:00] FATAL: Stacktrace dumped to /tmp/vagrant-chef-1/chef-stacktrace.out
[2013-05-23T14:31:19+00:00] FATAL: Chef::Exceptions::RecipeNotFound: could not find recipe ruby_build for cookbook rbenv
Chef never successfully completed! Any errors should be visible in the
output above. Please fix your recipes so that they properly complete.
how can i get ruby installed as well through ruby build is it possible or is this not possible
Librarian will install your cookbooks locally, but they aren't transferred to the remote vagrant box. You'll need to use the Vagrant Librarian Chef plugin.
See also:
Berkshelf
Vagrant Berkshelf
try adding ruby_build to the run list:
"run_list": [ "ruby_build", "recipe[main]" ]

Resources