© 2014 Cassini Consulting
Andreas Schmidt
Testing server infrastructure with
serverspec
Cassini Consulting
@cassinigmbh
•  IT & Management Consulting

Andreas Schmidt
•  From Dev to Ops
•  Infrastructure & Depl...
•  Purpose of infrastructure testing
•  #serverspec

•  Examples / Demo
•  Use Cases & benefits
? !
Provisioning &
Delivery
Application
being tested?
Servers
being tested?
How is
infrastructure
being specified?
„Startup“
•  Recent cloud
technology
•  Virtual Infrastructure
Provisioning
•  „Phoenix Server“
„Classic“
IT Environments
...
Automated
Provisioning &
Configuration
Management
Lower-level configuration aspects
•  VM infrastructure & kernel parameters
•  Networking
•  Logical volume management

Sid...
Machine parse-able
Human read-able
Infrastructure
Specification
serverspec
•  www.serverspec.org
•  github.com/serverspec/serverspec

MIT License
Gosuke Miyashita @gokusenator
„With serv...
serverspec
describe package 'openssh-server' do		it { should be_installed }	end	
	
describe file '/etc/ssh/sshd_config' do...
Development box




CM
code
Development box




CM
code




CM
code
specs
Test locally
Development box




CM
code
Staging
Provision 




CM
code
specs
box
„state“
Test locally
Development box




CM
code
Staging
Provision 
Test locally




CM
code
specs
box
„state“




server
spec
„Spec“ box
Development box




CM
code
Staging
Provision 
Test locally




CM
code
specs
box
„state“
Test on
server(s)




server
spe...
Development box




CM
code
Staging
Local VM or Container
Provision 
Test locally




CM
code
specs
box
„state“
Provision
...
Development box




CM
code
Staging
Local VM or Container
Provision 
Test locally




CM
code
specs
box
„state“
Test
Provi...
Development box




CM
code
Staging
Local VM or Container
Provision 
Test locally




CM
code
specs
box
„state“
Test
Provi...
$ gem install serverspec	
diff-lcs, highline, rake	


net-ssh	


rspec, rspec-core, rspec-
expectations, rspec-mock	


spe...
Demo
•  Serverspec Basics
•  Overview of resource types
•  Using abstractions and facts
•  Introduce roles
•  Environment-...
Monitoring vs. Spec
•  Dynamic Aspects
(crashed servers, services
not reachable, disk full, ...)
•  Mostly in „internal fo...
Additional tools
•  Comparable:
rspec-system (! beaker-rspec), rspec-system-serverspec 
•  Integrate serverspec into vagra...
Infrastructure
QA
Infrastructure
regression
testing
Automated
acceptance
testing
Audit
Capabilities
Work
test driven –
Define, build,
compare your
environments.
github.com/aschmidt75/serverspecplayground

andreas.schmidt@cassini.de
xing.to/aschmidt
@aschmidt75
?
Cassini Consulting
Niederlassung Düsseldorf
Andreas Schmidt
Bennigsen-Platz 1
40474 Düsseldorf
Deutschland
andreas.schmidt...
OSDC 2014: Andreas Schmidt - Testing server infrastructure with serverspec
Upcoming SlideShare
Loading in...5
×

OSDC 2014: Andreas Schmidt - Testing server infrastructure with serverspec

558

Published on

