SlideShare a Scribd company logo
Whatdo I dowith my
hands
Andwhyis my
posture so bad
ByJamieWinsor
3.0 released
April13th 2014
berkshelf
Chef Cookbook manager and
dependency resolver
» Retrieve a cookbooks
dependencies
» Package cookbooks and
their dependencies
» Author new cookbooks
Chef conf-2014
Chef conf-2014
BerkshelfCoreTeam
» Jamie Winsor <jamie@vialstudios.com>
» Seth Vargo <sethvargo@gmail.com>
» Michael Ivey <michael.ivey@riotgames.com>
Chef conf-2014
Chef conf-2014
The BerkshelfWay
» Introduction to Chef Cookbooks
» Introduction to Cookbook Patterns
» Best practices in
» Cookbook development
» Cookbook management
» Avoiding pitfalls
» How to iterate quickly
Last year I gave a talk at ChefConf called The
“Berkshelf
doesn'twork
for my
workflow”
A lot of smart people
“Uhhh...yeah it
does”
Me
Automation is dangerous unless
» It is portable
» It is repeatable
» It is predictable
Ifit's notthetool
whatis it?
Software doesn't
solve problems.
People do.
“Ifyou putthe right
people inthe right
roomthey'llsolve
the problemthe
rightway”
Jeff Hackert
Yourworkflowmightneed
to change
DevOps isasoftware
developmentpattern
DevOps is not
» A position
» A team
» A department
» Or an organization
“Disruptive startup
is hiring DevOps
ninjas”
LinkedIn Spammer
Chef conf-2014
ComingTogether
The BerkshelfVision
Howdowe createa
self contained
release?
The 3 Requirements For Self
Contained Releases
1.Software Artifact (berkshelf-api.tar.gz)
2.Cookbook Artifact (berkshelf-api-cookbooks.tar.gz)
3.Installation | Upgrade | Configuration Docs
Ifyou'readeveloper
Give these three things to your Operators for every
release.
Ifyou'rean Operator
You should be receiving these three things for every
release.
Ifyou're both,
Throw a fucking pizza party
Withthose 3thingsyou can
» Build a new environment with a specific version
» Upgrade pre-existing environments
» Promote through logical environments
(Dev, Stage, Production)
Automation is dangerous unless
» It is portable
» It is repeatable
» It is predictable
Putthose 3things in
anartifactserver
ArtifactServers
» Github | Github Enterprise
» Sonatype's Nexus
» Artifactory
» Basic Auth HTTP Server (sadface)
(https://artifacts.myorg.com/myapp/1.2.3/
myapp.tar.gz)
Github Releasesand
ReleaseAssets
Chef conf-2014
Chef conf-2014
Generatingyour
releaseartifacts
The SoftwareArtifact
1.Bump version
2.Compile w/ dependencies
3.Test
4.Package
(myapp.tar.gz)
The CookbookArtifact
Pre-requisites
» Resides in the same repository as your software
» Shares the same version number as your compiled
software
» Deploys an archive of the software matching the
cookbook's version (by default)
» Follows the Environment Cookbook pattern
EnvironmentCookbook
» Nearly identical to an Application Cookbook
» Has it's Berksfile.lock committed into version
control
Generate an environment cookbook with:
$ berks cookbook {myapp} --pattern environment
How does itwork?
The Berksfile.lock is distributed with the cookbook
so it can be "applied" to a Chef Environment
$ berks apply berks-api-dev -b ~/Downloads/berkshelf-api/Berksfile.lock
This sets an equality lock in the Chef Environment
(berks-api-dev) for each cookbook in the lockfile
Berkshelf-API Server Example
» Code in lib/
» Binaries in bin/
» Cookbook in cookbook/
» cookbook/Berksfile.lock present in version control
$ cat cookbook/metadata.rb
lib = File.expand_path('../../lib', __FILE__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require 'berkshelf/api/version'
name "berkshelf-api"
maintainer "Jamie Winsor"
maintainer_email "jamie@vialstudios.com"
license "Apache 2.0"
description "Installs/Configures a berkshelf-api server"
long_description "Installs/Configures a berkshelf-api server"
version Berkshelf::API::VERSION
Or with a VERSION file at the root of your
application
$ cat cookbook/metadata.rb
name "some-app"
maintainer "Jamie Winsor"
maintainer_email "jamie@vialstudios.com"
version File.read(File.expand_path("../../VERSION", __FILE__))
# ...other metadata...
$ cat cookbook/attributes/default.rb
#
# Cookbook Name:: berkshelf-api
# Attribute:: default
#
default[:berkshelf_api][:release] =
"v#{Berkshelf::API::Chef.cookbook_version(run_context)}"
$ cat cookbook/libraries/berkshelf_api.rb
#
# Cookbook Name:: berkshelf-api
# Libraries:: berkshelf_api
#
module Berkshelf
module API
module Chef
class << self
# Returns the version of the loaded berkshelf-api cookbook
#
# @param [Chef::RunContext] context
#
# @return [String]
def cookbook_version(context)
context.cookbook_collection["berkshelf-api"].version
end
end
end
end
end
Generatingthe Cookbookartifact
$ cd cookbook/
$ berks package
Cookbook(s) packaged to cookbooks-1397345842.tar.gz
Thearchive contains
» The Berksfile.lock from resolution
» A cookbooks directory containing each cookbook
found in the Berksfile.lock
How do I gettheartifacts intoa
Github release?
» Octokit & Rake/Thor
» Create a release manually and attach the asset
(boo.)
Howdo I getthe
artifacts out?
Github Cookbook
Provides an LWRP for downloading
» An asset from a Github release
» An archive containing source code from a tag,
branch, or revision
Libarchive Cookbook
Provides an LWRP for idempotently extracting archives
$ cat cookbook/metadata.rb
name "berkshelf-api"
maintainer "Jamie Winsor"
maintainer_email "jamie@vialstudios.com"
# ... other metadata ...
depends "github"
depends "libarchive"
depends "build-essential", "~> 2.0"
$ cat cookbook/recipes/app.rb
node.set[:'build-essential'][:compile_time] = true
include_recipe "build-essential::default"
asset = github_asset "berkshelf-api.tar.gz" do
repo "berkshelf/berkshelf-api"
release "v1.2.1"
end
libarchive_file "berkshelf-api.tar.gz" do
path asset.asset_path
extract_to "/opt/berkshelf-api/v1.2.1"
owner "berkshelf"
group "berkshelf"
action :extract
notifies :restart, "runit_service[berks-api]"
only_if { ::File.exist?(asset.asset_path) }
end
The StorySo Far
» We have an encapsulated release containing
» A software artifact
» A cookbook artifact
» And you wrote and committed a README containing
installation/configuration instructions
» It's located on an artifact server
» Bonus round: The release is also tied to the
version control ref it was built from
Solving Distribution
Berkflow
ACookbook-Centric
Deploymentworkflowtool
InstallBerkflowwith Chef-DK
$ sudo chef gem install berkflow
$ export PATH=/opt/chefdk/embedded/bin:$PATH
$ which blo
/opt/chefdk/embedded/bin/blo
Install with sudo for now:
(https://github.com/opscode/chef-dk/issues/11)
"Install"the cookbookartifact
intoyour ChefServer
$ blo install https://github.com/berkshelf/berkshelf-api/releases/download/v1.2.1/cookbooks.tar.gz
"Upgrading"aChefEnvironment
$ blo upgrade berks-api-dev berkshelf-api 1.2.1
Or upgrade to latest
$ blo upgrade berks-api-dev berkshelf-api latest
One Button Upgrade
WannaMake Games?
http://undeadlabs.com/jobs/
» Game Programmer
» Game Producer
» Game Animator
» Game Designer
ExternalResources
» http://berkshelf.com
» http://getchef.com/downloads/chef-dk
» https://github.com/berkshelf/berkshelf
» https://github.com/berkshelf/berkshelf-api
» https://github.com/reset/berkflow
» https://github.com/reset/libarchive-cookbook
» https://github.com/reset/github-cookbook
JamieWinsor
@resetexistence
github.com/reset

More Related Content

PPTX
Chef Cookbook Design Patterns
PPT
Chef, Devops, and You
PDF
Infrastructure Automation with Chef
PPTX
Chef introduction
PDF
Automating your infrastructure with Chef
PPTX
Introduction to chef
PDF
Growing Pains with Chef – a Tale of DevOps in a Large Organization
PDF
Server Installation and Configuration with Chef
Chef Cookbook Design Patterns
Chef, Devops, and You
Infrastructure Automation with Chef
Chef introduction
Automating your infrastructure with Chef
Introduction to chef
Growing Pains with Chef – a Tale of DevOps in a Large Organization
Server Installation and Configuration with Chef

What's hot (20)

PDF
Docker Docker Docker Chef
ODP
Introduction to Chef
PDF
Chef-Zero & Local Mode
PDF
The unintended benefits of Chef
PDF
Learning chef
PDF
Chef Fundamentals Training Series Module 1: Overview of Chef
PPTX
Chef Tutorial for DEVOPS Newbies
KEY
Cooking with Chef
PDF
Chef Fundamentals Training Series Module 2: Workstation Setup
PPTX
Infrastructure Automation with Chef & Ansible
PDF
Community Cookbooks & further resources - Fundamentals Webinar Series Part 6
PDF
PDF
Automating Infrastructure with Chef
PDF
Docker
PPTX
Vagrant and Chef on FOSSASIA 2014
PPTX
CLUG 2014-10 - Cookbook CI with Jenkins
PPTX
Opscode Webinar: Managing Your VMware Infrastructure with Chef
PDF
Chef Fundamentals Training Series Module 4: The Chef Client Run and Expanding...
PDF
Chef Fundamentals Training Series Module 6: Roles, Environments, Community Co...
PPTX
Testing for infra code using test-kitchen,docker,chef
Docker Docker Docker Chef
Introduction to Chef
Chef-Zero & Local Mode
The unintended benefits of Chef
Learning chef
Chef Fundamentals Training Series Module 1: Overview of Chef
Chef Tutorial for DEVOPS Newbies
Cooking with Chef
Chef Fundamentals Training Series Module 2: Workstation Setup
Infrastructure Automation with Chef & Ansible
Community Cookbooks & further resources - Fundamentals Webinar Series Part 6
Automating Infrastructure with Chef
Docker
Vagrant and Chef on FOSSASIA 2014
CLUG 2014-10 - Cookbook CI with Jenkins
Opscode Webinar: Managing Your VMware Infrastructure with Chef
Chef Fundamentals Training Series Module 4: The Chef Client Run and Expanding...
Chef Fundamentals Training Series Module 6: Roles, Environments, Community Co...
Testing for infra code using test-kitchen,docker,chef
Ad

Similar to Chef conf-2014 (20)

PPTX
Automate your Development Environment with Vagrant & Chef
PDF
Atmosphere 2014
PPTX
Vagrant, Chef and TYPO3 - A Love Affair
PPTX
Public Supermarket: The Insider's Tour
PDF
2013-08-27 Chef-Boston Meetup - Using Berkshelf
KEY
Avoiding surprises with Chef and Vagrant
PPTX
Cooking the Cake for Nuget packages
PDF
2015 08-11-scdo-meetup
KEY
Using Vagrant
PDF
The Scientific Filesystem
PDF
Make an Instant Website with Webhooks
PDF
PuppetCamp SEA 1 - Using Vagrant, Puppet, Testing & Hadoop
PDF
Using Vagrant, Puppet, Testing & Hadoop
PDF
PuppetCamp SEA 1 - Using Vagrant, Puppet, Testing & Hadoop
PDF
Chef for beginners module 5
PPTX
Chef advance
PPTX
Chef advance
PDF
Cloud Automation with Opscode Chef
PDF
Chef basics - write infrastructure as code
PDF
Testing your-automation-code (vagrant version) v0.2
Automate your Development Environment with Vagrant & Chef
Atmosphere 2014
Vagrant, Chef and TYPO3 - A Love Affair
Public Supermarket: The Insider's Tour
2013-08-27 Chef-Boston Meetup - Using Berkshelf
Avoiding surprises with Chef and Vagrant
Cooking the Cake for Nuget packages
2015 08-11-scdo-meetup
Using Vagrant
The Scientific Filesystem
Make an Instant Website with Webhooks
PuppetCamp SEA 1 - Using Vagrant, Puppet, Testing & Hadoop
Using Vagrant, Puppet, Testing & Hadoop
PuppetCamp SEA 1 - Using Vagrant, Puppet, Testing & Hadoop
Chef for beginners module 5
Chef advance
Chef advance
Cloud Automation with Opscode Chef
Chef basics - write infrastructure as code
Testing your-automation-code (vagrant version) v0.2
Ad

Recently uploaded (20)

PDF
EaseUS PDF Editor Pro 6.2.0.2 Crack with License Key 2025
PDF
MCP Security Tutorial - Beginner to Advanced
PDF
Ableton Live Suite for MacOS Crack Full Download (Latest 2025)
PPTX
Trending Python Topics for Data Visualization in 2025
PPTX
Weekly report ppt - harsh dattuprasad patel.pptx
PDF
AI/ML Infra Meetup | Beyond S3's Basics: Architecting for AI-Native Data Access
PPTX
GSA Content Generator Crack (2025 Latest)
PPTX
Computer Software and OS of computer science of grade 11.pptx
PPTX
Custom Software Development Services.pptx.pptx
PDF
How AI/LLM recommend to you ? GDG meetup 16 Aug by Fariman Guliev
PDF
AI/ML Infra Meetup | LLM Agents and Implementation Challenges
PPTX
WiFi Honeypot Detecscfddssdffsedfseztor.pptx
PDF
Wondershare Recoverit Full Crack New Version (Latest 2025)
PPTX
Log360_SIEM_Solutions Overview PPT_Feb 2020.pptx
PPTX
Introduction to Windows Operating System
PPTX
Why Generative AI is the Future of Content, Code & Creativity?
PPTX
Monitoring Stack: Grafana, Loki & Promtail
PDF
Autodesk AutoCAD Crack Free Download 2025
PDF
AI-Powered Threat Modeling: The Future of Cybersecurity by Arun Kumar Elengov...
PDF
STL Containers in C++ : Sequence Container : Vector
EaseUS PDF Editor Pro 6.2.0.2 Crack with License Key 2025
MCP Security Tutorial - Beginner to Advanced
Ableton Live Suite for MacOS Crack Full Download (Latest 2025)
Trending Python Topics for Data Visualization in 2025
Weekly report ppt - harsh dattuprasad patel.pptx
AI/ML Infra Meetup | Beyond S3's Basics: Architecting for AI-Native Data Access
GSA Content Generator Crack (2025 Latest)
Computer Software and OS of computer science of grade 11.pptx
Custom Software Development Services.pptx.pptx
How AI/LLM recommend to you ? GDG meetup 16 Aug by Fariman Guliev
AI/ML Infra Meetup | LLM Agents and Implementation Challenges
WiFi Honeypot Detecscfddssdffsedfseztor.pptx
Wondershare Recoverit Full Crack New Version (Latest 2025)
Log360_SIEM_Solutions Overview PPT_Feb 2020.pptx
Introduction to Windows Operating System
Why Generative AI is the Future of Content, Code & Creativity?
Monitoring Stack: Grafana, Loki & Promtail
Autodesk AutoCAD Crack Free Download 2025
AI-Powered Threat Modeling: The Future of Cybersecurity by Arun Kumar Elengov...
STL Containers in C++ : Sequence Container : Vector

Chef conf-2014