Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/tongueroo/baker

Simple way to run chef recipes
https://github.com/tongueroo/baker

Last synced: about 1 month ago
JSON representation

Simple way to run chef recipes

Awesome Lists containing this project

README

        

Baker
=======

A simple way to run chef recipes on one server.

Install
-------


gem install baker --source http://gemcutter.org --no-ri --no-rdoc # sudo if you need to

Usage
-------

I. setup ssh key

Set up your ssh key on the server so you can login into the box without a password. The gem only supports logging in via a .ssh/config shortcut. Your .ssh/config should look something like this:


Host server_name
Hostname xxx.xxx.xxx.xxx
Port 22
User root

II. install chef on the server

Can install chef on the server by using baker.


$ bake --setup server_name

III. run chef recipes

Create a cookbooks project. Here's an example of a cookbooks project that can be used to install rails: https://github.com/tongueroo/cookbooks-rails

The cookbooks project structure looks like the following:


├── config
│ ├── node.json
│ └── solo.rb
└── cookbooks
├── example_recipe1
│ └── recipes
│ └── default.rb
└── example_recipe2
└── recipes
└── default.rb

config/node.json and config/solo.rb are important. These are the configurations that get passed to the chef run that will tell it which recipes to run.

config/solo.rb looks like this:


file_cache_path "/tmp/baker"
cookbook_path "/tmp/baker/recipes/cookbooks"

config/node.json looks like this:


{
"ec2": true,
"environment": {"name":"production"},
"mysql_root_password":"whatever",
"packages":[
{"name": "git-core"},
{"name": "curl"}
],
"gems":[
{"name": "rails", "version": "3.0.3"},
{"name": "bundler"}
],
"recipes":[
"example_recipe1",
"example_recipe2"
]
}

To actually run the chef recipes, cd into the cookbooks project folder and run this command:


$ bake server_name

After running chef you should check the /var/log/baker.chef.log on the server itself for possible errors.