I have read the Chef docs and understand what cookbooks, recipes, and run_lists are, but still find it hard to decide how to organize a project into cookbook(s), recipe(s), and run_list
s.
What are the conceptual differences between these and in what cases would I ever use something other than 1 cookbook with 1 recipe? (Most the examples/tutorials I have found online only have 1 cookbook with 1 recipe)
Example
I am trying to make a Chef project to get a webapp up and running. Specifically, I want to:
- install JDK 1.8, Tomcat 7, and Postgres 9.3
- start up Postgres with a specific data directory
- configure Postgres (create a database, create a superuser, etc...)
- put a
context.xml
file into Tomcat - start up Tomcat
Should these all go into one cookbook?
Should each of these steps correspond to a separate recipe?
If they all go into 1 recipe, then why are run_list
s useful?
Disclaimer: I am mostly looking into using Chef with knife-solo
, so my confusion might be due to the documentation describing a typical deployment (eg. master with many nodes) when all I care about is running my cookbooks on a specific machine.