DockerCon14 Automated Chef Cookbook Testing

Preview:

Citation preview

Automated Chef cookbook testing with Drone.IO and

Github

paul.czarkowski@rackspace.com@pczarkowski

$ whoami pczarkowski

$ whoami pczarkowski

$ whoami pczarkowski

$ whoami pczarkowski

I <3 Docker

0.20

ZNCaaS

Openstack - Dockenstack, Nova-Docker, Solum

http://tech.paulczar.nethttp://github.com/paulczarhttps://index.docker.io/u/paulczar/

Chef Cookbook - Docker

Installs Docker

http://community.opscode.com/cookbooks/dockerhttps://github.com/bflad/chef-docker

Chef Cookbook - Docker

Run your own Registry

http://community.opscode.com/cookbooks/docker

Chef Cookbook - Docker

Backup container

http://community.opscode.com/cookbooks/docker

Chef Cookbook - Docker

just like trusted builds, only cheffy.

http://community.opscode.com/cookbooks/docker

Using Chef in Dockerfile

Run chef-solo in Dockerfile

EZBake

Converge Container on the fly

http://community.opscode.com/cookbooks/docker

Knife container

?

What is Drone ?

http://drone.iohttp://github.com/drone/drone

SaaS or Self HostedWritten in GoUses Docker to run tests/builds

How it works ?

Watches git repo containing `.drone.yml`

Clones repo on `git push`

Creates Docker image

How it works ?

Runs Docker image

Runs a series of commands

Performs action based on result

Why use Drone ?

Same tooling for both Public and Private

Ultra fast - Docker FTW

Opensource

It’s not all rainbows and unicorns

Local user auth only

Single server

UI and Documentation

Installing Drone

https://github.com/justincampbell/chef-drone

Installs drone via chef

Installing Drone

$ curl get.docker.io | bash

$ wget http://downloads.drone.io/latest/drone.deb

$ sudo dpkg -i drone.deb

Configuring Drone

http://drone.example.com/install

https://github.com/settings/applications/new

Oauth Proxy

https://github.com/movableink/doorman

.drone.yml

.drone.yml

.drone.yml

Drone CLI

$ drone build /tmp/example_application

parses .drone.yml

performs build

drone-wall

https://github.com/drone/drone-wall

As a NoOp I need a development workflow with automated CI for building reliable infrastructure using chef cookbooks for my DevOps environment.

“Chef cookbooks are code.”

culture, culture, something,learning organization, something,

devops...

Chef Community Testing Ecosystem

http://icanhazwordcloud.io

Test your Cookbooks

STYLE / SYNTAX tests

UNIT tests

INTEGRATION tests

Shameless plug… Meez

A tool I wrote … to scratch an itch.

generates a chef cookbook with plumbing for all the testing tools in the previous slides … and more.

Generate a testable cookbook

Run tests!

Short feedback loops

Guard: run tests every change

Git Hooks: refuse to commit if failed tests

Self Discipline!

Chef cookbooks are code.

Use Source Controlhttp://github.com

SaaS or Self Hosted

Github Pull Request Workflow

Questions ?

THANKYOU!

@pczarkowski

paul.czarkowski@rackspace.com

Recommended