SlideShare a Scribd company logo
1 of 123
Download to read offline
Operations Level Up
Mandi Walls
Velocity Santa Clara
June 18, 2013
Tuesday, June 18, 13
whoami
• Mandi Walls
• @lnxchk
• Consultant at Opscode
• My 6thVelocity
2
Tuesday, June 18, 13
who are you?
• Ops?
• Devs?
• Management?
• Other functions:
• sales, marketing, foosball,TPS reporting?
3
Tuesday, June 18, 13
What is this madness
• Part call-to-arms
• Part techie hands-on things
• Part revival meeting
4
Tuesday, June 18, 13
Why Do I Care?
5
http://static6.businessinsider.com/image/4a64e07c4b5437860086a0c9/uh-oh-cond-nast-hires-mckinsey.jpg
Tuesday, June 18, 13
Future of Operations
http://www.flickr.com/photos/x-ray_delta_one/5871906878/6
Tuesday, June 18, 13
Evolution of a Practice
• Craft Stage
• Commercial Stage
• Engineering Stage
7 http://www.flickr.com/photos/thaisfraga182/5285413020/sizes/z/in/photostream/
Tuesday, June 18, 13
Craft Stage
• Hand crafted artisanal organic free range
bespoke systems
• Lots of personal heroics
• Land of the BOFHs
8
Tuesday, June 18, 13
Commercial Stage
• Folklore written down
• Standard procedures emerge
• Training begins to occur
9
Tuesday, June 18, 13
Engineering Stage
• Application of scientific principles
• Measurement
• Experimentation towards greater efficiency
10
Tuesday, June 18, 13
New Workflows
• Visibility and planning
• Version control and code review
• Testing, testing, and more testing
• Metrics collection and interpretation
Basically, borrow
some stuff from Dev
11 http://websites-development.com/sites/default/files/git_branch_strategy.png
Tuesday, June 18, 13
New Goals
• Transparency - are we working on the right things
• Reliability - can we keep it running
• Resiliency - can we rebuild it? Do we have the technology?
• Correctness - are we sure it’s doing what we want it to do
12
Tuesday, June 18, 13
New Goals
• Transparency - are we working on the right things
• Reliability - can we keep it running
• Resiliency - can we rebuild it? Do we have the technology?
• Correctness - are we sure it’s doing what we want it to do
12
Building Trust
Tuesday, June 18, 13
More than keeping the lights on.
13
Tuesday, June 18, 13
Ops Identity Crisis
http://www.flickr.com/photos/muffett68/7214428636/14
Tuesday, June 18, 13
Ops Identity Crisis
http://www.flickr.com/photos/muffett68/7214428636/
I don’t write code, I’m a sysadmin
14
Tuesday, June 18, 13
Ops Identity Crisis
http://www.flickr.com/photos/muffett68/7214428636/
I don’t write code, I’m a sysadmin
I have to spend all my time fixing dumb things
14
Tuesday, June 18, 13
Ops Identity Crisis
http://www.flickr.com/photos/muffett68/7214428636/
I don’t write code, I’m a sysadmin
I have to spend all my time fixing dumb things
This takes too much time.
14
Tuesday, June 18, 13
Ops Identity Crisis
http://www.flickr.com/photos/muffett68/7214428636/
I don’t write code, I’m a sysadmin
I have to spend all my time fixing dumb things
This takes too much time.
I’m faster if I don’t have to talk to
anyone about what’s going on.
14
Tuesday, June 18, 13
Ops Identity Crisis
http://www.flickr.com/photos/muffett68/7214428636/
I don’t write code, I’m a sysadmin
I have to spend all my time fixing dumb things
This takes too much time.
These tools are too
hard to learn.
I will write my own
thing.
I’m faster if I don’t have to talk to
anyone about what’s going on.
14
Tuesday, June 18, 13
So, some things to work on
• Some tools for mitigating risk
• Some processes and tips for making the right thing the easy thing
• Increase efficiency, learn some stuff, reevaluate your own work
• Don’t be afraid of borrowing from other disciplines
15
Tuesday, June 18, 13
Eating OurVeggies
16 http://www.packriveryaks.com/
Tuesday, June 18, 13
Opportunity Cost
The value of the things you could be
doing while you were shaving that yak
17
Tuesday, June 18, 13
Employability
18 http://www.flickr.com/photos/sourmash/74666764/
Tuesday, June 18, 13
RiskVectors
• What Ops thinks of as risk
• New code, releases, tasks
• Other sources of risk
• Old products and workflows
• Unrepeatable processes
• Personal heroics
http://www.flickr.com/photos/baresone/4473290629/sizes/z/in/photostream/19
Tuesday, June 18, 13
Assessment of Risk
• Is your process:
• well documented
• repeatable
• reliable
• easy to do right?
http://www.flickr.com/photos/lemusgro/5494317161/sizes/z/in/photostream/20
Tuesday, June 18, 13
EASY TO DO RIGHT
Seriously. I’m not kidding.
21
Tuesday, June 18, 13
Hands On
• Git and hooks for Ops
• Packaging your stuff
• Borrowing sanity checks from other places
• Basic testing without doing a lot of zomgcoding
22
Tuesday, June 18, 13
Hands On
• Git and hooks for Ops
• Packaging your stuff
• Borrowing sanity checks from other places
• Basic testing without doing a lot of zomgcoding
22
https://gist.github.com/lnxchk/5791121
Tuesday, June 18, 13
Getting Started -Vagrant
• Login to your host using ssh
• The user is velocity
• The password is velocityconf
• Vagrant is port-forwarding ssh for you
$ ssh -p 2222 velocity@127.0.0.1
23
Tuesday, June 18, 13
Getting Started - ec2
• Login to your host using ssh
• The user is velocity
• The password is velocityconf
• Make sure your AWS Security Group allows inbound ssh
• You can allow ssh from your EC2 console, under “Security Groups”
$ ssh velocity@ec2-N-N-N-N.compute-1.amazonaws.com
24
Tuesday, June 18, 13
Getting Started - vbox
• If you’re using local virtual box, log in when the guest is initialized
• The user is velocity
• The password is velocityconf
25
Tuesday, June 18, 13
gist
http://bit.ly/14ffQXX
26
Tuesday, June 18, 13
Task 1 - Working with git
http://mattbanks.me/wp-content/uploads/2012/07/Git-Logo.png27
Tuesday, June 18, 13
Why git
• Distributed version control
• Everyone gets a copy
• Hub/spoke model for sharing
• Simple set up
• Easy to run a local git server
• Other offerings, like github, are pretty
awesome too
28
Tuesday, June 18, 13
Git server
• You have a git server on your lab box
• It’s root is in /srv/git
• There is one project, bindfiles.git
• velocity can use ssh:// to talk to the git server
29
Tuesday, June 18, 13
bindfiles
• Directory ~velocity/bindfiles is already a git repo for you
• The remote origin is localhost
• It will use ssh to talk to the local git server
• It contains two trivial zonefiles
• db.192
• db.local
30
Tuesday, June 18, 13
$ cd bindfiles
$ cat .git/config
bindfiles/.git/config
[core]
! repositoryformatversion = 0
! filemode = true
! bare = false
! logallrefupdates = true
[remote "origin"]
! fetch = +refs/heads/*:refs/remotes/origin/*
! url = ssh://localhost/srv/git/bindfiles.git
[branch "master"]
! remote = origin
! merge = refs/heads/master
Remote origin!
31
Tuesday, June 18, 13
$ vi db.192
Edit the db.192 zonefile
32
Tuesday, June 18, 13
Add “wat.local” with final octet 24
Add a new host
33
Tuesday, June 18, 13
$ git status
git status
# On branch master
# Changed but not updated:
# (use "git add <file>..." to update what will be committed)
# (use "git checkout -- <file>..." to discard changes in working directory)
#
#! modified: db.192
#
no changes added to commit (use "git add" and/or "git commit -a")
34
Tuesday, June 18, 13
git tells you what it wants
# Changed but not updated:
# (use "git add <file>..." to update what will be committed)
# (use "git checkout -- <file>..." to discard changes in working
directory)
#
#	

 modified: db.192
35
Tuesday, June 18, 13
$ git add db.192
$ git status
git add
# On branch master
# Changes to be committed:
# (use "git reset HEAD <file>..." to unstage)
#
#! modified: db.192
#
36
Tuesday, June 18, 13
git commit
• git add stages your changes
locally
• git commit will write them to
your local git repository
• add your comment either
inline with “-m” or git commit
will open a buffer for you
37
git commit -m “this commit is awesome”
Tuesday, June 18, 13
$ git commit
git commit
38
Tuesday, June 18, 13
[master 22371ab] Added wat.local to reverse file
1 files changed, 4 insertions(+), 0 deletions(-)
$ git status
# On branch master
# Your branch is ahead of 'origin/master' by 1 commit.
#
nothing to commit (working directory clean)
39
Tuesday, June 18, 13
Making Good Comments
• At least explain what you did, Lucy
• If there is a ticket somewhere, add that in the comment
• If you made multiple changes, call them all out
40
Tuesday, June 18, 13
$ git push
git push
Counting objects: 5, done.
Compressing objects: 100% (3/3), done.
Writing objects: 100% (3/3), 335 bytes, done.
Total 3 (delta 1), reused 0 (delta 0)
To ssh://localhost/srv/git/bindfiles.git
06fa560..22371ab master -> master
41
Tuesday, June 18, 13
git push
• git push sends your changes to the central git
server
• git pull brings everyone else’s changes into
your local repo
• Don’t hoard changes; push and pull often
42
Tuesday, June 18, 13
Ok?
• What did we forget to do?
43
Tuesday, June 18, 13
Update the Serial!
• Lots of Operations tasks have tribal knowledge you need
• Zonefiles have a Serial that needs to be incremented when you make a
change
• They are potentially outage-causing or hair-pulling problems that can
be avoided
• Let’s let git remember to do that for us
44
Tuesday, June 18, 13
commit hooks
• You can put hooks into your git repos
• Little tasks that happen at various steps in the process
• We can add a pre-commit hook to our bindfiles repo
• So you don’t have to remember! Saves time later! Helps junior staff!
45
Tuesday, June 18, 13
$ cp /srv/velocity/pre-commit .git/hooks
$ cat .git/hooks/pre-commit
pre-commit
#!/bin/bash
num=`git diff master db.192 | grep ^+ | wc | awk '{print $1}'`
if [ $num -gt 1 ] ; then
serial=`git diff master db.192 | grep -i serial`
if [ $? -ne 0 ] ; then
echo "You made a change to the zone file but didn't update the Serial value"
exit 1;
fi
fi
46
Tuesday, June 18, 13
pre-commit
• Rather messy, off-the-cuff example
• git diff master db.192
• Looks for changes between what’s in the current master on your
local repo
• If the db.192 file has changed but the value for Serial is the same, it
prints and error and exits with a non-zero return code
• git stops processing the commit, saving you headaches later
47
Tuesday, June 18, 13
Generalized pre-commit
Want it? it’s in the gist!
48
Tuesday, June 18, 13
Try it out
• Make a change to your reverse file, db.192: move wat.local to .22
• don’t update the serial, see what git does for you
• git add db.192
• git commit
You made a change to the zone file but didn't update the Serial value
Well.That was handy!
Fix the zonefile, try it again!Your commit will go through. git push it
Feeling hardcore? Update db.local to match, check it in too
49
Tuesday, June 18, 13
What else to hook?
• Services with config checkers
• make a change to the config, run the checker in a hook
• nagios, named, apache, etc come with check tools
• Other syntax checking
• ruby, json, config management tools
50
Tuesday, June 18, 13
What else to hook?
• Services with config checkers
• make a change to the config, run the checker in a hook
• nagios, named, apache, etc come with check tools
• Other syntax checking
• ruby, json, config management tools
Make it
EASY
to do
RIGHT
50
Tuesday, June 18, 13
Other git things
• git clone
• gives new team members a working copy of the repo
• git branch
• Lets you and other team members work on non-prod stuff
• Use sparingly; less complexity means more reliable results
51
Tuesday, June 18, 13
Task 2: creating packages
• How do you get files, apps, stuff deployed on your hosts?
• scp -r?
• tarballs?
• build everything on every host, you gentoo fans?
• crash cart? (omg)
52
Tuesday, June 18, 13
Packaging
• Reap the benefits of what’s built in to your package manager
• Versioning
• Dependencies
• Metadata
• Build-once, install-many
• File transfer built right into stuff like yum and apt repos!
53
Tuesday, June 18, 13
Package.All.The.Things.
54 http://cdn.meme.li/instances/300x300/38833426.jpg
Tuesday, June 18, 13
Make it easy: fpm
• Creating packages from scratch is tedious
• There’s some esoteric stuff in the package managers
• You really only need a few things
55
Tuesday, June 18, 13
fpm
• fpm,“f’ing package managers”!
• Jordan Sissell
• Creates multiple kinds of packages from various resources
• https://github.com/jordansissel/fpm
56
It’s already installed on your
lab box!
Tuesday, June 18, 13
$ fpm -h
fpm
Intro:
This is fpm version 0.4.37
If you think something is wrong, it's probably a bug! :)
Please file these here: https://github.com/jordansissel/fpm/issues
You can find support on irc (#fpm on freenode irc) or via email with
fpm-users@googlegroups.com
Usage:
fpm [OPTIONS] [ARGS] ...
Parameters:
[ARGS] ... Inputs to the source package type. For the 'dir' type, this is the files and
directories you want to include in the package. For others, like 'gem', it specifies the packages to download and
use as the gem input
Options:
-t OUTPUT_TYPE the type of package you want to create (deb, rpm, solaris, etc)
-s INPUT_TYPE the package type to use as input (gem, rpm, python, etc)
-C CHDIR Change directory to here before searching for files
omg it just keeps going.... 57
Tuesday, June 18, 13
Create a package
• rpm-ify our zonefiles
• They’re in our git repo right now
• Live in /var/named for reals
• If we package them, we get versioning and other data
58
Tuesday, June 18, 13
fpm settings
• -s dir : we’re working with raw files rather than a gem, rpm, etc
• -t rpm : create an rpm package
• -v 1.0 : first version!
• --prefix=/var/named : where the files will be installed
• -n “zonefiles” : name of the package
• --after-install /srv/velocity/restart_named.sh : run this after installing
• db* : the files to be packaged
$ fpm -s dir -t rpm -v 1.0 --prefix=/var/named 
-n "zonefiles" --after-install 
/srv/velocity/restart_named.sh db*
59
Tuesday, June 18, 13
$ fpm -s dir -t rpm -v 1.0 --prefix=/var/named 
-n "zonefiles" --after-install 
/srv/velocity/restart_named.sh db*
Created rpm {:path=>"zonefiles-1.0-1.x86_64.rpm"}
$ rpm -qpl zonefiles-1.0-1.x86_64.rpm
/var/named/db.192
/var/named/db.local
60
Tuesday, June 18, 13
• Nice!
• Now we can install it
61
Tuesday, June 18, 13
$ sudo rpm -ihv zonefiles-1.0-1.x86_64.rpm
Results!
Preparing... ########################################### [100%]
1:zonefiles ########################################### [100%]
Stopping named: .[ OK ]
Starting named: [ OK ]
$ dig @localhost -x 192.168.1.22
;; QUESTION SECTION:
;22.1.168.192.in-addr.arpa.!IN! PTR
;; ANSWER SECTION:
22.1.168.192.in-addr.arpa. 604800 IN! PTR!wat.local.
62
Tuesday, June 18, 13
Put the bits together
• Your zonefiles are in a git repo
• The repo has syntax and error
checking pre-commit hooks
• The repo can also have
packaging and deploy post-
commit hooks
• Smooth the process, make the
right way the easiest way
http://www.flickr.com/photos/62904109@N00/2636859006/sizes/z/in/photostream/63
Tuesday, June 18, 13
Task 3:Testing
• Lots of work in the dev space
• TDD, BDD, test, test
• Write tests first, prove they fail, write
code to make them pass
• More risk reduction
• Looks scary
http://www.flickr.com/photos/nobleup/3995733415/sizes/z/in/photostream/64
Tuesday, June 18, 13
basic tests
• So, there’s a DNS server on the lab box
• What else is here?
• Nagios server!
http://www.flickr.com/photos/richardmoross/490988453/sizes/z/in/photostream/65
Tuesday, June 18, 13
What can we borrow?
• Nagios plugins!
• Extensive set of checks for all sorts of services
• Usable from the command line
66
Tuesday, June 18, 13
$ ls /usr/lib64/nagios/plugins
nagios plugins
check_breeze check_game check_mrtgtraf check_overcr check_swap
check_by_ssh check_hpjd check_mysql check_pgsql check_tcp
check_clamd check_http check_mysql_query check_ping check_time
check_cluster check_icmp check_nagios check_pop check_udp
check_dhcp check_ide_smart check_nntp check_procs check_ups
check_dig check_imap check_nntps check_real check_users
check_disk check_ircd check_nrpe check_rpc check_wave
check_disk_smb check_jabber check_nt check_sensors eventhandlers
check_dns check_ldap check_ntp check_simap negate
check_dummy check_ldaps check_ntp_peer check_smtp urlize
check_file_age check_load check_ntp.pl check_snmp utils.pm
check_flexlm check_log check_ntp_time check_spop utils.sh
check_fping check_mailq check_nwstat check_ssh
check_ftp check_mrtg check_oracle check_ssmtp
67
Tuesday, June 18, 13
$ ls /usr/lib64/nagios/plugins
nagios plugins
check_breeze check_game check_mrtgtraf check_overcr check_swap
check_by_ssh check_hpjd check_mysql check_pgsql check_tcp
check_clamd check_http check_mysql_query check_ping check_time
check_cluster check_icmp check_nagios check_pop check_udp
check_dhcp check_ide_smart check_nntp check_procs check_ups
check_dig check_imap check_nntps check_real check_users
check_disk check_ircd check_nrpe check_rpc check_wave
check_disk_smb check_jabber check_nt check_sensors eventhandlers
check_dns check_ldap check_ntp check_simap negate
check_dummy check_ldaps check_ntp_peer check_smtp urlize
check_file_age check_load check_ntp.pl check_snmp utils.pm
check_flexlm check_log check_ntp_time check_spop utils.sh
check_fping check_mailq check_nwstat check_ssh
check_ftp check_mrtg check_oracle check_ssmtp
67
Tuesday, June 18, 13
$ ls /usr/lib64/nagios/plugins
nagios plugins
check_breeze check_game check_mrtgtraf check_overcr check_swap
check_by_ssh check_hpjd check_mysql check_pgsql check_tcp
check_clamd check_http check_mysql_query check_ping check_time
check_cluster check_icmp check_nagios check_pop check_udp
check_dhcp check_ide_smart check_nntp check_procs check_ups
check_dig check_imap check_nntps check_real check_users
check_disk check_ircd check_nrpe check_rpc check_wave
check_disk_smb check_jabber check_nt check_sensors eventhandlers
check_dns check_ldap check_ntp check_simap negate
check_dummy check_ldaps check_ntp_peer check_smtp urlize
check_file_age check_load check_ntp.pl check_snmp utils.pm
check_flexlm check_log check_ntp_time check_spop utils.sh
check_fping check_mailq check_nwstat check_ssh
check_ftp check_mrtg check_oracle check_ssmtp
Hey! A DNS Checker!
67
Tuesday, June 18, 13
check_dns
• We can use these plugins to test out what we’re doing
• Don’t require any additional frameworks or scary things
• Many of them work just fine over the network, too
68
Tuesday, June 18, 13
$ /usr/lib64/nagios/plugins/check_dns -h
Check DNS
check_dns v1.4.16 (nagios-plugins 1.4.16)
Copyright (c) 1999 Ethan Galstad <nagios@nagios.org>
Copyright (c) 2000-2008 Nagios Plugin Development Team
! <nagiosplug-devel@lists.sourceforge.net>
This plugin uses the nslookup program to obtain the IP address for the given host/domain query.
An optional DNS server to use may be specified.
If no DNS server is specified, the default server(s) specified in /etc/resolv.conf will be used.
Usage:
check_dns -H host [-s server] [-a expected-address] [-A] [-t timeout] [-w warn] [-c crit]
69
Tuesday, June 18, 13
$ check_dns -H box.local -s 127.0.0.1 -a 192.168.1.21
When check_dns is ok
DNS OK: 0.004 seconds response time. box.local
returns 192.168.1.21|time=0.004142s;;;0.000000
$ echo $?
0
70
Tuesday, June 18, 13
$ check_dns -H box.local -s 127.0.0.1 -a 192.168.1.22
check_dns errors
DNS CRITICAL - expected '192.168.1.22' but got '192.168.1.21'
$ echo $?
2
71
Tuesday, June 18, 13
cool
• Now we have a way to test our changes
• Behaves in a predictable way
• Now let’s add one more component: a test harness
72
Tuesday, June 18, 13
Task 4: testing with bats
• Bash Automated Testing System
• Like all good tools, bats is impossible to google
• https://github.com/sstephenson/bats
omg these are adorable.
http://www.flickr.com/photos/37539972@N06/3980094382/sizes/z/in/photostream/
73http://www.etsy.com/shop/theitsybitsyspider
Tuesday, June 18, 13
What the bats
• Allows you to test that UNIX programs do what you expect
• Write stuff in bash to test other system commands
• Easy to get hold of return codes, output
• Let’s see an example: checking the nagios configs
74
Tuesday, June 18, 13
$ bats /srv/velocity/nagios.bats
Using bats
1..1
ok 1 nagios is all good
75
Tuesday, June 18, 13
$ bats /srv/velocity/nagios.bats
Using bats
1..1
ok 1 nagios is all good
75
Tuesday, June 18, 13
$ bats /srv/velocity/nagios.bats
Using bats
1..1
ok 1 nagios is all good
Ran one test
75
Tuesday, June 18, 13
$ bats /srv/velocity/nagios.bats
Using bats
1..1
ok 1 nagios is all good
Ran one test
75
Tuesday, June 18, 13
$ bats /srv/velocity/nagios.bats
Using bats
1..1
ok 1 nagios is all good
Ran one test
All good!
75
Tuesday, June 18, 13
$ cat /srv/velocity/nagios.bats
#!/usr/bin/env bats
@test "nagios is all good" {
result="$(sudo service nagios checkconfig)"
[ "$?" -eq 0 ]
}
76
Tuesday, June 18, 13
$ cat /srv/velocity/nagios.bats
#!/usr/bin/env bats
@test "nagios is all good" {
result="$(sudo service nagios checkconfig)"
[ "$?" -eq 0 ]
}
76
Tuesday, June 18, 13
$ cat /srv/velocity/nagios.bats
#!/usr/bin/env bats
@test "nagios is all good" {
result="$(sudo service nagios checkconfig)"
[ "$?" -eq 0 ]
}
Run a system command!
76
Tuesday, June 18, 13
$ cat /srv/velocity/nagios.bats
#!/usr/bin/env bats
@test "nagios is all good" {
result="$(sudo service nagios checkconfig)"
[ "$?" -eq 0 ]
}
Run a system command!
76
Tuesday, June 18, 13
$ cat /srv/velocity/nagios.bats
#!/usr/bin/env bats
@test "nagios is all good" {
result="$(sudo service nagios checkconfig)"
[ "$?" -eq 0 ]
}
Run a system command!
Check the return code!
76
Tuesday, June 18, 13
$ cat /srv/velocity/nagios.bats
#!/usr/bin/env bats
@test "nagios is all good" {
result="$(sudo service nagios checkconfig)"
[ "$?" -eq 0 ]
}
Run a system command!
Check the return code!
76
Tuesday, June 18, 13
$ cat /srv/velocity/nagios.bats
#!/usr/bin/env bats
@test "nagios is all good" {
result="$(sudo service nagios checkconfig)"
[ "$?" -eq 0 ]
}
Run a system command!
Check the return code!
Also grabs output, but
we don’t need that here
76
Tuesday, June 18, 13
We can do this!
http://www.flickr.com/photos/usnationalarchives/3678696585/
77
Tuesday, June 18, 13
Task 5:All together
1. write a new bats test so it fails
2. make the changes to our zonefiles
1. check them in with git, build our package, install it
3. re-run our bats test to prove it passes
4. Win.
Let’s say we have a task to add velocity.local / 192.168.1.24 to our zone
78
Tuesday, June 18, 13
$ cd ~/bindfiles
$ mkdir tests
$ vi tests/velocity.bats
1: bats test
• What to test?
• Forward lookup : velocity.bats
• Backwards lookup : 192.168.1.24
• Use the check_dns nagios plugin
79
Tuesday, June 18, 13
velocity.bats
#!/usr/bin/env bats
@test "velocity.local forward lookup is good" {
/usr/lib64/nagios/plugins/check_dns -H velocity.local -s
127.0.0.1 -a 192.168.1.24
[ "$?" -eq 0 ]
}
@test "velocity.local reverse lookup is good" {
/usr/lib64/nagios/plugins/check_dns -H 192.168.1.24 -s 127.0.0.1
-a velocity.local.
[ "$?" -eq 0 ]
}
80
Tuesday, June 18, 13
$ bats testing/velocity.bats
Pre-test fails
1..2
not ok 1 velocity.local forward lookup is good
# /home/velocity/bindfiles/tests/velocity.bats:4
# Domain velocity.local was not found by the server
not ok 2 velocity.local reverse lookup is good
# /home/velocity/bindfiles/tests/velocity.bats:9
# Domain 192.168.1.24 was not found by the server
81
Tuesday, June 18, 13
$ git add tests
$ git commit -m "Adding bats testing"
$ git push
Check the tests in
• Matter of preference, checking the new tests directory in first
82
Tuesday, June 18, 13
$ vi db.192
2: Make your DNS changes
...
; also list other computers
21 IN PTR box.local.
22 IN PTR wat.local.
24 IN PTR velocity.local.
83
Tuesday, June 18, 13
$ vi db.192
2: Make your DNS changes
...
; also list other computers
21 IN PTR box.local.
22 IN PTR wat.local.
24 IN PTR velocity.local.
Update your Serial too!
Or don’t; pre-commit will
know!
83
Tuesday, June 18, 13
$ vi db.local
....
;also list other computers
box IN A 192.168.1.21
wat IN A 192.168.1.22
velocity IN A 192.168.1.24
84
Tuesday, June 18, 13
$ vi db.local
....
;also list other computers
box IN A 192.168.1.21
wat IN A 192.168.1.22
velocity IN A 192.168.1.24
Update your Serial too!
Or don’t; pre-commit will
know!
84
Tuesday, June 18, 13
$ git add db.*
$ git commit -m “Adding velocity.local”
$ git push
85
Tuesday, June 18, 13
$ fpm -s dir -t rpm -v 1.2 --prefix=/var/named 
-n "zonefiles" --after-install 
/srv/velocity/restart_named.sh db*
3: Build the zonefiles rpm
Created rpm
{:path=>"zonefiles-1.2-1.x86_64.rpm"}
$ sudo rpm -Uhv zonefiles-1.2-1.x86_64.rpm
Preparing... ########################################### [100%]
1:zonefiles ########################################### [100%]
Stopping named: [ OK ]
Starting named: [ OK ]
86
Tuesday, June 18, 13
$ bats tests/velocity.bats
4: Re-run your tests
1..2
ok 1 velocity.local forward lookup is good
ok 2 velocity.local reverse lookup is good
87
Tuesday, June 18, 13
How about that
• We wrote a test first, before making changes
• The test fails before the changes are made!
• Make the changes
• Run the test again, it succeeds!
88 http://www.coolfbcovers.net/wp-content/uploads/2013/05/Success-Kid.jpg
Tuesday, June 18, 13
Our Goals:Transparency
• Are we working on something that adds value?
89
Tuesday, June 18, 13
Our Goals: Reliability
• Does our new process keep things running?
90
Tuesday, June 18, 13
Our Goals: Resiliency
• Does our new process make it easy to rebuild, recover, scale?
91
Tuesday, June 18, 13
Our Goals: Correctness
• Does our new process ensure that the work we’re doing is correct?
92
Tuesday, June 18, 13
Building from here
93 http://www.flickr.com/photos/kalmyket/691478431/sizes/z/in/photostream/
Tuesday, June 18, 13
Configuration Management
• USE IT
• Yes, there is a learning curve
• Yes, it will be worth it in the long run
94
Tuesday, June 18, 13
Logging
• Big Data and Business Intelligence analytics are
everywhere
• Logs have value to Ops, Dev, BizDev, Marketing, etc
• Tools like logstash help you put together better
pipeline
• http://logstash.net
95
Tuesday, June 18, 13
Metrics
• We’ve seen lots of talks about metrics atVelocity
• statsd
• graphite
• Learn you some R
• Metrics also have value to groups outside of Ops
96
Tuesday, June 18, 13
Monitoring
• Monitor all, alert few
• Check out Monitorama, a conference and emerging
community around monitoring
• http://monitorama.com
97
Tuesday, June 18, 13
GetVirtual
• Do more real-world testing
• vagrant, vbox, cloud providers
• Make Dev and QA really look like prod
98
Tuesday, June 18, 13
Next
Fostering innovation by making resources available
99
Tuesday, June 18, 13
Takeaways
• Reliable, repeatable processes
• Make stuff easy to do right
• Reduce risk of mistakes, misunderstandings
• Reduce the need for personal heroics
http://www.flickr.com/photos/ginnerobot/2877212845/sizes/z/in/photostream/100
Tuesday, June 18, 13
Thanks!
• Thanks for your kind attention
• Please keep the conversation going with your teams
101
Tuesday, June 18, 13

More Related Content

Similar to Mwalls velocity levelup

Logs Are Magic: Why Git Workflows and Commit Structure Should Matter To You
Logs Are Magic: Why Git Workflows and Commit Structure Should Matter To YouLogs Are Magic: Why Git Workflows and Commit Structure Should Matter To You
Logs Are Magic: Why Git Workflows and Commit Structure Should Matter To YouJohn Anderson
 
Hotspot Garbage Collection - Tuning Guide
Hotspot Garbage Collection - Tuning GuideHotspot Garbage Collection - Tuning Guide
Hotspot Garbage Collection - Tuning GuidejClarity
 
Gerrit Code Review Analytics
Gerrit Code Review AnalyticsGerrit Code Review Analytics
Gerrit Code Review AnalyticsLuca Milanesio
 
Open Source Tools for Leveling Up Operations FOSSET 2014
Open Source Tools for Leveling Up Operations FOSSET 2014Open Source Tools for Leveling Up Operations FOSSET 2014
Open Source Tools for Leveling Up Operations FOSSET 2014Mandi Walls
 
The what, how and why of scaling git repositories
The what, how and why of scaling git repositoriesThe what, how and why of scaling git repositories
The what, how and why of scaling git repositoriesJohan Abildskov
 
Ten Things You Didn't Know Git And GitHub Could Do
Ten Things You Didn't Know Git And GitHub Could DoTen Things You Didn't Know Git And GitHub Could Do
Ten Things You Didn't Know Git And GitHub Could DoOwen Ou
 
Getting sh*t done with Jekyll
Getting sh*t done with JekyllGetting sh*t done with Jekyll
Getting sh*t done with JekyllRonan Berder
 
Everything you didn't know you needed
Everything you didn't know you neededEverything you didn't know you needed
Everything you didn't know you neededHenry Schreiner
 
2013 jsdc webworker
2013 jsdc webworker2013 jsdc webworker
2013 jsdc webworkerBingo Yang
 
Git with the flow
Git with the flowGit with the flow
Git with the flowDana White
 
Version Control and Git - GitHub Workshop
Version Control and Git - GitHub WorkshopVersion Control and Git - GitHub Workshop
Version Control and Git - GitHub WorkshopAll Things Open
 
The Basics of Open Source Collaboration With Git and GitHub
The Basics of Open Source Collaboration With Git and GitHubThe Basics of Open Source Collaboration With Git and GitHub
The Basics of Open Source Collaboration With Git and GitHubBigBlueHat
 
A byte of git
A byte of gitA byte of git
A byte of gitWeng Wei
 
Hyperleger Fabric Workshop - Denver Blockchain Week
Hyperleger Fabric Workshop - Denver Blockchain WeekHyperleger Fabric Workshop - Denver Blockchain Week
Hyperleger Fabric Workshop - Denver Blockchain WeekHorea Porutiu
 
Git isthenewsexy
Git isthenewsexyGit isthenewsexy
Git isthenewsexyAilsa126
 
Version control, you git
Version control, you gitVersion control, you git
Version control, you gitMayur Patil
 
Enterprise git
Enterprise gitEnterprise git
Enterprise gitPedro Melo
 
stackconf 2021 | GitOps: yea or nay?
stackconf 2021 | GitOps: yea or nay?stackconf 2021 | GitOps: yea or nay?
stackconf 2021 | GitOps: yea or nay?NETWAYS
 
Hello Gitty - Github Introduction
Hello Gitty - Github IntroductionHello Gitty - Github Introduction
Hello Gitty - Github IntroductionSachin S. Kamath
 

Similar to Mwalls velocity levelup (20)

Logs Are Magic: Why Git Workflows and Commit Structure Should Matter To You
Logs Are Magic: Why Git Workflows and Commit Structure Should Matter To YouLogs Are Magic: Why Git Workflows and Commit Structure Should Matter To You
Logs Are Magic: Why Git Workflows and Commit Structure Should Matter To You
 
Hotspot Garbage Collection - Tuning Guide
Hotspot Garbage Collection - Tuning GuideHotspot Garbage Collection - Tuning Guide
Hotspot Garbage Collection - Tuning Guide
 
Gerrit Code Review Analytics
Gerrit Code Review AnalyticsGerrit Code Review Analytics
Gerrit Code Review Analytics
 
Open Source Tools for Leveling Up Operations FOSSET 2014
Open Source Tools for Leveling Up Operations FOSSET 2014Open Source Tools for Leveling Up Operations FOSSET 2014
Open Source Tools for Leveling Up Operations FOSSET 2014
 
The what, how and why of scaling git repositories
The what, how and why of scaling git repositoriesThe what, how and why of scaling git repositories
The what, how and why of scaling git repositories
 
Ten Things You Didn't Know Git And GitHub Could Do
Ten Things You Didn't Know Git And GitHub Could DoTen Things You Didn't Know Git And GitHub Could Do
Ten Things You Didn't Know Git And GitHub Could Do
 
Getting sh*t done with Jekyll
Getting sh*t done with JekyllGetting sh*t done with Jekyll
Getting sh*t done with Jekyll
 
Everything you didn't know you needed
Everything you didn't know you neededEverything you didn't know you needed
Everything you didn't know you needed
 
2013 jsdc webworker
2013 jsdc webworker2013 jsdc webworker
2013 jsdc webworker
 
Git with the flow
Git with the flowGit with the flow
Git with the flow
 
Version Control and Git - GitHub Workshop
Version Control and Git - GitHub WorkshopVersion Control and Git - GitHub Workshop
Version Control and Git - GitHub Workshop
 
The Basics of Open Source Collaboration With Git and GitHub
The Basics of Open Source Collaboration With Git and GitHubThe Basics of Open Source Collaboration With Git and GitHub
The Basics of Open Source Collaboration With Git and GitHub
 
A byte of git
A byte of gitA byte of git
A byte of git
 
Hyperleger Fabric Workshop - Denver Blockchain Week
Hyperleger Fabric Workshop - Denver Blockchain WeekHyperleger Fabric Workshop - Denver Blockchain Week
Hyperleger Fabric Workshop - Denver Blockchain Week
 
Git isthenewsexy
Git isthenewsexyGit isthenewsexy
Git isthenewsexy
 
Version control, you git
Version control, you gitVersion control, you git
Version control, you git
 
Enterprise git
Enterprise gitEnterprise git
Enterprise git
 
stackconf 2021 | GitOps: yea or nay?
stackconf 2021 | GitOps: yea or nay?stackconf 2021 | GitOps: yea or nay?
stackconf 2021 | GitOps: yea or nay?
 
Hello Gitty - Github Introduction
Hello Gitty - Github IntroductionHello Gitty - Github Introduction
Hello Gitty - Github Introduction
 
Techoalien git
Techoalien gitTechoalien git
Techoalien git
 

More from Mandi Walls

DOD Raleigh Gamedays with Chaos Engineering.pdf
DOD Raleigh Gamedays with Chaos Engineering.pdfDOD Raleigh Gamedays with Chaos Engineering.pdf
DOD Raleigh Gamedays with Chaos Engineering.pdfMandi Walls
 
Addo reducing trauma in organizations with SLOs and chaos engineering
Addo  reducing trauma in organizations with SLOs and chaos engineeringAddo  reducing trauma in organizations with SLOs and chaos engineering
Addo reducing trauma in organizations with SLOs and chaos engineeringMandi Walls
 
Full Service Ownership
Full Service OwnershipFull Service Ownership
Full Service OwnershipMandi Walls
 
PagerDuty: Best Practices for On Call Teams
PagerDuty: Best Practices for On Call TeamsPagerDuty: Best Practices for On Call Teams
PagerDuty: Best Practices for On Call TeamsMandi Walls
 
InSpec at DevOps ATL Meetup January 22, 2020
InSpec at DevOps ATL Meetup January 22, 2020InSpec at DevOps ATL Meetup January 22, 2020
InSpec at DevOps ATL Meetup January 22, 2020Mandi Walls
 
Prescriptive Security with InSpec - All Things Open 2019
Prescriptive Security with InSpec - All Things Open 2019Prescriptive Security with InSpec - All Things Open 2019
Prescriptive Security with InSpec - All Things Open 2019Mandi Walls
 
Using Chef InSpec for Infrastructure Security
Using Chef InSpec for Infrastructure SecurityUsing Chef InSpec for Infrastructure Security
Using Chef InSpec for Infrastructure SecurityMandi Walls
 
Adding Security to Your Workflow With InSpec - SCaLE17x
Adding Security to Your Workflow With InSpec - SCaLE17xAdding Security to Your Workflow With InSpec - SCaLE17x
Adding Security to Your Workflow With InSpec - SCaLE17xMandi Walls
 
Habitat talk at CodeMonsters Sofia, Bulgaria Nov 27 2018
Habitat talk at CodeMonsters Sofia, Bulgaria Nov 27 2018Habitat talk at CodeMonsters Sofia, Bulgaria Nov 27 2018
Habitat talk at CodeMonsters Sofia, Bulgaria Nov 27 2018Mandi Walls
 
BuildStuff.LT 2018 InSpec Workshop
BuildStuff.LT 2018 InSpec WorkshopBuildStuff.LT 2018 InSpec Workshop
BuildStuff.LT 2018 InSpec WorkshopMandi Walls
 
InSpec Workshop at Velocity London 2018
InSpec Workshop at Velocity London 2018InSpec Workshop at Velocity London 2018
InSpec Workshop at Velocity London 2018Mandi Walls
 
DevOpsDays InSpec Workshop
DevOpsDays InSpec WorkshopDevOpsDays InSpec Workshop
DevOpsDays InSpec WorkshopMandi Walls
 
Adding Security and Compliance to Your Workflow with InSpec
Adding Security and Compliance to Your Workflow with InSpecAdding Security and Compliance to Your Workflow with InSpec
Adding Security and Compliance to Your Workflow with InSpecMandi Walls
 
InSpec - June 2018 at Open28.be
InSpec - June 2018 at Open28.beInSpec - June 2018 at Open28.be
InSpec - June 2018 at Open28.beMandi Walls
 
habitat at docker bud
habitat at docker budhabitat at docker bud
habitat at docker budMandi Walls
 
Ingite Slides for InSpec
Ingite Slides for InSpecIngite Slides for InSpec
Ingite Slides for InSpecMandi Walls
 
Habitat at LinuxLab IT
Habitat at LinuxLab ITHabitat at LinuxLab IT
Habitat at LinuxLab ITMandi Walls
 
InSpec Workshop DevSecCon 2017
InSpec Workshop DevSecCon 2017InSpec Workshop DevSecCon 2017
InSpec Workshop DevSecCon 2017Mandi Walls
 
Habitat Workshop at Velocity London 2017
Habitat Workshop at Velocity London 2017Habitat Workshop at Velocity London 2017
Habitat Workshop at Velocity London 2017Mandi Walls
 
InSpec Workflow for DevOpsDays Riga 2017
InSpec Workflow for DevOpsDays Riga 2017InSpec Workflow for DevOpsDays Riga 2017
InSpec Workflow for DevOpsDays Riga 2017Mandi Walls
 

More from Mandi Walls (20)

DOD Raleigh Gamedays with Chaos Engineering.pdf
DOD Raleigh Gamedays with Chaos Engineering.pdfDOD Raleigh Gamedays with Chaos Engineering.pdf
DOD Raleigh Gamedays with Chaos Engineering.pdf
 
Addo reducing trauma in organizations with SLOs and chaos engineering
Addo  reducing trauma in organizations with SLOs and chaos engineeringAddo  reducing trauma in organizations with SLOs and chaos engineering
Addo reducing trauma in organizations with SLOs and chaos engineering
 
Full Service Ownership
Full Service OwnershipFull Service Ownership
Full Service Ownership
 
PagerDuty: Best Practices for On Call Teams
PagerDuty: Best Practices for On Call TeamsPagerDuty: Best Practices for On Call Teams
PagerDuty: Best Practices for On Call Teams
 
InSpec at DevOps ATL Meetup January 22, 2020
InSpec at DevOps ATL Meetup January 22, 2020InSpec at DevOps ATL Meetup January 22, 2020
InSpec at DevOps ATL Meetup January 22, 2020
 
Prescriptive Security with InSpec - All Things Open 2019
Prescriptive Security with InSpec - All Things Open 2019Prescriptive Security with InSpec - All Things Open 2019
Prescriptive Security with InSpec - All Things Open 2019
 
Using Chef InSpec for Infrastructure Security
Using Chef InSpec for Infrastructure SecurityUsing Chef InSpec for Infrastructure Security
Using Chef InSpec for Infrastructure Security
 
Adding Security to Your Workflow With InSpec - SCaLE17x
Adding Security to Your Workflow With InSpec - SCaLE17xAdding Security to Your Workflow With InSpec - SCaLE17x
Adding Security to Your Workflow With InSpec - SCaLE17x
 
Habitat talk at CodeMonsters Sofia, Bulgaria Nov 27 2018
Habitat talk at CodeMonsters Sofia, Bulgaria Nov 27 2018Habitat talk at CodeMonsters Sofia, Bulgaria Nov 27 2018
Habitat talk at CodeMonsters Sofia, Bulgaria Nov 27 2018
 
BuildStuff.LT 2018 InSpec Workshop
BuildStuff.LT 2018 InSpec WorkshopBuildStuff.LT 2018 InSpec Workshop
BuildStuff.LT 2018 InSpec Workshop
 
InSpec Workshop at Velocity London 2018
InSpec Workshop at Velocity London 2018InSpec Workshop at Velocity London 2018
InSpec Workshop at Velocity London 2018
 
DevOpsDays InSpec Workshop
DevOpsDays InSpec WorkshopDevOpsDays InSpec Workshop
DevOpsDays InSpec Workshop
 
Adding Security and Compliance to Your Workflow with InSpec
Adding Security and Compliance to Your Workflow with InSpecAdding Security and Compliance to Your Workflow with InSpec
Adding Security and Compliance to Your Workflow with InSpec
 
InSpec - June 2018 at Open28.be
InSpec - June 2018 at Open28.beInSpec - June 2018 at Open28.be
InSpec - June 2018 at Open28.be
 
habitat at docker bud
habitat at docker budhabitat at docker bud
habitat at docker bud
 
Ingite Slides for InSpec
Ingite Slides for InSpecIngite Slides for InSpec
Ingite Slides for InSpec
 
Habitat at LinuxLab IT
Habitat at LinuxLab ITHabitat at LinuxLab IT
Habitat at LinuxLab IT
 
InSpec Workshop DevSecCon 2017
InSpec Workshop DevSecCon 2017InSpec Workshop DevSecCon 2017
InSpec Workshop DevSecCon 2017
 
Habitat Workshop at Velocity London 2017
Habitat Workshop at Velocity London 2017Habitat Workshop at Velocity London 2017
Habitat Workshop at Velocity London 2017
 
InSpec Workflow for DevOpsDays Riga 2017
InSpec Workflow for DevOpsDays Riga 2017InSpec Workflow for DevOpsDays Riga 2017
InSpec Workflow for DevOpsDays Riga 2017
 

Recently uploaded

Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machinePadma Pradeep
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Allon Mureinik
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure servicePooja Nehwal
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountPuma Security, LLC
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking MenDelhi Call girls
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationRidwan Fadjar
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 3652toLead Limited
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slidespraypatel2
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreternaman860154
 
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | DelhiFULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhisoniya singh
 
How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?XfilesPro
 
Next-generation AAM aircraft unveiled by Supernal, S-A2
Next-generation AAM aircraft unveiled by Supernal, S-A2Next-generation AAM aircraft unveiled by Supernal, S-A2
Next-generation AAM aircraft unveiled by Supernal, S-A2Hyundai Motor Group
 
Hyderabad Call Girls Khairatabad ✨ 7001305949 ✨ Cheap Price Your Budget
Hyderabad Call Girls Khairatabad ✨ 7001305949 ✨ Cheap Price Your BudgetHyderabad Call Girls Khairatabad ✨ 7001305949 ✨ Cheap Price Your Budget
Hyderabad Call Girls Khairatabad ✨ 7001305949 ✨ Cheap Price Your BudgetEnjoy Anytime
 
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...HostedbyConfluent
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Patryk Bandurski
 
Key Features Of Token Development (1).pptx
Key  Features Of Token  Development (1).pptxKey  Features Of Token  Development (1).pptx
Key Features Of Token Development (1).pptxLBM Solutions
 

Recently uploaded (20)

Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machine
 
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptxE-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
Vulnerability_Management_GRC_by Sohang Sengupta.pptx
Vulnerability_Management_GRC_by Sohang Sengupta.pptxVulnerability_Management_GRC_by Sohang Sengupta.pptx
Vulnerability_Management_GRC_by Sohang Sengupta.pptx
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 Presentation
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | DelhiFULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
 
How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?
 
Next-generation AAM aircraft unveiled by Supernal, S-A2
Next-generation AAM aircraft unveiled by Supernal, S-A2Next-generation AAM aircraft unveiled by Supernal, S-A2
Next-generation AAM aircraft unveiled by Supernal, S-A2
 
Hyderabad Call Girls Khairatabad ✨ 7001305949 ✨ Cheap Price Your Budget
Hyderabad Call Girls Khairatabad ✨ 7001305949 ✨ Cheap Price Your BudgetHyderabad Call Girls Khairatabad ✨ 7001305949 ✨ Cheap Price Your Budget
Hyderabad Call Girls Khairatabad ✨ 7001305949 ✨ Cheap Price Your Budget
 
The transition to renewables in India.pdf
The transition to renewables in India.pdfThe transition to renewables in India.pdf
The transition to renewables in India.pdf
 
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
 
Key Features Of Token Development (1).pptx
Key  Features Of Token  Development (1).pptxKey  Features Of Token  Development (1).pptx
Key Features Of Token Development (1).pptx
 

Mwalls velocity levelup

  • 1. Operations Level Up Mandi Walls Velocity Santa Clara June 18, 2013 Tuesday, June 18, 13
  • 2. whoami • Mandi Walls • @lnxchk • Consultant at Opscode • My 6thVelocity 2 Tuesday, June 18, 13
  • 3. who are you? • Ops? • Devs? • Management? • Other functions: • sales, marketing, foosball,TPS reporting? 3 Tuesday, June 18, 13
  • 4. What is this madness • Part call-to-arms • Part techie hands-on things • Part revival meeting 4 Tuesday, June 18, 13
  • 5. Why Do I Care? 5 http://static6.businessinsider.com/image/4a64e07c4b5437860086a0c9/uh-oh-cond-nast-hires-mckinsey.jpg Tuesday, June 18, 13
  • 7. Evolution of a Practice • Craft Stage • Commercial Stage • Engineering Stage 7 http://www.flickr.com/photos/thaisfraga182/5285413020/sizes/z/in/photostream/ Tuesday, June 18, 13
  • 8. Craft Stage • Hand crafted artisanal organic free range bespoke systems • Lots of personal heroics • Land of the BOFHs 8 Tuesday, June 18, 13
  • 9. Commercial Stage • Folklore written down • Standard procedures emerge • Training begins to occur 9 Tuesday, June 18, 13
  • 10. Engineering Stage • Application of scientific principles • Measurement • Experimentation towards greater efficiency 10 Tuesday, June 18, 13
  • 11. New Workflows • Visibility and planning • Version control and code review • Testing, testing, and more testing • Metrics collection and interpretation Basically, borrow some stuff from Dev 11 http://websites-development.com/sites/default/files/git_branch_strategy.png Tuesday, June 18, 13
  • 12. New Goals • Transparency - are we working on the right things • Reliability - can we keep it running • Resiliency - can we rebuild it? Do we have the technology? • Correctness - are we sure it’s doing what we want it to do 12 Tuesday, June 18, 13
  • 13. New Goals • Transparency - are we working on the right things • Reliability - can we keep it running • Resiliency - can we rebuild it? Do we have the technology? • Correctness - are we sure it’s doing what we want it to do 12 Building Trust Tuesday, June 18, 13
  • 14. More than keeping the lights on. 13 Tuesday, June 18, 13
  • 16. Ops Identity Crisis http://www.flickr.com/photos/muffett68/7214428636/ I don’t write code, I’m a sysadmin 14 Tuesday, June 18, 13
  • 17. Ops Identity Crisis http://www.flickr.com/photos/muffett68/7214428636/ I don’t write code, I’m a sysadmin I have to spend all my time fixing dumb things 14 Tuesday, June 18, 13
  • 18. Ops Identity Crisis http://www.flickr.com/photos/muffett68/7214428636/ I don’t write code, I’m a sysadmin I have to spend all my time fixing dumb things This takes too much time. 14 Tuesday, June 18, 13
  • 19. Ops Identity Crisis http://www.flickr.com/photos/muffett68/7214428636/ I don’t write code, I’m a sysadmin I have to spend all my time fixing dumb things This takes too much time. I’m faster if I don’t have to talk to anyone about what’s going on. 14 Tuesday, June 18, 13
  • 20. Ops Identity Crisis http://www.flickr.com/photos/muffett68/7214428636/ I don’t write code, I’m a sysadmin I have to spend all my time fixing dumb things This takes too much time. These tools are too hard to learn. I will write my own thing. I’m faster if I don’t have to talk to anyone about what’s going on. 14 Tuesday, June 18, 13
  • 21. So, some things to work on • Some tools for mitigating risk • Some processes and tips for making the right thing the easy thing • Increase efficiency, learn some stuff, reevaluate your own work • Don’t be afraid of borrowing from other disciplines 15 Tuesday, June 18, 13
  • 23. Opportunity Cost The value of the things you could be doing while you were shaving that yak 17 Tuesday, June 18, 13
  • 25. RiskVectors • What Ops thinks of as risk • New code, releases, tasks • Other sources of risk • Old products and workflows • Unrepeatable processes • Personal heroics http://www.flickr.com/photos/baresone/4473290629/sizes/z/in/photostream/19 Tuesday, June 18, 13
  • 26. Assessment of Risk • Is your process: • well documented • repeatable • reliable • easy to do right? http://www.flickr.com/photos/lemusgro/5494317161/sizes/z/in/photostream/20 Tuesday, June 18, 13
  • 27. EASY TO DO RIGHT Seriously. I’m not kidding. 21 Tuesday, June 18, 13
  • 28. Hands On • Git and hooks for Ops • Packaging your stuff • Borrowing sanity checks from other places • Basic testing without doing a lot of zomgcoding 22 Tuesday, June 18, 13
  • 29. Hands On • Git and hooks for Ops • Packaging your stuff • Borrowing sanity checks from other places • Basic testing without doing a lot of zomgcoding 22 https://gist.github.com/lnxchk/5791121 Tuesday, June 18, 13
  • 30. Getting Started -Vagrant • Login to your host using ssh • The user is velocity • The password is velocityconf • Vagrant is port-forwarding ssh for you $ ssh -p 2222 velocity@127.0.0.1 23 Tuesday, June 18, 13
  • 31. Getting Started - ec2 • Login to your host using ssh • The user is velocity • The password is velocityconf • Make sure your AWS Security Group allows inbound ssh • You can allow ssh from your EC2 console, under “Security Groups” $ ssh velocity@ec2-N-N-N-N.compute-1.amazonaws.com 24 Tuesday, June 18, 13
  • 32. Getting Started - vbox • If you’re using local virtual box, log in when the guest is initialized • The user is velocity • The password is velocityconf 25 Tuesday, June 18, 13
  • 34. Task 1 - Working with git http://mattbanks.me/wp-content/uploads/2012/07/Git-Logo.png27 Tuesday, June 18, 13
  • 35. Why git • Distributed version control • Everyone gets a copy • Hub/spoke model for sharing • Simple set up • Easy to run a local git server • Other offerings, like github, are pretty awesome too 28 Tuesday, June 18, 13
  • 36. Git server • You have a git server on your lab box • It’s root is in /srv/git • There is one project, bindfiles.git • velocity can use ssh:// to talk to the git server 29 Tuesday, June 18, 13
  • 37. bindfiles • Directory ~velocity/bindfiles is already a git repo for you • The remote origin is localhost • It will use ssh to talk to the local git server • It contains two trivial zonefiles • db.192 • db.local 30 Tuesday, June 18, 13
  • 38. $ cd bindfiles $ cat .git/config bindfiles/.git/config [core] ! repositoryformatversion = 0 ! filemode = true ! bare = false ! logallrefupdates = true [remote "origin"] ! fetch = +refs/heads/*:refs/remotes/origin/* ! url = ssh://localhost/srv/git/bindfiles.git [branch "master"] ! remote = origin ! merge = refs/heads/master Remote origin! 31 Tuesday, June 18, 13
  • 39. $ vi db.192 Edit the db.192 zonefile 32 Tuesday, June 18, 13
  • 40. Add “wat.local” with final octet 24 Add a new host 33 Tuesday, June 18, 13
  • 41. $ git status git status # On branch master # Changed but not updated: # (use "git add <file>..." to update what will be committed) # (use "git checkout -- <file>..." to discard changes in working directory) # #! modified: db.192 # no changes added to commit (use "git add" and/or "git commit -a") 34 Tuesday, June 18, 13
  • 42. git tells you what it wants # Changed but not updated: # (use "git add <file>..." to update what will be committed) # (use "git checkout -- <file>..." to discard changes in working directory) # # modified: db.192 35 Tuesday, June 18, 13
  • 43. $ git add db.192 $ git status git add # On branch master # Changes to be committed: # (use "git reset HEAD <file>..." to unstage) # #! modified: db.192 # 36 Tuesday, June 18, 13
  • 44. git commit • git add stages your changes locally • git commit will write them to your local git repository • add your comment either inline with “-m” or git commit will open a buffer for you 37 git commit -m “this commit is awesome” Tuesday, June 18, 13
  • 45. $ git commit git commit 38 Tuesday, June 18, 13
  • 46. [master 22371ab] Added wat.local to reverse file 1 files changed, 4 insertions(+), 0 deletions(-) $ git status # On branch master # Your branch is ahead of 'origin/master' by 1 commit. # nothing to commit (working directory clean) 39 Tuesday, June 18, 13
  • 47. Making Good Comments • At least explain what you did, Lucy • If there is a ticket somewhere, add that in the comment • If you made multiple changes, call them all out 40 Tuesday, June 18, 13
  • 48. $ git push git push Counting objects: 5, done. Compressing objects: 100% (3/3), done. Writing objects: 100% (3/3), 335 bytes, done. Total 3 (delta 1), reused 0 (delta 0) To ssh://localhost/srv/git/bindfiles.git 06fa560..22371ab master -> master 41 Tuesday, June 18, 13
  • 49. git push • git push sends your changes to the central git server • git pull brings everyone else’s changes into your local repo • Don’t hoard changes; push and pull often 42 Tuesday, June 18, 13
  • 50. Ok? • What did we forget to do? 43 Tuesday, June 18, 13
  • 51. Update the Serial! • Lots of Operations tasks have tribal knowledge you need • Zonefiles have a Serial that needs to be incremented when you make a change • They are potentially outage-causing or hair-pulling problems that can be avoided • Let’s let git remember to do that for us 44 Tuesday, June 18, 13
  • 52. commit hooks • You can put hooks into your git repos • Little tasks that happen at various steps in the process • We can add a pre-commit hook to our bindfiles repo • So you don’t have to remember! Saves time later! Helps junior staff! 45 Tuesday, June 18, 13
  • 53. $ cp /srv/velocity/pre-commit .git/hooks $ cat .git/hooks/pre-commit pre-commit #!/bin/bash num=`git diff master db.192 | grep ^+ | wc | awk '{print $1}'` if [ $num -gt 1 ] ; then serial=`git diff master db.192 | grep -i serial` if [ $? -ne 0 ] ; then echo "You made a change to the zone file but didn't update the Serial value" exit 1; fi fi 46 Tuesday, June 18, 13
  • 54. pre-commit • Rather messy, off-the-cuff example • git diff master db.192 • Looks for changes between what’s in the current master on your local repo • If the db.192 file has changed but the value for Serial is the same, it prints and error and exits with a non-zero return code • git stops processing the commit, saving you headaches later 47 Tuesday, June 18, 13
  • 55. Generalized pre-commit Want it? it’s in the gist! 48 Tuesday, June 18, 13
  • 56. Try it out • Make a change to your reverse file, db.192: move wat.local to .22 • don’t update the serial, see what git does for you • git add db.192 • git commit You made a change to the zone file but didn't update the Serial value Well.That was handy! Fix the zonefile, try it again!Your commit will go through. git push it Feeling hardcore? Update db.local to match, check it in too 49 Tuesday, June 18, 13
  • 57. What else to hook? • Services with config checkers • make a change to the config, run the checker in a hook • nagios, named, apache, etc come with check tools • Other syntax checking • ruby, json, config management tools 50 Tuesday, June 18, 13
  • 58. What else to hook? • Services with config checkers • make a change to the config, run the checker in a hook • nagios, named, apache, etc come with check tools • Other syntax checking • ruby, json, config management tools Make it EASY to do RIGHT 50 Tuesday, June 18, 13
  • 59. Other git things • git clone • gives new team members a working copy of the repo • git branch • Lets you and other team members work on non-prod stuff • Use sparingly; less complexity means more reliable results 51 Tuesday, June 18, 13
  • 60. Task 2: creating packages • How do you get files, apps, stuff deployed on your hosts? • scp -r? • tarballs? • build everything on every host, you gentoo fans? • crash cart? (omg) 52 Tuesday, June 18, 13
  • 61. Packaging • Reap the benefits of what’s built in to your package manager • Versioning • Dependencies • Metadata • Build-once, install-many • File transfer built right into stuff like yum and apt repos! 53 Tuesday, June 18, 13
  • 63. Make it easy: fpm • Creating packages from scratch is tedious • There’s some esoteric stuff in the package managers • You really only need a few things 55 Tuesday, June 18, 13
  • 64. fpm • fpm,“f’ing package managers”! • Jordan Sissell • Creates multiple kinds of packages from various resources • https://github.com/jordansissel/fpm 56 It’s already installed on your lab box! Tuesday, June 18, 13
  • 65. $ fpm -h fpm Intro: This is fpm version 0.4.37 If you think something is wrong, it's probably a bug! :) Please file these here: https://github.com/jordansissel/fpm/issues You can find support on irc (#fpm on freenode irc) or via email with fpm-users@googlegroups.com Usage: fpm [OPTIONS] [ARGS] ... Parameters: [ARGS] ... Inputs to the source package type. For the 'dir' type, this is the files and directories you want to include in the package. For others, like 'gem', it specifies the packages to download and use as the gem input Options: -t OUTPUT_TYPE the type of package you want to create (deb, rpm, solaris, etc) -s INPUT_TYPE the package type to use as input (gem, rpm, python, etc) -C CHDIR Change directory to here before searching for files omg it just keeps going.... 57 Tuesday, June 18, 13
  • 66. Create a package • rpm-ify our zonefiles • They’re in our git repo right now • Live in /var/named for reals • If we package them, we get versioning and other data 58 Tuesday, June 18, 13
  • 67. fpm settings • -s dir : we’re working with raw files rather than a gem, rpm, etc • -t rpm : create an rpm package • -v 1.0 : first version! • --prefix=/var/named : where the files will be installed • -n “zonefiles” : name of the package • --after-install /srv/velocity/restart_named.sh : run this after installing • db* : the files to be packaged $ fpm -s dir -t rpm -v 1.0 --prefix=/var/named -n "zonefiles" --after-install /srv/velocity/restart_named.sh db* 59 Tuesday, June 18, 13
  • 68. $ fpm -s dir -t rpm -v 1.0 --prefix=/var/named -n "zonefiles" --after-install /srv/velocity/restart_named.sh db* Created rpm {:path=>"zonefiles-1.0-1.x86_64.rpm"} $ rpm -qpl zonefiles-1.0-1.x86_64.rpm /var/named/db.192 /var/named/db.local 60 Tuesday, June 18, 13
  • 69. • Nice! • Now we can install it 61 Tuesday, June 18, 13
  • 70. $ sudo rpm -ihv zonefiles-1.0-1.x86_64.rpm Results! Preparing... ########################################### [100%] 1:zonefiles ########################################### [100%] Stopping named: .[ OK ] Starting named: [ OK ] $ dig @localhost -x 192.168.1.22 ;; QUESTION SECTION: ;22.1.168.192.in-addr.arpa.!IN! PTR ;; ANSWER SECTION: 22.1.168.192.in-addr.arpa. 604800 IN! PTR!wat.local. 62 Tuesday, June 18, 13
  • 71. Put the bits together • Your zonefiles are in a git repo • The repo has syntax and error checking pre-commit hooks • The repo can also have packaging and deploy post- commit hooks • Smooth the process, make the right way the easiest way http://www.flickr.com/photos/62904109@N00/2636859006/sizes/z/in/photostream/63 Tuesday, June 18, 13
  • 72. Task 3:Testing • Lots of work in the dev space • TDD, BDD, test, test • Write tests first, prove they fail, write code to make them pass • More risk reduction • Looks scary http://www.flickr.com/photos/nobleup/3995733415/sizes/z/in/photostream/64 Tuesday, June 18, 13
  • 73. basic tests • So, there’s a DNS server on the lab box • What else is here? • Nagios server! http://www.flickr.com/photos/richardmoross/490988453/sizes/z/in/photostream/65 Tuesday, June 18, 13
  • 74. What can we borrow? • Nagios plugins! • Extensive set of checks for all sorts of services • Usable from the command line 66 Tuesday, June 18, 13
  • 75. $ ls /usr/lib64/nagios/plugins nagios plugins check_breeze check_game check_mrtgtraf check_overcr check_swap check_by_ssh check_hpjd check_mysql check_pgsql check_tcp check_clamd check_http check_mysql_query check_ping check_time check_cluster check_icmp check_nagios check_pop check_udp check_dhcp check_ide_smart check_nntp check_procs check_ups check_dig check_imap check_nntps check_real check_users check_disk check_ircd check_nrpe check_rpc check_wave check_disk_smb check_jabber check_nt check_sensors eventhandlers check_dns check_ldap check_ntp check_simap negate check_dummy check_ldaps check_ntp_peer check_smtp urlize check_file_age check_load check_ntp.pl check_snmp utils.pm check_flexlm check_log check_ntp_time check_spop utils.sh check_fping check_mailq check_nwstat check_ssh check_ftp check_mrtg check_oracle check_ssmtp 67 Tuesday, June 18, 13
  • 76. $ ls /usr/lib64/nagios/plugins nagios plugins check_breeze check_game check_mrtgtraf check_overcr check_swap check_by_ssh check_hpjd check_mysql check_pgsql check_tcp check_clamd check_http check_mysql_query check_ping check_time check_cluster check_icmp check_nagios check_pop check_udp check_dhcp check_ide_smart check_nntp check_procs check_ups check_dig check_imap check_nntps check_real check_users check_disk check_ircd check_nrpe check_rpc check_wave check_disk_smb check_jabber check_nt check_sensors eventhandlers check_dns check_ldap check_ntp check_simap negate check_dummy check_ldaps check_ntp_peer check_smtp urlize check_file_age check_load check_ntp.pl check_snmp utils.pm check_flexlm check_log check_ntp_time check_spop utils.sh check_fping check_mailq check_nwstat check_ssh check_ftp check_mrtg check_oracle check_ssmtp 67 Tuesday, June 18, 13
  • 77. $ ls /usr/lib64/nagios/plugins nagios plugins check_breeze check_game check_mrtgtraf check_overcr check_swap check_by_ssh check_hpjd check_mysql check_pgsql check_tcp check_clamd check_http check_mysql_query check_ping check_time check_cluster check_icmp check_nagios check_pop check_udp check_dhcp check_ide_smart check_nntp check_procs check_ups check_dig check_imap check_nntps check_real check_users check_disk check_ircd check_nrpe check_rpc check_wave check_disk_smb check_jabber check_nt check_sensors eventhandlers check_dns check_ldap check_ntp check_simap negate check_dummy check_ldaps check_ntp_peer check_smtp urlize check_file_age check_load check_ntp.pl check_snmp utils.pm check_flexlm check_log check_ntp_time check_spop utils.sh check_fping check_mailq check_nwstat check_ssh check_ftp check_mrtg check_oracle check_ssmtp Hey! A DNS Checker! 67 Tuesday, June 18, 13
  • 78. check_dns • We can use these plugins to test out what we’re doing • Don’t require any additional frameworks or scary things • Many of them work just fine over the network, too 68 Tuesday, June 18, 13
  • 79. $ /usr/lib64/nagios/plugins/check_dns -h Check DNS check_dns v1.4.16 (nagios-plugins 1.4.16) Copyright (c) 1999 Ethan Galstad <nagios@nagios.org> Copyright (c) 2000-2008 Nagios Plugin Development Team ! <nagiosplug-devel@lists.sourceforge.net> This plugin uses the nslookup program to obtain the IP address for the given host/domain query. An optional DNS server to use may be specified. If no DNS server is specified, the default server(s) specified in /etc/resolv.conf will be used. Usage: check_dns -H host [-s server] [-a expected-address] [-A] [-t timeout] [-w warn] [-c crit] 69 Tuesday, June 18, 13
  • 80. $ check_dns -H box.local -s 127.0.0.1 -a 192.168.1.21 When check_dns is ok DNS OK: 0.004 seconds response time. box.local returns 192.168.1.21|time=0.004142s;;;0.000000 $ echo $? 0 70 Tuesday, June 18, 13
  • 81. $ check_dns -H box.local -s 127.0.0.1 -a 192.168.1.22 check_dns errors DNS CRITICAL - expected '192.168.1.22' but got '192.168.1.21' $ echo $? 2 71 Tuesday, June 18, 13
  • 82. cool • Now we have a way to test our changes • Behaves in a predictable way • Now let’s add one more component: a test harness 72 Tuesday, June 18, 13
  • 83. Task 4: testing with bats • Bash Automated Testing System • Like all good tools, bats is impossible to google • https://github.com/sstephenson/bats omg these are adorable. http://www.flickr.com/photos/37539972@N06/3980094382/sizes/z/in/photostream/ 73http://www.etsy.com/shop/theitsybitsyspider Tuesday, June 18, 13
  • 84. What the bats • Allows you to test that UNIX programs do what you expect • Write stuff in bash to test other system commands • Easy to get hold of return codes, output • Let’s see an example: checking the nagios configs 74 Tuesday, June 18, 13
  • 85. $ bats /srv/velocity/nagios.bats Using bats 1..1 ok 1 nagios is all good 75 Tuesday, June 18, 13
  • 86. $ bats /srv/velocity/nagios.bats Using bats 1..1 ok 1 nagios is all good 75 Tuesday, June 18, 13
  • 87. $ bats /srv/velocity/nagios.bats Using bats 1..1 ok 1 nagios is all good Ran one test 75 Tuesday, June 18, 13
  • 88. $ bats /srv/velocity/nagios.bats Using bats 1..1 ok 1 nagios is all good Ran one test 75 Tuesday, June 18, 13
  • 89. $ bats /srv/velocity/nagios.bats Using bats 1..1 ok 1 nagios is all good Ran one test All good! 75 Tuesday, June 18, 13
  • 90. $ cat /srv/velocity/nagios.bats #!/usr/bin/env bats @test "nagios is all good" { result="$(sudo service nagios checkconfig)" [ "$?" -eq 0 ] } 76 Tuesday, June 18, 13
  • 91. $ cat /srv/velocity/nagios.bats #!/usr/bin/env bats @test "nagios is all good" { result="$(sudo service nagios checkconfig)" [ "$?" -eq 0 ] } 76 Tuesday, June 18, 13
  • 92. $ cat /srv/velocity/nagios.bats #!/usr/bin/env bats @test "nagios is all good" { result="$(sudo service nagios checkconfig)" [ "$?" -eq 0 ] } Run a system command! 76 Tuesday, June 18, 13
  • 93. $ cat /srv/velocity/nagios.bats #!/usr/bin/env bats @test "nagios is all good" { result="$(sudo service nagios checkconfig)" [ "$?" -eq 0 ] } Run a system command! 76 Tuesday, June 18, 13
  • 94. $ cat /srv/velocity/nagios.bats #!/usr/bin/env bats @test "nagios is all good" { result="$(sudo service nagios checkconfig)" [ "$?" -eq 0 ] } Run a system command! Check the return code! 76 Tuesday, June 18, 13
  • 95. $ cat /srv/velocity/nagios.bats #!/usr/bin/env bats @test "nagios is all good" { result="$(sudo service nagios checkconfig)" [ "$?" -eq 0 ] } Run a system command! Check the return code! 76 Tuesday, June 18, 13
  • 96. $ cat /srv/velocity/nagios.bats #!/usr/bin/env bats @test "nagios is all good" { result="$(sudo service nagios checkconfig)" [ "$?" -eq 0 ] } Run a system command! Check the return code! Also grabs output, but we don’t need that here 76 Tuesday, June 18, 13
  • 97. We can do this! http://www.flickr.com/photos/usnationalarchives/3678696585/ 77 Tuesday, June 18, 13
  • 98. Task 5:All together 1. write a new bats test so it fails 2. make the changes to our zonefiles 1. check them in with git, build our package, install it 3. re-run our bats test to prove it passes 4. Win. Let’s say we have a task to add velocity.local / 192.168.1.24 to our zone 78 Tuesday, June 18, 13
  • 99. $ cd ~/bindfiles $ mkdir tests $ vi tests/velocity.bats 1: bats test • What to test? • Forward lookup : velocity.bats • Backwards lookup : 192.168.1.24 • Use the check_dns nagios plugin 79 Tuesday, June 18, 13
  • 100. velocity.bats #!/usr/bin/env bats @test "velocity.local forward lookup is good" { /usr/lib64/nagios/plugins/check_dns -H velocity.local -s 127.0.0.1 -a 192.168.1.24 [ "$?" -eq 0 ] } @test "velocity.local reverse lookup is good" { /usr/lib64/nagios/plugins/check_dns -H 192.168.1.24 -s 127.0.0.1 -a velocity.local. [ "$?" -eq 0 ] } 80 Tuesday, June 18, 13
  • 101. $ bats testing/velocity.bats Pre-test fails 1..2 not ok 1 velocity.local forward lookup is good # /home/velocity/bindfiles/tests/velocity.bats:4 # Domain velocity.local was not found by the server not ok 2 velocity.local reverse lookup is good # /home/velocity/bindfiles/tests/velocity.bats:9 # Domain 192.168.1.24 was not found by the server 81 Tuesday, June 18, 13
  • 102. $ git add tests $ git commit -m "Adding bats testing" $ git push Check the tests in • Matter of preference, checking the new tests directory in first 82 Tuesday, June 18, 13
  • 103. $ vi db.192 2: Make your DNS changes ... ; also list other computers 21 IN PTR box.local. 22 IN PTR wat.local. 24 IN PTR velocity.local. 83 Tuesday, June 18, 13
  • 104. $ vi db.192 2: Make your DNS changes ... ; also list other computers 21 IN PTR box.local. 22 IN PTR wat.local. 24 IN PTR velocity.local. Update your Serial too! Or don’t; pre-commit will know! 83 Tuesday, June 18, 13
  • 105. $ vi db.local .... ;also list other computers box IN A 192.168.1.21 wat IN A 192.168.1.22 velocity IN A 192.168.1.24 84 Tuesday, June 18, 13
  • 106. $ vi db.local .... ;also list other computers box IN A 192.168.1.21 wat IN A 192.168.1.22 velocity IN A 192.168.1.24 Update your Serial too! Or don’t; pre-commit will know! 84 Tuesday, June 18, 13
  • 107. $ git add db.* $ git commit -m “Adding velocity.local” $ git push 85 Tuesday, June 18, 13
  • 108. $ fpm -s dir -t rpm -v 1.2 --prefix=/var/named -n "zonefiles" --after-install /srv/velocity/restart_named.sh db* 3: Build the zonefiles rpm Created rpm {:path=>"zonefiles-1.2-1.x86_64.rpm"} $ sudo rpm -Uhv zonefiles-1.2-1.x86_64.rpm Preparing... ########################################### [100%] 1:zonefiles ########################################### [100%] Stopping named: [ OK ] Starting named: [ OK ] 86 Tuesday, June 18, 13
  • 109. $ bats tests/velocity.bats 4: Re-run your tests 1..2 ok 1 velocity.local forward lookup is good ok 2 velocity.local reverse lookup is good 87 Tuesday, June 18, 13
  • 110. How about that • We wrote a test first, before making changes • The test fails before the changes are made! • Make the changes • Run the test again, it succeeds! 88 http://www.coolfbcovers.net/wp-content/uploads/2013/05/Success-Kid.jpg Tuesday, June 18, 13
  • 111. Our Goals:Transparency • Are we working on something that adds value? 89 Tuesday, June 18, 13
  • 112. Our Goals: Reliability • Does our new process keep things running? 90 Tuesday, June 18, 13
  • 113. Our Goals: Resiliency • Does our new process make it easy to rebuild, recover, scale? 91 Tuesday, June 18, 13
  • 114. Our Goals: Correctness • Does our new process ensure that the work we’re doing is correct? 92 Tuesday, June 18, 13
  • 115. Building from here 93 http://www.flickr.com/photos/kalmyket/691478431/sizes/z/in/photostream/ Tuesday, June 18, 13
  • 116. Configuration Management • USE IT • Yes, there is a learning curve • Yes, it will be worth it in the long run 94 Tuesday, June 18, 13
  • 117. Logging • Big Data and Business Intelligence analytics are everywhere • Logs have value to Ops, Dev, BizDev, Marketing, etc • Tools like logstash help you put together better pipeline • http://logstash.net 95 Tuesday, June 18, 13
  • 118. Metrics • We’ve seen lots of talks about metrics atVelocity • statsd • graphite • Learn you some R • Metrics also have value to groups outside of Ops 96 Tuesday, June 18, 13
  • 119. Monitoring • Monitor all, alert few • Check out Monitorama, a conference and emerging community around monitoring • http://monitorama.com 97 Tuesday, June 18, 13
  • 120. GetVirtual • Do more real-world testing • vagrant, vbox, cloud providers • Make Dev and QA really look like prod 98 Tuesday, June 18, 13
  • 121. Next Fostering innovation by making resources available 99 Tuesday, June 18, 13
  • 122. Takeaways • Reliable, repeatable processes • Make stuff easy to do right • Reduce risk of mistakes, misunderstandings • Reduce the need for personal heroics http://www.flickr.com/photos/ginnerobot/2877212845/sizes/z/in/photostream/100 Tuesday, June 18, 13
  • 123. Thanks! • Thanks for your kind attention • Please keep the conversation going with your teams 101 Tuesday, June 18, 13