test-driven infrastructure with cloudformation and cucumber
Post on 30-Nov-2014
1.247 Views
Preview:
DESCRIPTION
TRANSCRIPT
COPYRIGHT © 2012 Stelligent Systems LLC Unauthorized duplication is not permitted.
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.
Introduction
Stelligent
Next Webinar
August 28th: Scripted Deployment with Capistrano http://stelligent.com/cap with Brian Jakovich
Continuous Delivery in the Cloud: http://linkd.in/Pfbf1h
Cloud Delivery: Migration, Training and Operations
Materials Powerpoint and other resources will be emailed to attendees and available in Linkedin group
June Webinar
Recording of last month’s webinar: http://www.stelligent.com/aws-webinar/
COPYRIGHT © 2012 Stelligent Systems LLC Unauthorized duplication is not permitted.
About Me
COPYRIGHT © 2012 Stelligent Systems LLC Unauthorized duplication is not permitted.
Continuous Delivery
http://bit.ly/cdwebinar1
COPYRIGHT © 2012 Stelligent Systems LLC Unauthorized duplication is not permitted.
Continuous Delivery
COPYRIGHT © 2012 Stelligent Systems LLC Unauthorized duplication is not permitted.
COPYRIGHT © 2012 Stelligent Systems LLC Unauthorized duplication is not permitted.
5 Steps to Continuous Delivery
Continuous
Document
Test
Version
Script
Document to automate
Write an automated test to verify behavior
Automate to a single command
Version all scripts
Run headless with every change
COPYRIGHT © 2012 Stelligent Systems LLC Unauthorized duplication is not permitted.
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.
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.
CI Server
Target Environment
Instances Version-Control
Repository
Sidebar: Continuous Integration Process
Developer
Tester
Operations
DBA
Polling
Create Environments
Deploy Build
Tests
COPYRIGHT © 2012 Stelligent Systems LLC Unauthorized duplication is not permitted.
Test-Driven Infrastructure: Success
Jenkins Environment Job
Environment Email SSH
Working App Deployment Email
COPYRIGHT © 2012 Stelligent Systems LLC Unauthorized duplication is not permitted.
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.
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.
Sidebar: Test-Driven Development with JUnit
COPYRIGHT © 2012 Stelligent Systems LLC Unauthorized duplication is not permitted.
Scripted Infrastructure (Code) • Walkthrough of production.template CloudFormation template
COPYRIGHT © 2012 Stelligent Systems LLC Unauthorized duplication is not permitted.
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.
TDI BDD Components
Jenkins
Cucumber
CloudFormation
Step Definitions
COPYRIGHT © 2012 Stelligent Systems LLC Unauthorized duplication is not permitted.
TDI Cucumber Examples
• Walkthrough of production.feature Cucumber feature
COPYRIGHT © 2012 Stelligent Systems LLC Unauthorized duplication is not permitted.
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.
Question and Answer
August Webinar
Blog
Social
Solutions
CD Video
http://www.stelligent.com/blog/
@stelligent @paulduvall facebook.com/Stelligent
http://bit.ly/cdwebinar1
http://www.stelligent.com/solutions/
http://www.stelligent.com/cap/
Training http://www.stelligent.com/cd-training/
COPYRIGHT © 2012 Stelligent Systems LLC Unauthorized duplication is not permitted.
Infrastructure Components CloudFormation Template
Amazon Simple Notification Service
(SNS)
Elastic IP
Security Group IAM Route 53 EC2 SimpleDB
Config
Tomcat Apache HTTPD
Jenkins
Linux OS S3
Version-Control Repo Cucumber
top related