Atmosphere 2014
-
Upload
jamie-winsor -
Category
Technology
-
view
924 -
download
2
Transcript of Atmosphere 2014
![Page 1: Atmosphere 2014](https://reader035.fdocuments.in/reader035/viewer/2022081516/554a337db4c90520578b5368/html5/thumbnails/1.jpg)
Holy shit the Polish know how to drink. I hope nobody can tell that I'm still drunk from last nightBy Jamie Winsor
![Page 2: Atmosphere 2014](https://reader035.fdocuments.in/reader035/viewer/2022081516/554a337db4c90520578b5368/html5/thumbnails/2.jpg)
![Page 3: Atmosphere 2014](https://reader035.fdocuments.in/reader035/viewer/2022081516/554a337db4c90520578b5368/html5/thumbnails/3.jpg)
Berkshelf Core Team» Jamie Winsor <[email protected]>
» Seth Vargo <[email protected]>
» Michael Ivey <[email protected]>
![Page 4: Atmosphere 2014](https://reader035.fdocuments.in/reader035/viewer/2022081516/554a337db4c90520578b5368/html5/thumbnails/4.jpg)
berkshelfChef Cookbook manager and dependency resolver
» Retrieve a cookbooks dependencies
» Package cookbooks and their dependencies
» Author new cookbooks
![Page 5: Atmosphere 2014](https://reader035.fdocuments.in/reader035/viewer/2022081516/554a337db4c90520578b5368/html5/thumbnails/5.jpg)
» League of Legends
» Guild Wars 2
» TERA
» Lord of The Rings Online
» Dungeons and Dragons Online
» Asheron's Call
![Page 6: Atmosphere 2014](https://reader035.fdocuments.in/reader035/viewer/2022081516/554a337db4c90520578b5368/html5/thumbnails/6.jpg)
![Page 7: Atmosphere 2014](https://reader035.fdocuments.in/reader035/viewer/2022081516/554a337db4c90520578b5368/html5/thumbnails/7.jpg)
"Deploy Windows"
![Page 8: Atmosphere 2014](https://reader035.fdocuments.in/reader035/viewer/2022081516/554a337db4c90520578b5368/html5/thumbnails/8.jpg)
Risk Mitigation
![Page 9: Atmosphere 2014](https://reader035.fdocuments.in/reader035/viewer/2022081516/554a337db4c90520578b5368/html5/thumbnails/9.jpg)
Introducing change into a system is a synonym for introducing risk
![Page 10: Atmosphere 2014](https://reader035.fdocuments.in/reader035/viewer/2022081516/554a337db4c90520578b5368/html5/thumbnails/10.jpg)
Not deploying is a risk, too
![Page 11: Atmosphere 2014](https://reader035.fdocuments.in/reader035/viewer/2022081516/554a337db4c90520578b5368/html5/thumbnails/11.jpg)
Q. What?A. Graphing the risk of multiple changes over time isn't linear
![Page 12: Atmosphere 2014](https://reader035.fdocuments.in/reader035/viewer/2022081516/554a337db4c90520578b5368/html5/thumbnails/12.jpg)
Risk is exponentially greaterirb> changes = ChangeSet.newirb> changes.add Change.newirb> changes.risk_level=> 1irb> 5.times doirb> changes.add Change.newirb> endirb> changes.risk_level=> 46656
Risk Level: 6 ^ 6
![Page 13: Atmosphere 2014](https://reader035.fdocuments.in/reader035/viewer/2022081516/554a337db4c90520578b5368/html5/thumbnails/13.jpg)
Not deploying at 5pm isn't Robbing peter to pay paul
![Page 14: Atmosphere 2014](https://reader035.fdocuments.in/reader035/viewer/2022081516/554a337db4c90520578b5368/html5/thumbnails/14.jpg)
Not deploying at 5PM is:1.Killing Peter
a. Framing it as a suicideb. Making his wife your wifec. Stealing his entire family inheritenced. Telling his children you're their new dade. Defecating on his grave
To pay Paul
![Page 15: Atmosphere 2014](https://reader035.fdocuments.in/reader035/viewer/2022081516/554a337db4c90520578b5368/html5/thumbnails/15.jpg)
When should we deploy?
![Page 16: Atmosphere 2014](https://reader035.fdocuments.in/reader035/viewer/2022081516/554a337db4c90520578b5368/html5/thumbnails/16.jpg)
![Page 17: Atmosphere 2014](https://reader035.fdocuments.in/reader035/viewer/2022081516/554a337db4c90520578b5368/html5/thumbnails/17.jpg)
Yeah, I'm gonna release it at 5PM on a Friday.
![Page 18: Atmosphere 2014](https://reader035.fdocuments.in/reader035/viewer/2022081516/554a337db4c90520578b5368/html5/thumbnails/18.jpg)
Deploy WindowsA clear indicator that your release process is broken
![Page 19: Atmosphere 2014](https://reader035.fdocuments.in/reader035/viewer/2022081516/554a337db4c90520578b5368/html5/thumbnails/19.jpg)
What about the risk?That's why we have deploy windows
![Page 20: Atmosphere 2014](https://reader035.fdocuments.in/reader035/viewer/2022081516/554a337db4c90520578b5368/html5/thumbnails/20.jpg)
They exist because
Deployment was an afterthoughtAnd it's within your power to control deployment times to reduce risk
![Page 21: Atmosphere 2014](https://reader035.fdocuments.in/reader035/viewer/2022081516/554a337db4c90520578b5368/html5/thumbnails/21.jpg)
That software doesn't even want to be deployed
![Page 22: Atmosphere 2014](https://reader035.fdocuments.in/reader035/viewer/2022081516/554a337db4c90520578b5368/html5/thumbnails/22.jpg)
Just Deploy Already
![Page 23: Atmosphere 2014](https://reader035.fdocuments.in/reader035/viewer/2022081516/554a337db4c90520578b5368/html5/thumbnails/23.jpg)
How do we reduce riskwhile still allowing for change
![Page 24: Atmosphere 2014](https://reader035.fdocuments.in/reader035/viewer/2022081516/554a337db4c90520578b5368/html5/thumbnails/24.jpg)
Continuous Delivery & DevopsTo the rescue
![Page 25: Atmosphere 2014](https://reader035.fdocuments.in/reader035/viewer/2022081516/554a337db4c90520578b5368/html5/thumbnails/25.jpg)
“Just rub some DevOps on it.”Joshua Timberman
![Page 26: Atmosphere 2014](https://reader035.fdocuments.in/reader035/viewer/2022081516/554a337db4c90520578b5368/html5/thumbnails/26.jpg)
DevOps is a software development pattern
![Page 27: Atmosphere 2014](https://reader035.fdocuments.in/reader035/viewer/2022081516/554a337db4c90520578b5368/html5/thumbnails/27.jpg)
DevOps is not» A position
» A team
» A department
» Or an organization
![Page 28: Atmosphere 2014](https://reader035.fdocuments.in/reader035/viewer/2022081516/554a337db4c90520578b5368/html5/thumbnails/28.jpg)
“Disruptive startup is hiring DevOps ninjas”LinkedIn Spammer
![Page 29: Atmosphere 2014](https://reader035.fdocuments.in/reader035/viewer/2022081516/554a337db4c90520578b5368/html5/thumbnails/29.jpg)
![Page 30: Atmosphere 2014](https://reader035.fdocuments.in/reader035/viewer/2022081516/554a337db4c90520578b5368/html5/thumbnails/30.jpg)
You can't buy a DevOps tool andYou can't buy a continuous delivery tool
![Page 31: Atmosphere 2014](https://reader035.fdocuments.in/reader035/viewer/2022081516/554a337db4c90520578b5368/html5/thumbnails/31.jpg)
Software doesn't solve problems. People do.
![Page 32: Atmosphere 2014](https://reader035.fdocuments.in/reader035/viewer/2022081516/554a337db4c90520578b5368/html5/thumbnails/32.jpg)
“If you put the right people in the right room they'll solve the problem the right way”Jeff Hackert
![Page 33: Atmosphere 2014](https://reader035.fdocuments.in/reader035/viewer/2022081516/554a337db4c90520578b5368/html5/thumbnails/33.jpg)
Coming Together
![Page 34: Atmosphere 2014](https://reader035.fdocuments.in/reader035/viewer/2022081516/554a337db4c90520578b5368/html5/thumbnails/34.jpg)
You will need to change your development and release process
![Page 35: Atmosphere 2014](https://reader035.fdocuments.in/reader035/viewer/2022081516/554a337db4c90520578b5368/html5/thumbnails/35.jpg)
Adopting devops isMUCH EASIERon new projects
![Page 36: Atmosphere 2014](https://reader035.fdocuments.in/reader035/viewer/2022081516/554a337db4c90520578b5368/html5/thumbnails/36.jpg)
Start smallYour first program is typically "Hello, World!"
![Page 37: Atmosphere 2014](https://reader035.fdocuments.in/reader035/viewer/2022081516/554a337db4c90520578b5368/html5/thumbnails/37.jpg)
Automate and testeverything
![Page 38: Atmosphere 2014](https://reader035.fdocuments.in/reader035/viewer/2022081516/554a337db4c90520578b5368/html5/thumbnails/38.jpg)
Version, package, and releaseEVERYTHING
![Page 39: Atmosphere 2014](https://reader035.fdocuments.in/reader035/viewer/2022081516/554a337db4c90520578b5368/html5/thumbnails/39.jpg)
Let's build something
![Page 40: Atmosphere 2014](https://reader035.fdocuments.in/reader035/viewer/2022081516/554a337db4c90520578b5368/html5/thumbnails/40.jpg)
Application Checklist» Source code
» Build tasks
» Release tasks
» Cookbook
![Page 41: Atmosphere 2014](https://reader035.fdocuments.in/reader035/viewer/2022081516/554a337db4c90520578b5368/html5/thumbnails/41.jpg)
Resulting in1.Software Artifact (app.tar.gz)
2.Cookbook Artifact (cookbooks.tar.gz)
3.Installation | Upgrade | Configuration Docs
![Page 42: Atmosphere 2014](https://reader035.fdocuments.in/reader035/viewer/2022081516/554a337db4c90520578b5368/html5/thumbnails/42.jpg)
If you're a developerGive these three things to your Operators for every release.
![Page 43: Atmosphere 2014](https://reader035.fdocuments.in/reader035/viewer/2022081516/554a337db4c90520578b5368/html5/thumbnails/43.jpg)
Elixir
![Page 44: Atmosphere 2014](https://reader035.fdocuments.in/reader035/viewer/2022081516/554a337db4c90520578b5368/html5/thumbnails/44.jpg)
![Page 45: Atmosphere 2014](https://reader035.fdocuments.in/reader035/viewer/2022081516/554a337db4c90520578b5368/html5/thumbnails/45.jpg)
Generate Your Project$ mix new highfive
![Page 46: Atmosphere 2014](https://reader035.fdocuments.in/reader035/viewer/2022081516/554a337db4c90520578b5368/html5/thumbnails/46.jpg)
Add to source control$ cd highfive$ git init .$ git remote add origin [email protected]:reset/highfive.git
![Page 47: Atmosphere 2014](https://reader035.fdocuments.in/reader035/viewer/2022081516/554a337db4c90520578b5368/html5/thumbnails/47.jpg)
Generate Your application's Cookbook$ berks cookbook highfive ./cookbook --pattern environment --skip-git
![Page 48: Atmosphere 2014](https://reader035.fdocuments.in/reader035/viewer/2022081516/554a337db4c90520578b5368/html5/thumbnails/48.jpg)
Make deployment part of your build process
![Page 49: Atmosphere 2014](https://reader035.fdocuments.in/reader035/viewer/2022081516/554a337db4c90520578b5368/html5/thumbnails/49.jpg)
Cookbook And Application Share Version$ cat cookbook/metadata.rb
name "highfive"maintainer "Jamie Winsor"maintainer_email "[email protected]"license "All rights reserved"description "Installs/Configures highfive"long_description "Installs/Configures highfive"version File.read(File.expand_path("../../VERSION", __FILE__))
![Page 50: Atmosphere 2014](https://reader035.fdocuments.in/reader035/viewer/2022081516/554a337db4c90520578b5368/html5/thumbnails/50.jpg)
$ cat cookbook/attributes/default.rb
## Cookbook Name:: highfive# Attribute:: default#
default[:highfive][:release] = Highfive::Chef.cookbook_version(run_context)}
![Page 51: Atmosphere 2014](https://reader035.fdocuments.in/reader035/viewer/2022081516/554a337db4c90520578b5368/html5/thumbnails/51.jpg)
$ cat cookbook/libraries/highfive.rb
## Cookbook Name:: highfive# Libraries:: highfive#
module Highfive module Chef class << self # Returns the version of the loaded highfive cookbook # # @param [Chef::RunContext] context # # @return [String] def cookbook_version(context) context.cookbook_collection["highfive"].version end end endend
![Page 52: Atmosphere 2014](https://reader035.fdocuments.in/reader035/viewer/2022081516/554a337db4c90520578b5368/html5/thumbnails/52.jpg)
Environment Cookbook» Nearly identical to an Application Cookbook
» Has it's Berksfile.lock committed into version control
![Page 53: Atmosphere 2014](https://reader035.fdocuments.in/reader035/viewer/2022081516/554a337db4c90520578b5368/html5/thumbnails/53.jpg)
Build Tasks» Version bump
$ mix version.bump patch
» Compile$ mix compile
» Test$ mix test
![Page 54: Atmosphere 2014](https://reader035.fdocuments.in/reader035/viewer/2022081516/554a337db4c90520578b5368/html5/thumbnails/54.jpg)
Version BumpingGenerates a VERSION file at the root of the project
$ cat VERSION1.0.0
![Page 55: Atmosphere 2014](https://reader035.fdocuments.in/reader035/viewer/2022081516/554a337db4c90520578b5368/html5/thumbnails/55.jpg)
How do we get our compiled software in our vm?
![Page 56: Atmosphere 2014](https://reader035.fdocuments.in/reader035/viewer/2022081516/554a337db4c90520578b5368/html5/thumbnails/56.jpg)
Build and package release» OTP Release assemble
$ mix release.assemble
» Package$ mix package$ ls pkghighfive-osx.tar.gz
![Page 57: Atmosphere 2014](https://reader035.fdocuments.in/reader035/viewer/2022081516/554a337db4c90520578b5368/html5/thumbnails/57.jpg)
We need to assemble a release for the os we're deploying to
![Page 58: Atmosphere 2014](https://reader035.fdocuments.in/reader035/viewer/2022081516/554a337db4c90520578b5368/html5/thumbnails/58.jpg)
Build a Build Server
![Page 59: Atmosphere 2014](https://reader035.fdocuments.in/reader035/viewer/2022081516/554a337db4c90520578b5368/html5/thumbnails/59.jpg)
Build Server Recipe$ cat cookbook/recipe/build_server.rb
include_recipe "highfive::_common"include_recipe "build-essential::default"include_recipe "elixir::default"
![Page 60: Atmosphere 2014](https://reader035.fdocuments.in/reader035/viewer/2022081516/554a337db4c90520578b5368/html5/thumbnails/60.jpg)
Edit metadata.rb$ cat cookbook/metadata.rb
name "highfive"maintainer "Jamie Winsor"maintainer_email "[email protected]"license "All rights reserved"description "Installs/Configures highfive"long_description "Installs/Configures highfive"version "0.1.0"
supports "ubuntu"
depends "build-essential", "~> 2.0"depends "elixir", "~> 0.5"
![Page 61: Atmosphere 2014](https://reader035.fdocuments.in/reader035/viewer/2022081516/554a337db4c90520578b5368/html5/thumbnails/61.jpg)
Vagrant BuilderOn-demand virtualized build server
![Page 62: Atmosphere 2014](https://reader035.fdocuments.in/reader035/viewer/2022081516/554a337db4c90520578b5368/html5/thumbnails/62.jpg)
Vagrant.configure("2") do |config| # ... additional configuration ...
config.vm.synced_folder File.dirname(__FILE__), "/builder" config.vm.provision :chef_solo do |chef| chef.run_list = [ "recipe[highfive::build_server]" ] end
config.vm.provision :shell, inline: <<-SCRIPTexport PATH=/usr/local/lib/elixir/bin::$PATHexport ELIXIR_EBIN=/usr/local/lib/elixir/lib/elixir/ebinexport MIX_ENV=prodmix clean --allmix version.bump patchmix deps.getmix compilemix release.assemblemix package SCRIPTend
![Page 63: Atmosphere 2014](https://reader035.fdocuments.in/reader035/viewer/2022081516/554a337db4c90520578b5368/html5/thumbnails/63.jpg)
Build it (from our host machine)$ vagrant up --provision.... provisioning ...$ ls pkghighfive-linux-x86-tar.gz
![Page 64: Atmosphere 2014](https://reader035.fdocuments.in/reader035/viewer/2022081516/554a337db4c90520578b5368/html5/thumbnails/64.jpg)
deploying our artifact
![Page 65: Atmosphere 2014](https://reader035.fdocuments.in/reader035/viewer/2022081516/554a337db4c90520578b5368/html5/thumbnails/65.jpg)
Create app.rb recipe
node.set[:'build-essential'][:compile_time] = trueinclude_recipe "libarchive::default"include_recipe "runit"
libarchive_file "highfive-linux-x86.tar.gz" do path "/pkg" extract_to "/opt/highfive" owner "highfive" group "highfive"
action :extract notifies :restart, "runit_service[highfive]" only_if { ::File.exist?(asset.asset_path) }end
runit_service "highfive"
![Page 66: Atmosphere 2014](https://reader035.fdocuments.in/reader035/viewer/2022081516/554a337db4c90520578b5368/html5/thumbnails/66.jpg)
Update Cookbook Dependenciesdepends "build-essential", "~> 2.0"depends "elixir", "~> 0.5"depends "libarchive"
![Page 67: Atmosphere 2014](https://reader035.fdocuments.in/reader035/viewer/2022081516/554a337db4c90520578b5368/html5/thumbnails/67.jpg)
Edit .kitchen.yml$ cat cookbook/.kitchen.yml
driver: name: vagrant synced_folders: - ["<%= File.expand_path("../../pkg", __FILE__) %>", "/pkg"]
provisioner: name: chef_solo
platforms: - name: ubuntu-12.04
suites: - name: default run_list: - recipe[highfive::default] attributes:
![Page 68: Atmosphere 2014](https://reader035.fdocuments.in/reader035/viewer/2022081516/554a337db4c90520578b5368/html5/thumbnails/68.jpg)
Kitchen Converge$ cd cookbook$ kitchen converge-----> Starting Kitchen (v1.2.2.dev)...-----> Kitchen is finished. (14m6.31s)
![Page 69: Atmosphere 2014](https://reader035.fdocuments.in/reader035/viewer/2022081516/554a337db4c90520578b5368/html5/thumbnails/69.jpg)
Generating the Cookbook artifact$ berks package pkg/cookbooks.tar.gz -b cookbook/BerksfileCookbook(s) packaged to pkg/cookbooks.tar.gz
![Page 70: Atmosphere 2014](https://reader035.fdocuments.in/reader035/viewer/2022081516/554a337db4c90520578b5368/html5/thumbnails/70.jpg)
The archive contains
» The Berksfile.lock from resolution
» A cookbooks directory containing each cookbook found in the Berksfile.lock
![Page 71: Atmosphere 2014](https://reader035.fdocuments.in/reader035/viewer/2022081516/554a337db4c90520578b5368/html5/thumbnails/71.jpg)
Put these archives in an artifact server
![Page 72: Atmosphere 2014](https://reader035.fdocuments.in/reader035/viewer/2022081516/554a337db4c90520578b5368/html5/thumbnails/72.jpg)
Artifact Servers» Github | Github Enterprise
» Sonatype's Nexus
» Artifactory
» Basic Auth HTTP Server (sadface)(https://artifacts.myorg.com/myapp/1.2.3/myapp.tar.gz)
![Page 73: Atmosphere 2014](https://reader035.fdocuments.in/reader035/viewer/2022081516/554a337db4c90520578b5368/html5/thumbnails/73.jpg)
Github Releases and Release Assets
![Page 74: Atmosphere 2014](https://reader035.fdocuments.in/reader035/viewer/2022081516/554a337db4c90520578b5368/html5/thumbnails/74.jpg)
![Page 75: Atmosphere 2014](https://reader035.fdocuments.in/reader035/viewer/2022081516/554a337db4c90520578b5368/html5/thumbnails/75.jpg)
GitHub Deploy
asset_path = "/pkg"
unless node[:highfive][:_local_deploy] asset = github_asset "berkshelf-api.tar.gz" do repo "berkshelf/berkshelf-api" release "v1.2.1" end
asset_path = asset.pathend
libarchive_file "highfive-linux-x86.tar.gz" do path asset_path extract_to "/opt/highfive" owner "highfive" group "highfive"
action :extract notifies :restart, "runit_service[highfive]" only_if { ::File.exist?(asset.asset_path) }end
![Page 76: Atmosphere 2014](https://reader035.fdocuments.in/reader035/viewer/2022081516/554a337db4c90520578b5368/html5/thumbnails/76.jpg)
Update .kitchen.ymldriver: name: vagrant synced_folders: - ["<%= File.expand_path("../../pkg", __FILE__) %>", "/pkg"]
provisioner: name: chef_solo
platforms: - name: ubuntu-12.04
suites: - name: default run_list: - recipe[highfive::default] attributes: { highfive: { _local_deploy: true } }
![Page 77: Atmosphere 2014](https://reader035.fdocuments.in/reader035/viewer/2022081516/554a337db4c90520578b5368/html5/thumbnails/77.jpg)
Release artifacts allow us to» Build a new environment with a specific version
» Upgrade pre-existing environments
» Promote through logical environments(Dev, Stage, Production)
![Page 78: Atmosphere 2014](https://reader035.fdocuments.in/reader035/viewer/2022081516/554a337db4c90520578b5368/html5/thumbnails/78.jpg)
Deploy It
![Page 79: Atmosphere 2014](https://reader035.fdocuments.in/reader035/viewer/2022081516/554a337db4c90520578b5368/html5/thumbnails/79.jpg)
Create Environment$ knife environment create highfive-dev
![Page 80: Atmosphere 2014](https://reader035.fdocuments.in/reader035/viewer/2022081516/554a337db4c90520578b5368/html5/thumbnails/80.jpg)
Bootstrap A Node$ knife ec2 server create -I ami-0eb2d83e -E highfive-dev
![Page 81: Atmosphere 2014](https://reader035.fdocuments.in/reader035/viewer/2022081516/554a337db4c90520578b5368/html5/thumbnails/81.jpg)
BerkflowA Cookbook-Centric Deployment workflow tool
![Page 82: Atmosphere 2014](https://reader035.fdocuments.in/reader035/viewer/2022081516/554a337db4c90520578b5368/html5/thumbnails/82.jpg)
Install Berkflow with Chef-DK$ chef gem install berkflow$ export PATH=/opt/chefdk/embedded/bin:$PATH
$ which blo/opt/chefdk/embedded/bin/blo
![Page 83: Atmosphere 2014](https://reader035.fdocuments.in/reader035/viewer/2022081516/554a337db4c90520578b5368/html5/thumbnails/83.jpg)
"Install" the cookbook artifact into your Chef Server$ blo install https://github.com/reset/highfive/releases/download/v1.0.0/cookbooks.tar.gz
![Page 84: Atmosphere 2014](https://reader035.fdocuments.in/reader035/viewer/2022081516/554a337db4c90520578b5368/html5/thumbnails/84.jpg)
"Upgrading" a Chef Environment$ blo upgrade highfive-dev highfive 1.2.1
Or upgrade to latest
$ blo upgrade highfive-dev highfive latest
![Page 85: Atmosphere 2014](https://reader035.fdocuments.in/reader035/viewer/2022081516/554a337db4c90520578b5368/html5/thumbnails/85.jpg)
One Button Upgrade
![Page 86: Atmosphere 2014](https://reader035.fdocuments.in/reader035/viewer/2022081516/554a337db4c90520578b5368/html5/thumbnails/86.jpg)
Be a catalyst for changeBut don't expect a parade. It's not coming.
![Page 87: Atmosphere 2014](https://reader035.fdocuments.in/reader035/viewer/2022081516/554a337db4c90520578b5368/html5/thumbnails/87.jpg)
Even if it doesYou won't have your own float
![Page 88: Atmosphere 2014](https://reader035.fdocuments.in/reader035/viewer/2022081516/554a337db4c90520578b5368/html5/thumbnails/88.jpg)
Wanna Make Games?http://undeadlabs.com/jobs/
» Game Programmer
» Game Producer
» Game Animator
» Game Designer
![Page 89: Atmosphere 2014](https://reader035.fdocuments.in/reader035/viewer/2022081516/554a337db4c90520578b5368/html5/thumbnails/89.jpg)
Jamie [email protected]/reset