I started learning Chef, Berkshelf and Vagrant. I managed to deploy a simple application with Chef Server, but when i`m trying to use Chef Solo i am getting some errors:
Connection refused - Connection refused connecting to localhost:4000 for /search/node, giving up Or could not use client.pem
Basically it lacks the encrypted data bags and search functionality. Is there a way to simulate this features?
I want to use Chef Solo for testing, because whenever i use Berkshelf with vagrant provision it will reupload all my cookbooks and it takes about 1-2 minutes every time.
Chef-solo has some limited functionality versus Chef. If Chef-solo doesn't fit your needs, you can easily switch over to Hosted Chef (or similar) and use it along with your Vagrant setup.
To answer your question...from checking the docs it seems that:
chef-solo can load data from a data bag as long as the contents of that data bag are accessible from a directory structure that exists on the same machine as chef-solo. The location of this directory is configurable using the data_bag_path option in the solo.rb file. The name of each sub-directory corresponds to a data bag and each JSON file within a sub-directory corresponds to a data bag item. Search is not available in recipes when they are run with chef-solo; use the data_bag() and data_bag_item() functions to access data bags and data bag items.
If you want to add the search capability, the same docs suggest to:
Use the chef-solo-search cookbook library (developed by Opscode community member “edelight” and available from github) to add data bag search capabilities to a chef-solo environment:
Lastly, your comment:
I want to use Chef Solo for testing, because whenever i use Berkshelf with vagrant provision it will reupload all my cookbooks and it takes about 1-2 minutes every time.
is not quite valid (if I understand it correctly). Whether you use Hosted Chef, Open Source Chef, or Chef-solo, the uploading of cookbooks is barely affected. In the case that you are always adding a completely new set of cookbooks, it may take a bit longer to upload, but normally one just makes some slight changes to a few cookbooks and uploads a new revision. When you provision, only updated cookbooks are downloaded to the machine, and everything is run from local versions when the provision takes place. The time for this entire process shouldn't be much longer than what you are experiencing with Chef-solo.
There are other reasons to use Chef-solo, besides what you mentioned. Take a look at what your needs are and decide what is best for you.