Book Image

Chef Essentials

By : John Ewart
Book Image

Chef Essentials

By: John Ewart

Overview of this book

<p>Chef is a configuration management tool that turns IT infrastructure into code. Chef provides tools to manage systems at scale. With this book, you will learn how to use the same tools that companies such as Facebook, Riot Games, and Ancestry.com use to manage and scale their infrastructure.</p> <p>This book takes you on a comprehensive tour of Chef's functionality, ranging from its core features to advanced development. You will be brought up to speed with what's new in Chef and how to set up your own Chef infrastructure for individuals, or small or large teams. Once you have the core components, you will get to grips with bootstrapping hosts to then develop and apply cookbooks. If you want to fully leverage Chef, this book will show you advanced recipes to help you handle new types of data providers and resources. By the end of this book, you will be confident in how to manage your infrastructure, scale using the cloud, and extend the built-in functionality of Chef itself.</p>
Table of Contents (15 chapters)
Chef Essentials
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Configuring the web server


In order for the web server to deploy the web app, we need to add the required roles to the web server, as we did with the database server:

knife node run_list add web00 "role[base_server]"
knife node run_list add web00 "role[web_server]"

Now, we can execute chef-client on the web host (again making sure to use sudo so that it has permission to do its work):

[jewart]% knife ssh 'name:web00' -x ubuntu 'sudo chef-client'

At this point, our web server will be in the following state:

  • The following required packages will be installed:

    • Python 2.7 and development libraries

    • The PostgreSQL client development libraries

    • Git

  • The directories our application needs to run are created

  • A virtualenv tool, which is based on the system Python 2.7 is created

  • Our application has been checked out from GitHub

  • A configuration file in /opt/webapp/src/config.py is created by Chef

  • Supervisord is configured to run our application and starts the server.py daemon

Now, you should be able to visit your...