Slide 1

Slide 1 text

Serverspec The Simplest Server Testing Tool Ever #ChefConf 2014 Gosuke Miyashita

Slide 2

Slide 2 text

Let me introduce myself

Slide 3

Slide 3 text

ٶԼ ߶ี Miyashita, Gosuke twitter.com/gosukenator github.com/mizzy

Slide 4

Slide 4 text

Freelance software engineer

Slide 5

Slide 5 text

No content

Slide 6

Slide 6 text

No content

Slide 7

Slide 7 text

Chef in Japan

Slide 8

Slide 8 text

No content

Slide 9

Slide 9 text

What is serverspec ?

Slide 10

Slide 10 text

No content

Slide 11

Slide 11 text

“RSpec tests for your servers configured by Puppet, Chef or anything else.”

Slide 12

Slide 12 text

No content

Slide 13

Slide 13 text

No content

Slide 14

Slide 14 text

No content

Slide 15

Slide 15 text

cgroup/command/cron/ default_gateway/file/group/host/ iis_app_pool/iis_website/interface/ ipfilter/ipnat/iptables/kernel_module/ linux_kernel_parameter/lxc/ mail_alias/package/php_config/port/ process/routing_table/selinux/service/ user/windows_feature/ windows_registry_key/yum_repo/zfs

Slide 16

Slide 16 text

See: serverspec.org/ resource_types.html

Slide 17

Slide 17 text

RedHat/CentOS/SuSE Debian/Ubuntu Arch/Gentoo/Plamo AIX/Solaris/SmartOS FreeBSD/Mac OS X MS Windows

Slide 18

Slide 18 text

How to work ?

Slide 19

Slide 19 text

Run commands, simply via local/SSH/WinRM

Slide 20

Slide 20 text

Detect OS automatically and Run suitable command

Slide 21

Slide 21 text

No content

Slide 22

Slide 22 text

No content

Slide 23

Slide 23 text

Change local/SSH/ WinRM by including appropriate helper

Slide 24

Slide 24 text

OS Detection Helper #BDLFOE Helper

Slide 25

Slide 25 text

What is SpecInfra ?

Slide 26

Slide 26 text

SpecInfra is a command execution framework separated from serverspec

Slide 27

Slide 27 text

SpecInfra serverspec DSL by RSpec Call specinfra API API … OS Abstraction Layer (OS Helper) Commands for Linux Commands for Debian Commands for Solaris Commands forWindows Backend Abstraction Layer (Backend Helper)

Slide 28

Slide 28 text

? Why I separated into serverspec and specinfra

Slide 29

Slide 29 text

I’ve created a very simple configuration management tool as a proof of concept

Slide 30

Slide 30 text

serverspec/configspec

Slide 31

Slide 31 text

No content

Slide 32

Slide 32 text

No content

Slide 33

Slide 33 text

You can create Another type of serverspec with SpecInfra easily

Slide 34

Slide 34 text

But higher abstraction brings more complexity …

Slide 35

Slide 35 text

Why I started this project ?

Slide 36

Slide 36 text

I’m heavy Puppet user since 2007

Slide 37

Slide 37 text

My old puppet manifests are not fully modularized

Slide 38

Slide 38 text

I’ve decided to refactor my puppet manifests

Slide 39

Slide 39 text

Refactoring needs test code

Slide 40

Slide 40 text

But there are no testing tools meet my needs

Slide 41

Slide 41 text

So I made my own testing tool

Slide 42

Slide 42 text

Philosophy "

Slide 43

Slide 43 text

Simpleness

Slide 44

Slide 44 text

Easy to use

Slide 45

Slide 45 text

Support Ruby 1.8.7 (Because for supporting RHEL/CentOS)

Slide 46

Slide 46 text

No need other than Ruby

Slide 47

Slide 47 text

Even Ruby is not needed with SSH

Slide 48

Slide 48 text

Independent from any configuration management tools

Slide 49

Slide 49 text

I love the UNIX philosophy, KISS principle

Slide 50

Slide 50 text

Advanced Topics "

Slide 51

Slide 51 text

How to Customize ?

Slide 52

Slide 52 text

serverspec.org/advanced_tips.html github.com/serverspec/examples

Slide 53

Slide 53 text

Combination with other tools

Slide 54

Slide 54 text

Serverspec is simple and agnostic

Slide 55

Slide 55 text

Test Kitchen

Slide 56

Slide 56 text

busser-serverspec

Slide 57

Slide 57 text

See: kitchen.ci/docs/ getting-started/ writing-server-test

Slide 58

Slide 58 text

Vagrant

Slide 59

Slide 59 text

vagrant-serverspec

Slide 60

Slide 60 text

No content

Slide 61

Slide 61 text

See: github.com/ jvoorhis/vagrant- serverspec

Slide 62

Slide 62 text

Caution "

Slide 63

Slide 63 text

No content

Slide 64

Slide 64 text

Integration test of serverspec itself

Slide 65

Slide 65 text

serverspec/serverspec- integration-test

Slide 66

Slide 66 text

Wercker + DigitalOcean

Slide 67

Slide 67 text

# 1. Pull code 2. Create machines 3. Run Chef and tests 4. Get result

Slide 68

Slide 68 text

No content

Slide 69

Slide 69 text

Now only support CentOS 6 and a few serverspec test code

Slide 70

Slide 70 text

So now I’m working on increasing OS and test code