Bare minimal Chef provisioning and deployment

chefchef-soloknife

I've read the documentation on Chef twice over. I still can't wrap my head around it's concept because they skip but fundamentals and jump to complex deployments with chef-server.

Using chef-solo and possibly knife, is there a simple way to provision a server and deploy?

I may be wrong, but it seems like with my cookbooks prepped, this should be very simple.

knife rackspace server create --flavor 1 --image 112

That provisions my server. I can optionally pass –run-list "recipe[mything]", but how do my cookbooks in ~/my_cookbooks actually get on the server? Do I have to manually transfer them? That seems counterproductive.

Best Answer

If you use chef-solo, you don't get to use knife. Knife is API client for the chef-server, with some extra utility sugar (like knife rackspace server create you've mentioned).

To configure server with chef-solo, you should copy your chef repo to the server, and run chef-solo there over ssh. There is no ready-made script or knife plugin that I know of that would do it automatically.

Command knife rackspace server create creates new Rackspace server, and then initializes it for chef-server that knife knows of by calling knife bootstrap. It won't work with chef-solo easily.

Technically, knife bootstrap, and thus knife rackspace server create, can be coerced to work with chef-solo by writing a custom bootstrap template that, instead of initializing chef-client, would download your chef repository and run chef-solo - see knife bootstrap --help, its wiki page, or source for details. You can see example templates for installing chef-client here. This is an advanced feature, though, and it's not very well documented.

If you don't want to handle complexity of installing and managing your own chef-server, you can use free layer of Opscode's Hosted Chef, which is Chef-server SAAS offering and is free up to three nodes. I'd recommend starting any serious work with server anyway - chef-solo is as good as a decent bootstrap shell script, no more, and you're missing out on many important/interesting features like search and data bags, which allow you to configure your servers in a data-driven way.

Related Topic