October 20, 2016 | Ankit Battawar
7Organizations are adopting DevOps as a means to get more done, plain and simple. According to the Puppet Labs State of DevOps Report, organizations are deploying code 30 times faster and with 50% less failure of those deployments. DevOps brings technical benefits (Continuous software delivery, Less complex problems to fix, and Faster resolution of problems) and also business benefits (Faster delivery of features, More stable operating environments, and More time available to add value). In order to completely realize these benefits, organizations need to follow a set of Chef Best Practices.
Chef Best Practices
Configurations Management, using tools such as Chef, is an important part of DevOps, and needs to be done right to reap the full benefits of DevOps. In this post, we will look at some of the Chef Best Practices to follow when it comes to deploying 3-Tier Applications.
- Start by keeping the Web, App and Database (DB) VPC different. This allows for reduced single point of failures and makes configurations easier.
- Use the same configuration management code for different environments such as Dev, Test, QA, Staging, and Prod.
- Use Immutable Infrastructure to reduce downtime and improve ease of upgradability. Infrastructure as code is a must.
- Do not pre-bake the binaries with configuration values, but dynamically set them during deployment.
- Keep the cookbooks separate and create readymades, with default values over the cookbooks for each environment.
- Server configuration validation, using tools such as ServerSpec, are a must to validate the environment and configurations created by Chef and other automation tools.
Some other Chef Best Practices and guidelines to follow are as below:
Maintaining Consistency: All instances should run the current approved version of code from a single truth source repository.
Use Common Archive: Deploy your apps and cookbooks from a common archive to ensure that all your instances have the approved code version deployed, thus guaranteeing the code is a static artifact.
Automate the Deployment Process: Create an automated deployment pipeline using tools such as Jenkins.
Deploying Code to Production: Deploy the update to every instance concurrently by executing a default “Deploy” command (for Apps) or “Update Custom Cookbooks” command (For Cookbooks).
Use a Rolling Deployment: Update an application in multiple phases.
Development Stacks: Use a development stack for tasks such as implementing new features or fixing bugs. A development stack is essentially a prototype production stack, with the same layers, apps, resources, and so on that are included on your production stack.
Production Stack: The production stack is the public-facing stack that supports your current application.
Use a Blue-Green Deployment Strategy: A blue-green deployment strategy is one common way to efficiently use separate stacks to deploy an application update to production. The blue environment is the production stack, which hosts the current application. The green environment is the staging stack, which hosts the updated application. Switch user traffic from the blue stack to the green stack when you are ready to deploy the updated application to production.
In our future blog posts we will drill down more on each of these Chef best practices and see how we can get the maximum benefits from DevOps. You can view one of our previous posts to learn more about the benefits of DevOps. If you have any questions or comments regarding DevOps and Chef Best Practices feel free to leave us a message at firstname.lastname@example.org and one of our experts will get back to you. Also visit us at www.reancloud.com/devsecops, to learn more.