I'm looking into chef to automate Magento deployments — both into standard Magento hosting options as well as environments like EC2. I've googled around and I see numerous recipes, but none really strikes me as a canonical one. Is there's a particular chef script that's better/the best? Also, if you've done chef deployments with PHP before, what's one thing you wish you'd know when you were starting out?
It’s nearly impossible to have a one-size-fits-all set of routines. I’ve had success writing a Bash script that executes
Open source Chef Server 10.18.2 on Ubuntu 12.04 LTS
This is how I've approached this area while wearing the wanna be sysadmin/devops role. Most the following will be just general principles I try to follow and not Chef specific.
I ended up going with Puppet because I found there to be more resources at the time and felt easier to pick up for me.
I looked at the various pre-built modules available for things like apache, php5, etc. Many of them seemed to do way more than I needed and being so unfamiliar with the platform I didn't trust what was going on. I decided it was going to be simpler for me to just identify what I needed done on each node type.
I started the process by provisioning the team's local development environment (vargrant + virtual box). For each service/component I created a module: php5, apache2, redis, mysql, etc.
Once the dev environment was stable/working I began building out the QA environment. I defined generic node types for web servers, redis, varnish, etc. which reused the same modules as dev. Once this was done Staging and Production needed minimal changes were needed to get up and running.
As you're going through and writing your recipes/templates you should consider how if could be reused/generalized. Don't hard code things like paths or user/groups that could change between distros/projects/environments. Since you're looking at a generalized approach I would guess a large hurdle will be dealing with differences between *nix distributions.
Most importantly, keep is simple. Automate/standardize the most important/time consuming parts of the environment. Iterate, evolve.