README.markdown in soloist-0.9.7 vs README.markdown in soloist-1.0.0.pre

- old
+ new

@@ -1,122 +1,116 @@ +# Soloist + [![Build Status](https://secure.travis-ci.org/mkocher/soloist.png)](http://travis-ci.org/mkocher/soloist) -Soloist: Making chef-solo easier -================================ +Soloist lets you quickly and easily converge [Chef](http://opscode.com/chef) recipes using [chef-solo](http://wiki.opscode.com/display/chef/Chef+Solo). It does not require a Chef server, but can exploit [community cookbooks](http://community.opscode.com/cookbooks), github-hosted cookbooks and locally-sourced cookbooks through [Librarian](https://github.com/applicationsonline/librarian). -# Why? -You just want to use chef solo, not worry about where your config files are, or what they should look like (too much). You might think that json is a data serialization format and not a config file format. You might think that having two config files that you have to pass to an executable every time you run it is two too many. +Soloist was originally built to support the [Pivotal Labs Workstation Cookbook](https://github.com/pivotal/pivotal_workstation). -# How? -Soloist is a script packaged as a gem which when run recurses up the file tree looking for a soloistrc file. When it finds it, it uses it to determine 1) Where its cookbooks are and 2) What recipes to run. It generates the necessary config files for chef solo, and kicks it off. -# That's exactly what I've always wanted! How do I use it? -* (sudo) gem install soloist -* create a directory to store your cookbooks in, and get a cookbook: - sh -c 'mkdir -p chef/cookbooks/pivotal_workstation && cd chef/cookbooks/pivotal_workstation && curl -L http://github.com/pivotal/pivotal_workstation/tarball/master | gunzip | tar xvf - --strip=1' -* create your soloistrc file in the root of your project. +Using Soloist +------------- -# What if I'm just setting up my own machine, and have many projects? -Just put your soloistrc file in your home directory, and point it to wherever you want to keep your cookbooks. Or just dedicate a git repo to it, and go into that directory before running soloist. +Let's say you want to converge the Pivotal Labs Workstation default recipe and install Sublime Text 2. -# How do I write a soloistrc file? -It's a yaml file, currently with two lists to maintain: +1. You'll need to have Soloist installed: -The first, _cookbook\_paths_, should point (using an absolute or path relative to your soloistrc file) to the directory containing your cookbooks, such was pivotal_workstation. + $ gem install soloist -The second, _recipes_ should be a list of recipes you wish to run. +1. You'll need a `Cheffile` in your home directory that points Librarian to all the cookbooks you've included: -# Then What? -$> soloist + $ cat /Users/pivotal/Cheffile + site "http://community.opscode.com/api/v1" + cookbook "pivotal_workstation", + :git => "https://github.com/pivotal/pivotal_workstation" +1. You'll need to create a `soloistrc` file in your home directory to tell Chef which recipes to converge: -Example soloistrc Files -======================= + $ cat /Users/pivotal/soloistrc + recipes: + - pivotal_workstation::default + - pivotal_workstation::sublime_text -directory layout: +1. You'll need to run `soloist` for anything to happen: - /Users/mkocher/workspace/project/soloistrc <-Config File - /Users/mkocher/workspace/project/cookbooks/pivotal_workstation/ + $ soloist -soloistrc ---------- - cookbook_paths: - - ./cookbooks/ - recipes: - - pivotal_workstation::ack - - pivotal_workstation::bash_path_order - - pivotal_workstation::bash_profile-better_history - - pivotal_workstation::defaults_fast_key_repeat_rate - - pivotal_workstation::finder_display_full_path - - pivotal_workstation::git_config_global_defaults - - pivotal_workstation::git_scripts - - pivotal_workstation::google_chrome - - pivotal_workstation::inputrc - - pivotal_workstation::rvm - - pivotal_workstation::turn_on_ssh +Examples +-------- -Packaging Gems as Cookbooks (alpha) -=========================== +##### Running a set of recipes -If you're a ruby developer, you're probably very comfortable wrangling gems. Bundler makes it easy to lock your dependencies and keep them in sync in all your environments. Soloist adds the ability to load cookbooks out of these gems. This means you can install the pivotal_workstation_cookbook gem, and add it to your soloistrc like so: +Here's an example of a `soloistrc`: - cookbook_gems: - - pivotal_workstation_cookbook + cookbook_paths: + - /opt/beans + recipes: + - beans::chili + - beans::food_fight + - napkins -Easy cookbook dependency tracking, no more git cloning, no more chef recipes that aren't yours checked into your project and easy forking with bundler and github. +This tells Soloist to search in both `/opt/beans` and `./cookbooks` (relative to the `soloistrc`) for cookbooks to run. Then, it attempts to converge the `beans::chili`, `beans::food_fight` and `napkins` recipes. -Environment Variable Switching -============================== -The soloistrc file allows for selecting all options based on environment variables. Cap should allow setting environment variables fairly easily on deploy, and they can be set permanently on the machine if desired. To use these, add a env_variable_switches key to your soloistrc. They keys of the hash should be the environment variable you wish to change the configuration based on, and the value should be a hash keyed by the value of the variable. It's easier than it sounds - see the example below. - cookbook_paths: - - ./chef/cookbooks/ - recipes: - - pivotal_workstation::ack - env_variable_switches: - RACK_ENV: - production: - cookbook_paths: - - ./chef/production_cookbooks/ - recipes: - - production::foo +##### Setting node attributes -The values are merged in, so this results in a cookbook path of - [ - "./chef/cookbooks/", - "./chef/production_cookbooks/" - ] -and a recipe list of - [ - "pivotal_workstation::ack", - "production::foo" - ] - -Log Level -========= -Soloist runs chef at log level info by default. Debug is very verbose, but makes debugging chef recipes much easier. Just set the LOG_LEVEL environment variable to 'debug' (or other valid chef log level) and it will be passed through. +Soloist lets you override node attributes. Let's say we've got a `bash::prompt` recipe for which we want to set `node['bash']['prompt']['color']='p!nk'`. No problem! -Local Overrides -============================== -Soloist is an easy way to share configuration across workstations. If you want to have configuration in chef that you don't want to share with the rest of the project, you can create a soloistrc_local file in addition to the soloistrc file. This file will be processed after the soloistrc, and everything in it will be added to the run list. Be careful that you are clear what goes where - if it's a dependency of the project, it should be checked into the soloistrc file in the project. + recipes: + - bash::prompt + node_attributes: + bash: + prompt: + color: p!nk -Setting Node Attributes -======================= -You can set node attributes in your soloistrc file that will be included in the JSON attributes file passed to chef-solo. +##### Conditionally modifying Soloist + +Soloist allows conditionally switching on environment variables. Let's say we only want to include the `embarrassment::parental` recipe when the `MEGA_PRODUCTION` environment variable is set to `juggalos`. Here's the `soloistrc`: + cookbook_paths: - - ./chef/cookbooks/ + - /fresno recipes: - - pivotal_workstation::github_ssh_keys - - pivotal_workstation::rvm - node_attributes: - github_username: john.smith - github_password: pas$w0rd - rvm: - rubies: - ruby-1.8.7-p299: {} - jruby-1.6.6: {} + - disaster + env_variable_switches: + MEGA_PRODUCTION: + juggalos: + recipes: + - embarrassment::parental +So now, this is the result of our Soloist run: + + $ MEGA_PRODUCTION=juggalos soloist + Installing disaster (1.0.0) + Installing embarrassment (1.0.0) + … chef output … + INFO: Run List expands to [disaster, embarrassment::parental, faygo] + … chef output … + +If we set `MEGA_PRODUCTION=godspeed`, the `embarrassment::parental` recipe is not converged. + + +##### Running one-off recipes + +Soloist can also run one-off recipes: + + $ soloist DO_IT_LIVE lice::box + Installing lice (1.0.0) + … chef output … + INFO: Run List expands to [lice::box] + … chef output … + +This just runs the `lice::box` recipe from your current set of cookbooks. It still uses all the `node_attributes` and `env_variable_switches` logic. + + +##### Chef logging + +Soloist runs `chef-solo` at log level `info` by default, which is helpful when you need to see what your Chef run is doing. If you need more information, you can set the `LOG_LEVEL` environment variable: + + $ LOG_LEVEL=debug soloist + + License ======= -Soloist is MIT Licensed. See MIT-LICENSE for details. \ No newline at end of file + +See MIT-LICENSE for details.