Home Page Icon
Home Page
Table of Contents for
II. Working With Infrastructure Stacks
Close
II. Working With Infrastructure Stacks
by Kief Morris
Infrastructure as Code, 2nd Edition
Preface
How I Learned to Stop Worrying and to Love the Cloud
The Sorcerer’s Apprentice
Cloud from Scratch
Legacy cloud infrastructure
Why I Wrote This Book
Why A Second Edition
Who This Book Is For
What Tools Are Covered
Principles, Practices, and Patterns
The FoodSpin examples
Conventions Used in This Book
O’Reilly Online Learning
How to Contact Us
I. Foundations
1. What is Infrastructure as Code?
From the Iron Age to the Cloud Age
Infrastructure as Code
Benefits of Infrastructure as Code
Use Infrastructure as Code to optimize for change
Objection: “We don’t make changes often enough to justify automating them”
Objection: “We should build first and automate later”
Objection: “We must choose between speed and quality”
Three core practices for Infrastructure as Code
Core practice: Define everything as code
Core practice: Continuously validate all your work in progress
Core practice: Build small, simple pieces that you can change independently
The parts of an infrastructure system
Conclusion
2. Principles of Cloud Age Infrastructure
Principle: Assume systems are unreliable
Principle: Make everything reproducible
Pitfall: Snowflake systems
Principle: Create disposable things
Principle: Minimize variation
Configuration Drift
Principle: Ensure that you can repeat any process
Conclusion
3. Infrastructure Platforms
What is a dynamic infrastructure platform?
Infrastructure Resources
Compute Resources
Virtual machines
Physical servers
Containers
Server clusters
Serverless code execution (FaaS)
Storage Resources
Block storage (virtual disk volumes)
Object storage
Networked filesystems (shared network volumes)
Structured data storage
Secrets management
Network Resources
Network address blocks
Traffic management and routing
Network access rules
Caches
Service meshes
Conclusion
4. Core Practice: Define everything as code
Why you should define your infrastructure as code
What you can define as code
Choose tools that are configured with code
Manage your code in a version control system
Secrets and source code
Infrastructure coding languages
Scripting your infrastructure
Building infrastructure with declarative code
DSLs for infrastructure
The return of general-purpose languages for infrastructure
Implementation Principles for defining infrastructure as code
Implementation Principle: Avoid mixing different types of code
Implementation Principle: Separate infrastructure code concerns
Implementation Principle: Treat infrastructure code like real code
Conclusion
II. Working With Infrastructure Stacks
5. Building Infrastructure Stacks as Code
What is an infrastructure stack?
Stack code
Stack instance
Configuring servers in a stack
Patterns and antipatterns for structuring stacks
Antipattern: Monolithic Stack
Pattern: Application Group Stack
Pattern: Service Stack
Pattern: Micro Stack
Conclusion
6. Using Modules to Share Stack Code
Examples of using modules
Patterns and antipatterns for infrastructure modules
Pattern: Facade Module
Antipattern: Anemic Module
Pattern: Domain Entity Module
Antipattern: Spaghetti Module
Antipattern: Obfuscation Layer
Antipattern: One-shot Module
Conclusion
7. Building Environments With Stacks
What environments are all about
Release delivery environments
Multiple production environments
Environments, consistency, and configuration
Patterns for building environments
Antipattern: Multiple-Environment Stack
Antipattern: Copy-Paste Environments
Pattern: Reusable Stack
Building environments with multiple stacks
Conclusion
8. Configuring Stacks
Using stack parameters to create unique identifiers
Example stack parameters
Handling secrets as parameters
Patterns for configuring stacks
Antipattern: Manual Stack Parameters
Pattern: Stack Environment Variables
Pattern: Scripted Parameters
Pattern: Stack Configuration Files
Pattern: Wrapper Stack
Pattern: Pipeline Stack Parameters
Pattern: Stack Parameter Registry
Configuration Registry
Implementing a Configuration Registry
Single or multiple configuration registries
Configuration Management Database (CMDB)
Conclusion
9. Core Practice: Continuously validate all work in progress
Why continuously validate infrastructure code?
What continuous validation means
What should we validate with infrastructure?
Challenges with testing infrastructure code
Challenge: Tests for declarative code often have low value
Challenge: Testing infrastructure code is slow
Progressive validation
Validation stages
Testing in production
Progressive validation models
Test pyramid
Swiss cheese testing model
Pipelines for validation
Pipeline stages
Delivery pipeline software and services
Conclusion
10. Testing Infrastructure Stacks
Example infrastructure
The example stack
Pipeline for the example stack
Offline validation stages for stacks
Syntax checking
Offline static code analysis
Static code analysis with API
Testing with mock API
Online validation stages for stacks
Preview: Seeing what changes will be made
Verification: Making assertions about infrastructure resources
Outcomes: Proving infrastructure works correctly
Using test fixtures to handle dependencies
Test doubles for upstream dependencies
Test fixtures for downstream dependencies
Lifecycle patterns for test instances of stacks
Pattern: Persistent test stack
Pattern: Ephemeral test stack
Antipattern: Dual Persistent and Ephemeral Stack Stages
Pattern: Periodic stack rebuild
Pattern: Continuous stack reset
Test orchestration
Support local testing
Avoid tight coupling with pipeline tools
Test orchestration tools
Conclusion
Search in book...
Toggle Font Controls
Playlists
Add To
Create new playlist
Name your new playlist
Playlist description (optional)
Cancel
Create playlist
Sign In
Email address
Password
Forgot Password?
Create account
Login
or
Continue with Facebook
Continue with Google
Sign Up
Full Name
Email address
Confirm Email Address
Password
Login
Create account
or
Continue with Facebook
Continue with Google
Prev
Previous Chapter
4. Core Practice: Define everything as code
Next
Next Chapter
5. Building Infrastructure Stacks as Code
Part II.
Working With Infrastructure Stacks
Add Highlight
No Comment
..................Content has been hidden....................
You can't read the all page of ebook, please click
here
login for view all page.
Day Mode
Cloud Mode
Night Mode
Reset