A power point by R Tyler Croy Mr. Kanies 6 Period · Who is Tyler! GitHub Decentral High Senior (GO...

51
A power point by R Tyler Croy Mr. Kanies 6 th Period GitHub Decentral High School 2014 http://tiny.cc/MrKaniesIsTheBest

Transcript of A power point by R Tyler Croy Mr. Kanies 6 Period · Who is Tyler! GitHub Decentral High Senior (GO...

Page 1: A power point by R Tyler Croy Mr. Kanies 6 Period · Who is Tyler! GitHub Decentral High Senior (GO CATS!) Member of the Ruby Pep Band Mathelete DevOps Lab Safety Marshal Open Source

A power point by R Tyler Croy

Mr. Kanies 6th PeriodGitHub Decentral High School 2014

http://tiny.cc/MrKaniesIsTheBest

Page 2: A power point by R Tyler Croy Mr. Kanies 6 Period · Who is Tyler! GitHub Decentral High Senior (GO CATS!) Member of the Ruby Pep Band Mathelete DevOps Lab Safety Marshal Open Source

Who is Tyler!● GitHub Decentral High Senior (GO CATS!)● Member of the Ruby Pep Band● Mathelete● DevOps Lab Safety Marshal● Open Source Debate Team Secretary

Page 3: A power point by R Tyler Croy Mr. Kanies 6 Period · Who is Tyler! GitHub Decentral High Senior (GO CATS!) Member of the Ruby Pep Band Mathelete DevOps Lab Safety Marshal Open Source

● Core Systems, Team Captain● JRuby Club President● AP Distributed Systems

Page 4: A power point by R Tyler Croy Mr. Kanies 6 Period · Who is Tyler! GitHub Decentral High Senior (GO CATS!) Member of the Ruby Pep Band Mathelete DevOps Lab Safety Marshal Open Source

Mr. Jenkins● Free & open Source continugous integration

server● Built with Java but can do other things to● Uses Puppet but didn't use to

Page 5: A power point by R Tyler Croy Mr. Kanies 6 Period · Who is Tyler! GitHub Decentral High Senior (GO CATS!) Member of the Ruby Pep Band Mathelete DevOps Lab Safety Marshal Open Source
Page 6: A power point by R Tyler Croy Mr. Kanies 6 Period · Who is Tyler! GitHub Decentral High Senior (GO CATS!) Member of the Ruby Pep Band Mathelete DevOps Lab Safety Marshal Open Source
Page 7: A power point by R Tyler Croy Mr. Kanies 6 Period · Who is Tyler! GitHub Decentral High Senior (GO CATS!) Member of the Ruby Pep Band Mathelete DevOps Lab Safety Marshal Open Source

The Services● Many web applications● LDAP● Atlassian services● Jenkins● IRC robots● DNS● MirrorBrain

Page 8: A power point by R Tyler Croy Mr. Kanies 6 Period · Who is Tyler! GitHub Decentral High Senior (GO CATS!) Member of the Ruby Pep Band Mathelete DevOps Lab Safety Marshal Open Source

The Wares● 2 physical machines● 3 KVM-based VMs● Assortment of EC2/Rackspace instances● 10+ mirrors

Page 9: A power point by R Tyler Croy Mr. Kanies 6 Period · Who is Tyler! GitHub Decentral High Senior (GO CATS!) Member of the Ruby Pep Band Mathelete DevOps Lab Safety Marshal Open Source

The People● Zero “full-time” contributors● Small group of Owners● Sporadic drive-by-committers

Page 10: A power point by R Tyler Croy Mr. Kanies 6 Period · Who is Tyler! GitHub Decentral High Senior (GO CATS!) Member of the Ruby Pep Band Mathelete DevOps Lab Safety Marshal Open Source
Page 11: A power point by R Tyler Croy Mr. Kanies 6 Period · Who is Tyler! GitHub Decentral High Senior (GO CATS!) Member of the Ruby Pep Band Mathelete DevOps Lab Safety Marshal Open Source

At Sun/Oracle● Scavenged machines● Dubious locations within the company● Questionable ownership of physical assets● Manually managed, no audit trail/history● Completely unreproducible

Page 12: A power point by R Tyler Croy Mr. Kanies 6 Period · Who is Tyler! GitHub Decentral High Senior (GO CATS!) Member of the Ruby Pep Band Mathelete DevOps Lab Safety Marshal Open Source

“What if we used 'PUPPET?'”

Page 13: A power point by R Tyler Croy Mr. Kanies 6 Period · Who is Tyler! GitHub Decentral High Senior (GO CATS!) Member of the Ruby Pep Band Mathelete DevOps Lab Safety Marshal Open Source

Masterless Puppet● Needed something after leaving Sun/Oracle● Centralized audit logging in Git repo● Not everything is Puppetized because time● Some parts reproducible, others special

snowflakes● Code structure is messy and bad, also awful

Page 14: A power point by R Tyler Croy Mr. Kanies 6 Period · Who is Tyler! GitHub Decentral High Senior (GO CATS!) Member of the Ruby Pep Band Mathelete DevOps Lab Safety Marshal Open Source

The Year 3000● Puppet Enterprise● Clearer definition of separation between

Puppet modules and “our code”● Git log of changes● Some snowflakes killed, some new ones

Page 15: A power point by R Tyler Croy Mr. Kanies 6 Period · Who is Tyler! GitHub Decentral High Senior (GO CATS!) Member of the Ruby Pep Band Mathelete DevOps Lab Safety Marshal Open Source
Page 16: A power point by R Tyler Croy Mr. Kanies 6 Period · Who is Tyler! GitHub Decentral High Senior (GO CATS!) Member of the Ruby Pep Band Mathelete DevOps Lab Safety Marshal Open Source

Why Puppet Entperirse● Higher visibility into changes being applied

– Reporting (email, irc)– PE Console

● MCollective for basic ad-hoc orchestration● Debian/Yum repo for agent bootstrap● Easy breezy beautiful, cover girl

Page 17: A power point by R Tyler Croy Mr. Kanies 6 Period · Who is Tyler! GitHub Decentral High Senior (GO CATS!) Member of the Ruby Pep Band Mathelete DevOps Lab Safety Marshal Open Source

Special Thanks to Puppet Labs

Page 18: A power point by R Tyler Croy Mr. Kanies 6 Period · Who is Tyler! GitHub Decentral High Senior (GO CATS!) Member of the Ruby Pep Band Mathelete DevOps Lab Safety Marshal Open Source
Page 19: A power point by R Tyler Croy Mr. Kanies 6 Period · Who is Tyler! GitHub Decentral High Senior (GO CATS!) Member of the Ruby Pep Band Mathelete DevOps Lab Safety Marshal Open Source

C:\ PuppetCode.bat

Page 20: A power point by R Tyler Croy Mr. Kanies 6 Period · Who is Tyler! GitHub Decentral High Senior (GO CATS!) Member of the Ruby Pep Band Mathelete DevOps Lab Safety Marshal Open Source

Masterless Puppet● 80 .pp files● 0 tests● github.com/jenkinsci/infra-puppet● librarian-puppet for dependency

“management”● All secrets managed out of band

Page 21: A power point by R Tyler Croy Mr. Kanies 6 Period · Who is Tyler! GitHub Decentral High Senior (GO CATS!) Member of the Ruby Pep Band Mathelete DevOps Lab Safety Marshal Open Source

Code Layout

infra­puppet/ ├── Gemfile ├── Gemfile.lock ├── Puppetfile ├── Puppetfile.lock ├── confluence.deb/

     │ ├── build.sh ├── features/ ├── local­modules/

     │ ├── apache2 ├── manifests/

     │ ├── cabbage.pp     │ ├── cucumber.pp     │ ├── eggplant.pp     │ ├── kale.pp     │ ├── lettuce.pp     │ ├── spinach.pp     │ └── vagrant.pp └── run.sh

Page 22: A power point by R Tyler Croy Mr. Kanies 6 Period · Who is Tyler! GitHub Decentral High Senior (GO CATS!) Member of the Ruby Pep Band Mathelete DevOps Lab Safety Marshal Open Source

A “module”class base {  # Unfortunately this module only supports Ubuntu  if ($operatingsystem == 'Ubuntu') {    include nagios::client  }

  stage {    'pre' :      before => Stage['main'];    'post' :      require => Stage['main'];  }

  class {    'base::pre' :      stage => 'pre';

    'base::post' :      stage => 'post';

    'puppet' :      ensure => '2.7.19­1puppetlabs2';

Page 23: A power point by R Tyler Croy Mr. Kanies 6 Period · Who is Tyler! GitHub Decentral High Senior (GO CATS!) Member of the Ruby Pep Band Mathelete DevOps Lab Safety Marshal Open Source

“deployment” aka “testing”

●git pull –rebase●librarian­puppet install●puppet apply manifests/`hostname`.pp● manual guess and check

Page 24: A power point by R Tyler Croy Mr. Kanies 6 Period · Who is Tyler! GitHub Decentral High Senior (GO CATS!) Member of the Ruby Pep Band Mathelete DevOps Lab Safety Marshal Open Source
Page 25: A power point by R Tyler Croy Mr. Kanies 6 Period · Who is Tyler! GitHub Decentral High Senior (GO CATS!) Member of the Ruby Pep Band Mathelete DevOps Lab Safety Marshal Open Source
Page 26: A power point by R Tyler Croy Mr. Kanies 6 Period · Who is Tyler! GitHub Decentral High Senior (GO CATS!) Member of the Ruby Pep Band Mathelete DevOps Lab Safety Marshal Open Source

Code Layout

jenkins­infra/ ├── Gemfile ├── Gemfile.lock ├── Puppetfile ├── README.md ├── Rakefile ├── Vagrantfile ├── ci/

     │ └── 00_setupgems.sh ├── dist/

     │ └── role/     │ └── profile/ ├── hieradata/

     │ └── common.yaml ├── manifests/

     │ └── site.pp └── spec/

     │ └── classes/     │ └── server/

Page 27: A power point by R Tyler Croy Mr. Kanies 6 Period · Who is Tyler! GitHub Decentral High Senior (GO CATS!) Member of the Ruby Pep Band Mathelete DevOps Lab Safety Marshal Open Source

ci/

for f in ci/*.sh; do \  echo “> Running ci/$f”; \  bash $f; \done

Page 28: A power point by R Tyler Croy Mr. Kanies 6 Period · Who is Tyler! GitHub Decentral High Senior (GO CATS!) Member of the Ruby Pep Band Mathelete DevOps Lab Safety Marshal Open Source

dist/

dist/ ├── profile/

     │ ├── files     │ ├── manifests     │ ├── templates     │ └── tests

 └── role/      └── manifests

Page 29: A power point by R Tyler Croy Mr. Kanies 6 Period · Who is Tyler! GitHub Decentral High Senior (GO CATS!) Member of the Ruby Pep Band Mathelete DevOps Lab Safety Marshal Open Source

profile/manifests/

dist/profile/manifests/ ├── accounts.pp ├── apache­misc.pp ├── apt.pp ├── archives.pp ├── ... ├── sudo.pp └── vagrant.pp

Page 30: A power point by R Tyler Croy Mr. Kanies 6 Period · Who is Tyler! GitHub Decentral High Senior (GO CATS!) Member of the Ruby Pep Band Mathelete DevOps Lab Safety Marshal Open Source

spec/spec/

 ├── classes/     │ ├── profile/     │ └── role/

 ├── fixtures     │ ├── ...

 ├── server/     │ ├── celery/     │ ├── ...     │ ├── spec_helper.rb     │ └── support

 ├── spec_helper.rb └── support/

Page 31: A power point by R Tyler Croy Mr. Kanies 6 Period · Who is Tyler! GitHub Decentral High Senior (GO CATS!) Member of the Ruby Pep Band Mathelete DevOps Lab Safety Marshal Open Source

A “module”

Page 32: A power point by R Tyler Croy Mr. Kanies 6 Period · Who is Tyler! GitHub Decentral High Senior (GO CATS!) Member of the Ruby Pep Band Mathelete DevOps Lab Safety Marshal Open Source

Our modules● puppet-groovy (fork)● puppet-irc (fork)● puppet-apache-log-compressor● puppet-account (fork)● garethr-docker (fork)

Page 33: A power point by R Tyler Croy Mr. Kanies 6 Period · Who is Tyler! GitHub Decentral High Senior (GO CATS!) Member of the Ruby Pep Band Mathelete DevOps Lab Safety Marshal Open Source

TOP SECRETS● All secrets in Hiera● Heavy use of hiera-eyaml● Private repository for sharing keys

Page 34: A power point by R Tyler Croy Mr. Kanies 6 Period · Who is Tyler! GitHub Decentral High Senior (GO CATS!) Member of the Ruby Pep Band Mathelete DevOps Lab Safety Marshal Open Source

Testing● rspec-puppet for catalogue logic● serverspec + vagrant-serverspec for

masterless integration testing● Manual testing with puppet agent -t for

final sanity check

Page 35: A power point by R Tyler Croy Mr. Kanies 6 Period · Who is Tyler! GitHub Decentral High Senior (GO CATS!) Member of the Ruby Pep Band Mathelete DevOps Lab Safety Marshal Open Source

describe 'profile::archives' do  let(:facts) {    {:operatingsystem => 'Ubuntu',     :osfamily => 'Debian' }  }

  it { should contain_class 'profile::apache­misc' }  it { should contain_class 'lvm' }  it { should contain_class 'apache' }

  # …

  it { should contain_apache__mod 'bw' }end

Page 36: A power point by R Tyler Croy Mr. Kanies 6 Period · Who is Tyler! GitHub Decentral High Senior (GO CATS!) Member of the Ruby Pep Band Mathelete DevOps Lab Safety Marshal Open Source

Vagrant + ServerSpec● Relies Vagrant's ability to use multiple

provisioners– Shell– Puppet– Serverspec

● Dynamically creates a machine per role

Page 37: A power point by R Tyler Croy Mr. Kanies 6 Period · Who is Tyler! GitHub Decentral High Senior (GO CATS!) Member of the Ruby Pep Band Mathelete DevOps Lab Safety Marshal Open Source

require_relative './../spec_helper'

describe 'spinach' do  it_behaves_like "a standard Linux machine"  it_behaves_like "a DNS server"

  context 'groovy support' do    describe file('/etc/profile.d/groovy.sh') do      it { should be_file }    end

    describe file('/opt/groovy­2.3.1/bin/groovy') do      it { should be_file }    end  endend

Page 38: A power point by R Tyler Croy Mr. Kanies 6 Period · Who is Tyler! GitHub Decentral High Senior (GO CATS!) Member of the Ruby Pep Band Mathelete DevOps Lab Safety Marshal Open Source

% ./vagrant­aws up spinach==> spinach: Running provisioner: shell...<SNIP>==> spinach: Running provisioner: puppet...<SNIP>==> spinach: Running provisioner: serverspec...

spinach  behaves like a standard Linux machine    File "/etc/ssh/sshd_config"      should contain "PasswordAuthentication no"    User "kohsuke"      should exist []      should have home directory "/home/kohsuke"    Port "22"      should be listening    Cron      should have entry "20 2 * * * apt­get update"  groovy support    File "/etc/profile.d/groovy.sh"      should be file    File "/opt/groovy­2.3.1/bin/groovy"      should be file

Page 39: A power point by R Tyler Croy Mr. Kanies 6 Period · Who is Tyler! GitHub Decentral High Senior (GO CATS!) Member of the Ruby Pep Band Mathelete DevOps Lab Safety Marshal Open Source

deployment

1.Create pull request

2.Merge changes into staging branch

3.Create pull request

4.Merge changes into production branch

5.R10k webhook updates master

6.Agents consume ~15 minutes

7.Report back to PE Console

Page 40: A power point by R Tyler Croy Mr. Kanies 6 Period · Who is Tyler! GitHub Decentral High Senior (GO CATS!) Member of the Ruby Pep Band Mathelete DevOps Lab Safety Marshal Open Source
Page 41: A power point by R Tyler Croy Mr. Kanies 6 Period · Who is Tyler! GitHub Decentral High Senior (GO CATS!) Member of the Ruby Pep Band Mathelete DevOps Lab Safety Marshal Open Source
Page 42: A power point by R Tyler Croy Mr. Kanies 6 Period · Who is Tyler! GitHub Decentral High Senior (GO CATS!) Member of the Ruby Pep Band Mathelete DevOps Lab Safety Marshal Open Source

Docker'd● 3 dockered services

– bind– supybot– custom java bot

Page 43: A power point by R Tyler Croy Mr. Kanies 6 Period · Who is Tyler! GitHub Decentral High Senior (GO CATS!) Member of the Ruby Pep Band Mathelete DevOps Lab Safety Marshal Open Source

bind/Dockerfile

FROM ubuntu:trustyRUN apt­get install ­y bind9 dnsutilsRUN ln ­f ­s /etc/bind/local/named.conf.local /etc/bind/RUN mkdir /var/run/named

EXPOSE 53 53/udp

# config filesVOLUME ["/etc/bind/local"]

CMD /usr/sbin/named ­g

Page 44: A power point by R Tyler Croy Mr. Kanies 6 Period · Who is Tyler! GitHub Decentral High Senior (GO CATS!) Member of the Ruby Pep Band Mathelete DevOps Lab Safety Marshal Open Source

Quality● 20+ spec files● < 5% Puppet runs have failed● All pull requests tested before merge● > 250 successful builds in CI

Page 45: A power point by R Tyler Croy Mr. Kanies 6 Period · Who is Tyler! GitHub Decentral High Senior (GO CATS!) Member of the Ruby Pep Band Mathelete DevOps Lab Safety Marshal Open Source
Page 46: A power point by R Tyler Croy Mr. Kanies 6 Period · Who is Tyler! GitHub Decentral High Senior (GO CATS!) Member of the Ruby Pep Band Mathelete DevOps Lab Safety Marshal Open Source

Testing with Puppet Enterprise

Page 47: A power point by R Tyler Croy Mr. Kanies 6 Period · Who is Tyler! GitHub Decentral High Senior (GO CATS!) Member of the Ruby Pep Band Mathelete DevOps Lab Safety Marshal Open Source

Automating Confluence and JIRA

Page 48: A power point by R Tyler Croy Mr. Kanies 6 Period · Who is Tyler! GitHub Decentral High Senior (GO CATS!) Member of the Ruby Pep Band Mathelete DevOps Lab Safety Marshal Open Source

OS UPGRADES

Page 49: A power point by R Tyler Croy Mr. Kanies 6 Period · Who is Tyler! GitHub Decentral High Senior (GO CATS!) Member of the Ruby Pep Band Mathelete DevOps Lab Safety Marshal Open Source

keeping up

Page 50: A power point by R Tyler Croy Mr. Kanies 6 Period · Who is Tyler! GitHub Decentral High Senior (GO CATS!) Member of the Ruby Pep Band Mathelete DevOps Lab Safety Marshal Open Source

you can help!● find us on IRC: #jenkins-infra● [email protected]● github.com/jenkins-infra

Page 51: A power point by R Tyler Croy Mr. Kanies 6 Period · Who is Tyler! GitHub Decentral High Senior (GO CATS!) Member of the Ruby Pep Band Mathelete DevOps Lab Safety Marshal Open Source

THanks!

http://tiny.cc/MrKaniesIsTheBest

@agentderogithub.com/[email protected]