Mais conteúdo relacionado Semelhante a Test-Driven Infrastructure with CloudFormation and Cucumber. (20) Test-Driven Infrastructure with CloudFormation and Cucumber. 1. Test-Driven Infrastructure w/ CloudFormation and Cucumber
Paul Duvall, Stelligent CTO
Author of Continuous Integration and
DevOps in the Cloud
Tuesday, July 24, 2012
Stelligent Monthly Cloud Delivery Webinar Series
COPYRIGHT © 2012 Stelligent Systems LLC
Unauthorized duplication is not permitted.
2. Introduction
Next August 28th: Scripted Deployment with Capistrano
Webinar http://stelligent.com/cap with Brian Jakovich
Powerpoint and other resources will be emailed to
Materials attendees and available in Linkedin group
Linkedin Continuous Delivery in the Cloud: http://linkd.in/Pfbf1h
Stelligent Cloud Delivery: Migration, Training and Operations
June Recording of last month’s webinar:
Webinar http://www.stelligent.com/aws-webinar/
COPYRIGHT © 2012 Stelligent Systems LLC
Unauthorized duplication is not permitted.
3. About Me
COPYRIGHT © 2012 Stelligent Systems LLC
Unauthorized duplication is not permitted.
5. Continuous Delivery
COPYRIGHT © 2012 Stelligent Systems LLC
Unauthorized duplication is not permitted.
6. COPYRIGHT © 2012 Stelligent Systems LLC
Unauthorized duplication is not permitted.
7. 5 Steps to Continuous Delivery
Document Document to automate
Test Write an automated test to verify behavior
Script Automate to a single command
Version Version all scripts
Continuous Run headless with every change
COPYRIGHT © 2012 Stelligent Systems LLC
Unauthorized duplication is not permitted.
8. Business Value of Test-Driven Infrastructure
• Learn of problems earlier by integrating CI with
infrastructure - Infrastructure changes integrated
with rest of software system
• Scripted Infrastructure becomes Documentation
• Remove Gatekeepers
• Isolate Destructive Changes
• Canonical System
• Quickly get back to earlier version of Infrastructure
• Infrastructure as Code: Apply rigorous practices
similar to writing application code
COPYRIGHT © 2012 Stelligent Systems LLC
Unauthorized duplication is not permitted.
9. Test-Driven Infrastructure within Delivery Pipeline
• Manually Configure and
Document Environment
• Write Acceptance Test
• Script the Environment
provisioning
• Version the infrastructure
automation (Checkin the
Script(s))
• Run as part of a Continuous
Process
• Make “pre-baked”
environments available to
team members and CD
system
COPYRIGHT © 2012 Stelligent Systems LLC
Unauthorized duplication is not permitted.
10. Sidebar: Continuous Integration Process
DBA
Polling
Develo Create Target
per Environments Environment
Instances
Version- CI Server Tests
Control
Repository Build Deploy
Operations
Tester
COPYRIGHT © 2012 Stelligent Systems LLC
Unauthorized duplication is not permitted.
11. Test-Driven Infrastructure: Success
Jenkins Environment Job
Environment Email
SSH
Deployment Email
Working App
COPYRIGHT © 2012 Stelligent Systems LLC
Unauthorized duplication is not permitted.
12. Test-Driven Infrastructure: Failure
• Notified soon after
infrastructure script is
committed to version-control
repository
• Since all infrastructure scripts
and config are versioned, can
simply revert to previous
known-good version
• Failure is identified, scripts are
changed and committed back to
version-control system
• Infrastructure changes are
integrated with rest of software
system
COPYRIGHT © 2012 Stelligent Systems LLC
Unauthorized duplication is not permitted.
13. Non-Automated Test Scenario
• Environment is manually created by
running through a series of steps to
install/configure OS, networking, servers,
etc.
• In some cases, these steps are
documented. Often, the documentation is
not regularly updated
• New environments – based on the “initial
environment” – are created by going
through similar manual steps
• No canonical state of environments –
each environment is unique
• Software is deployed to environments
(Dev, QA, Stage, etc.). Deployments fail.
Root cause is unclear.
• Troubleshooting and patch work ensue.
State remains dubious. Team members
apply superstition to root cause.
COPYRIGHT © 2012 Stelligent Systems LLC
Unauthorized duplication is not permitted.
15. Scripted Infrastructure (Code)
• Walkthrough of production.template CloudFormation template
COPYRIGHT © 2012 Stelligent Systems LLC
Unauthorized duplication is not permitted.
16. Cucumber BDD Basics
• Philosophy
• Executable Specifications
• Continuous Traceability
• Cucumber Components (1)
• Business Facing
• Features
• Scenarios
• Steps
• Technology Facing
• Step Definitions
• Support Code
• Automation Library
• Syntax Rules: Gherkin
From “The Cucumber Book” (Wynne and Hellesoy; Pragmatic Bookshelf, 2012)
COPYRIGHT © 2012 Stelligent Systems LLC
Unauthorized duplication is not permitted.
17. TDI BDD Components
CloudFormation
Cucumber
Jenkins
Step Definitions
COPYRIGHT © 2012 Stelligent Systems LLC
Unauthorized duplication is not permitted.
18. TDI Cucumber Examples
• Walkthrough of production.feature Cucumber feature
COPYRIGHT © 2012 Stelligent Systems LLC
Unauthorized duplication is not permitted.
19. Other TDI Tools
• Cucumber Nagios: http://auxesis.github.com/cucumber-nagios/
• Cucumber Chef: http://www.cucumber-chef.org/
COPYRIGHT © 2012 Stelligent Systems LLC
Unauthorized duplication is not permitted.
20. Question and Answer
Blog http://www.stelligent.com/blog/
Social @stelligent @paulduvall facebook.com/Stelligent
CD Video http://bit.ly/cdwebinar1
Solutions http://www.stelligent.com/solutions/
August
http://www.stelligent.com/cap/
Webinar
Training http://www.stelligent.com/cd-training/
COPYRIGHT © 2012 Stelligent Systems LLC
Unauthorized duplication is not permitted.
21. Infrastructure Components
CloudFormation Template
Elastic IP
Route 53 IAM S3 EC2 SimpleDB Linux OS
Config
Security Group
Apache Tomcat Jenkins Version-Control Repo Cucumber Amazon Simple
HTTPD Notification Service
(SNS)
COPYRIGHT © 2012 Stelligent Systems LLC
Unauthorized duplication is not permitted.