Background
Our company recently decided to finally automate our deployment processes using Chef and I have been tasked to implement this. Being more of a developer, I am currently struggeling with the best approach on how to organize and structure the approach and cookbooks in a way that I can also use them in our development environments with Vagrant.
We have ~ 10 applications that we need to deploy to several environments (development, staging, acceptance, production, demo). Each application is running on the same basic tech stack and platform. Some of these applications are actually subservices of other applications.
After reading several tutorials, learn-chef as well as watching endless videos, I have started to create several cookbooks using berkshelf (each cookbook is in it's own GIT repo):
- 1 x cookbook to setup the basic infrastructure (setup admin user, install basic system tools, sudo, sshd, etc)
- 1 x cookbook to setup the platform (in our case: LAMP with a fixed PHP version)
- 10 x cookbook to setup each application
Question/s
Is this the correct approach to organize cookbooks? None of these cookbooks depend on each other (for now), even though the application cookbook require the infrastructure and platform cookbooks to be run first in order to setup the basic system. Each application has the same tech stack requirement for now - so seems kind of weird to add the same dependancies into each application cookbook. Should the exact dependancies of the applications (for packages that are installed via the platform cookbook, e.g. apt) still be explictly mentioned? How is this all then tied together to deploy it to the target machines? Do I need another "container" cookbook (single chef-repo for all machines and cookbooks?) which holds the specific applications together? Do I need roles to make this work?