Companies that focus on cloud infrastructures for both developing and running their applications are likely to have the highest benefit of test driven infrastructure tools such as configuration management and their spec-oriented testing counterparts.
However many enterprises have not moved to the cloud yet.
Often limited by contracts, regulations or security considerations, they too are in need of testing their infrastructure that service providers built for them.
The talk shows approaches to infrastructure testing and demonstrates the use of serverspec (http://serverspec.org/).

Published in: Software, Technology
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total Views
558
On Slideshare
0
From Embeds
0
Number of Embeds
5
Actions
Shares
0
Downloads
6
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

OSDC 2014: Andreas Schmidt - Testing server infrastructure with serverspec

  1. 1. © 2014 Cassini Consulting Andreas Schmidt Testing server infrastructure with serverspec
  2. 2. Cassini Consulting @cassinigmbh •  IT & Management Consulting Andreas Schmidt •  From Dev to Ops •  Infrastructure & Deployment Automation w/ ruby
  3. 3. •  Purpose of infrastructure testing •  #serverspec •  Examples / Demo •  Use Cases & benefits ? !
  4. 4. Provisioning & Delivery
  5. 5. Application being tested?
  6. 6. Servers being tested?
  7. 7. How is infrastructure being specified?
  8. 8. „Startup“ •  Recent cloud technology •  Virtual Infrastructure Provisioning •  „Phoenix Server“ „Classic“ IT Environments •  Both virtualized & non-virtualized •  Mixed Provisioning processes •  IT outsourcing •  IT System & Software Architecture Regulated IT Environments •  i.e. banking, insurance companies, government •  + Compliance •  + Security Low Cost Short Cycle Time Documentation (Internal/External) Audit Capabilities Internal Documentation Acceptance Tests
  9. 9. Automated Provisioning & Configuration Management
  10. 10. Lower-level configuration aspects •  VM infrastructure & kernel parameters •  Networking •  Logical volume management Side effects •  RPM post-install scripts Documentation •  Specification of infrastructure •  Human Readable Testing on machine itself what‘s missing?
  11. 11. Machine parse-able Human read-able Infrastructure Specification
  12. 12. serverspec •  www.serverspec.org •  github.com/serverspec/serverspec MIT License Gosuke Miyashita @gokusenator „With serverspec, you can write RSpec tests for checking your servers are configured correctly.“
  13. 13. serverspec describe package 'openssh-server' do it { should be_installed } end describe file '/etc/ssh/sshd_config' do it { should be_mode 600 } it { should be_owned_by 'root' }
end describe service 'ssh' do it { should be_enabled } end
  14. 14. Development box CM code
  15. 15. Development box CM code CM code specs Test locally
  16. 16. Development box CM code Staging Provision CM code specs box „state“ Test locally
  17. 17. Development box CM code Staging Provision Test locally CM code specs box „state“ server spec „Spec“ box
  18. 18. Development box CM code Staging Provision Test locally CM code specs box „state“ Test on server(s) server spec „Spec“ box
  19. 19. Development box CM code Staging Local VM or Container Provision Test locally CM code specs box „state“ Provision Test on server(s) server spec „Spec“ box
  20. 20. Development box CM code Staging Local VM or Container Provision Test locally CM code specs box „state“ Test Provision Test on server(s) server spec „Spec“ box
  21. 21. Development box CM code Staging Local VM or Container Provision Test locally CM code specs box „state“ Test Provision Test on server(s) server spec „Spec“ box
  22. 22. $ gem install serverspec diff-lcs, highline, rake 
 net-ssh 
 rspec, rspec-core, rspec- expectations, rspec-mock 
 specinfra, serverspec Basics ssh to target hosts spec basics „Backend“ for infrastructure tests (local/remote, command abstraction, helpers) „Frontend“ w/ resource types à rspec
  23. 23. Demo •  Serverspec Basics •  Overview of resource types •  Using abstractions and facts •  Introduce roles •  Environment-independent specs through properties
  24. 24. Monitoring vs. Spec •  Dynamic Aspects (crashed servers, services not reachable, disk full, ...) •  Mostly in „internal form“, not human readable, special checks buried in scripts •  Static Aspects (how system is built) •  Explicit form, human readable •  Keep your system up & running •  Build according to a specification and prove compliance with it
  25. 25. Additional tools •  Comparable: rspec-system (! beaker-rspec), rspec-system-serverspec •  Integrate serverspec into vagrant as a provisioner: github.com/jvoorhis/vagrant-serverspec •  Reporting http://vincent.bernat.im/en/blog/2014-serverspec-test- infrastructure.html
  26. 26. Infrastructure QA
  27. 27. Infrastructure regression testing
  28. 28. Automated acceptance testing
  29. 29. Audit Capabilities
  30. 30. Work test driven – Define, build, compare your environments.
  31. 31. github.com/aschmidt75/serverspecplayground andreas.schmidt@cassini.de xing.to/aschmidt @aschmidt75 ?
  32. 32. Cassini Consulting Niederlassung Düsseldorf Andreas Schmidt Bennigsen-Platz 1 40474 Düsseldorf Deutschland andreas.schmidt@cassini.de visit www.cassini.de Alle Angaben basieren auf dem derzeitigen Kenntnisstand. Änderungen vorbehalten. Dieses Dokument von Cassini Consulting ist ausschließlich für den Adressaten bzw. Auftraggeber bestimmt. Es bleibt bis zur einer ausdrücklichen Übertragung von Nutzungsrechten Eigentum von Cassini. Jede Bearbeitung, Verwertung, Vervielfältigung und/oder gewerbsmäßige Verbreitung des Werkes ist nur mit Einverständnis von Cassini zulässig.
  1. A particular slide catching your eye?

    Clipping is a handy way to collect important slides you want to go back to later.

×