Local development with Chef Solo


Chef Infra automates infrastructure configuration, ensuring every system is configured correctly and consistently.

Chef Solo is a command that executes Chef Infra Client in a way that does not require the Chef Infra Server in order to converge cookbooks

I use a single Chef configuration to manage both my local development environment via Vagrant as well as a production environment within a Debian instance on Linode.

This setup ensures that both my development and production environments are pretty close to identical, minimizing issues when deploying to live sites. It also means that I can test installs of software on a local VM, using chef recipes to configure it as needed. Once I'm happy with the setup it's just a matter of committing the configuration, logging into the production server and after pulling the changes, running chef solo which will replicate the install and configuration in the production environment.

Another benefit of this setup is that because the configuration is in in version controlled code, local or even production environments can be recreated with minimal fuss. Vagrant machines can be removed and recreated in minutes with confidence. New Linode instances can be provisioned without having to spend hours manually installing software and configuring them.

Local development with Vagrant

The vagrant config sets up a guest debian instance, it syncs a folder called 'srv' on the host to '/srv' in the guest OS which is where any code is accesed.

I use Nginx as the web server and this repo comes with a tiny CLI called ngx which helps with the creation and editing of virtual hosts and managing Nginx itself.

In order to access sites running on the Debian guest, first vagrant is configured to open a port to the host system, in my case