Thư viện tri thức trực tuyến
Kho tài liệu với 50,000+ tài liệu học thuật
© 2023 Siêu thị PDF - Kho tài liệu học thuật hàng đầu Việt Nam

test driven infrastructure with chef
Nội dung xem thử
Mô tả chi tiết
www.it-ebooks.info
www.it-ebooks.info
Test-Driven Infrastructure with Chef
www.it-ebooks.info
www.it-ebooks.info
Test-Driven Infrastructure
with Chef
Stephen Nelson-Smith
Beijing Cambridge Farnham Köln Sebastopol Tokyo
www.it-ebooks.info
Test-Driven Infrastructure with Chef
by Stephen Nelson-Smith
Copyright © 2011 Atalanta Systems LTD. All rights reserved.
Printed in the United States of America.
Published by O’Reilly Media, Inc., 1005 Gravenstein Highway North, Sebastopol, CA 95472.
O’Reilly books may be purchased for educational, business, or sales promotional use. Online editions
are also available for most titles (http://my.safaribooksonline.com). For more information, contact our
corporate/institutional sales department: (800) 998-9938 or [email protected].
Editors: Mike Loukides and Meghan Blanchette
Production Editor: Kristen Borg
Proofreader: O’Reilly Production Services
Cover Designer: Karen Montgomery
Interior Designer: David Futato
Printing History:
June 2011: First Edition.
Nutshell Handbook, the Nutshell Handbook logo, and the O’Reilly logo are registered trademarks of
O’Reilly Media, Inc. Test-Driven Infrastructure with Chef, the image of edible-nest swiftlets, and related
trade dress are trademarks of O’Reilly Media, Inc.
Many of the designations used by manufacturers and sellers to distinguish their products are claimed as
trademarks. Where those designations appear in this book, and O’Reilly Media, Inc., was aware of a
trademark claim, the designations have been printed in caps or initial caps.
While every precaution has been taken in the preparation of this book, the publisher and author assume
no responsibility for errors or omissions, or for damages resulting from the use of the information contained herein.
ISBN: 978-1-449-30481-2
[LSI]
1307648888
www.it-ebooks.info
Table of Contents
Preface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . vii
1. Infrastructure As Code . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
The Origins of Infrastructure as Code 2
The Principles of Infrastructure as Code 4
The Risks of Infrastructure as Code 5
2. Introduction to Chef . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
The Chef Framework 9
The Chef Tool 10
The Chef API 11
The Chef Community 11
3. Getting Started with Chef . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
Installing Ruby 14
Getting Set Up on the Opscode Platform 16
Installing Chef 18
Using Chef to Write Infrastructure Code 19
4. Behavior-Driven Development (BDD) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
A Very Brief History of Agile Software Development 23
Test-Driven Development 24
Behavior-Driven Development 25
Building the Right Thing 26
Reducing Risk 26
Evolving Design 26
Cucumber 27
5. Introduction to Cucumber-Chef . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
Prerequisites 31
Sign up for Amazon Web Services 31
v
www.it-ebooks.info
Installation 35
6. Cucumber-Chef: A Worked Example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39
Introducing the Bram Consulting Group (BCG) 40
Gathering Requirements 40
Writing Acceptance Tests 43
Creating a Project with Cucumber-Chef 45
Making Tests Pass 47
Cooking with Chef 50
Resources 50
Recipes 51
Cookbooks 52
Roles 52
Running Chef 53
On With the Show 55
Databags 58
Making It Live 65
Environments 66
7. Next Steps . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 69
Managing Risk 71
Continuous Integration and Deployment 71
Monitoring 72
Conclusion 73
Further Reading 73
vi | Table of Contents
www.it-ebooks.info