puppet camp chicago 2014: puppet at backstop another year of lessons

53
Puppet at Backstop Another year of lessons 1

Upload: puppet-labs

Post on 10-May-2015

306 views

Category:

Software


3 download

DESCRIPTION

Puppet Camp Chicago 2014: "Puppet at backstop another year of lessons" by Bill Weiss, Backstop

TRANSCRIPT

Page 1: Puppet Camp Chicago 2014: Puppet at backstop another year of lessons

Puppet at BackstopAnother year of lessons

1

Page 2: Puppet Camp Chicago 2014: Puppet at backstop another year of lessons

$ whoami

‣ Bill Weiss <[email protected]>

‣ @BillWeiss

‣ Probably responsible for 90% of the badness in this talk, 25% of the good

‣ Still not a designer

2

Page 3: Puppet Camp Chicago 2014: Puppet at backstop another year of lessons

What’s this talk about?aka, who cares?

3

Page 4: Puppet Camp Chicago 2014: Puppet at backstop another year of lessons

4Image via MemeCrunch. Original owned by the History Channel.

Page 5: Puppet Camp Chicago 2014: Puppet at backstop another year of lessons

No, wait, that’s not it

(Come talk to me afterward about that)

5

Page 6: Puppet Camp Chicago 2014: Puppet at backstop another year of lessons

‣ I’m here to talk about things that work (and don’t) for us in our environment

‣ Hopefully most of it is useful to you

‣ Some might just be there so you can point and laugh

6

Page 7: Puppet Camp Chicago 2014: Puppet at backstop another year of lessons

–You

“What the heck is Backstop?”

7

Page 8: Puppet Camp Chicago 2014: Puppet at backstop another year of lessons

Super helpful, I know

8

Page 9: Puppet Camp Chicago 2014: Puppet at backstop another year of lessons

SaaS for institutional investment firms

‣ That’s it.

‣ You’re probably not our target audience

‣ If you are, awesome, let’s talk later

9

Page 10: Puppet Camp Chicago 2014: Puppet at backstop another year of lessons

Some numbers

‣ ~195 Puppeted machines in production (US)

‣ ~350 total

‣ 2 datacenters, 2 AWS AZs, 1 office closet full of machines

‣ 50+ Engineering folks (IT, dev, QA, etc)

Numbers of machines from MCollective!

10

Page 11: Puppet Camp Chicago 2014: Puppet at backstop another year of lessons

Logo owned by the CentOS project

Logo also owned by Oracle, of course

Logo owned by Oracle

Logo by David Heinemeier Hansson11

Page 12: Puppet Camp Chicago 2014: Puppet at backstop another year of lessons

‣ Big application is J2EE on JBoss

‣ Lots of smaller bits (“services”) on Tomcat

‣ Second app is Ruby on Rails

12

Page 13: Puppet Camp Chicago 2014: Puppet at backstop another year of lessons

How ‘bout that Puppet?

‣ Moved to GitHub 2013/11/18

‣ ~4100 commits since then (~15 commits/day!)

‣ 2700 from people outside sysadmin team

‣ ~1350 pull requests from 21 contributors

13

Page 14: Puppet Camp Chicago 2014: Puppet at backstop another year of lessons

The move to GitHub was awesome

‣ 4 years of Subversion before that had 29 authors and 6700 commits

‣ Other things at play here beside just s/svn/git/ , but it helped a lot

‣ How?

14

Page 15: Puppet Camp Chicago 2014: Puppet at backstop another year of lessons

! git workflow‣ Org-owned repo, two branches

‣ master ➡ production

‣ office ➡ testing (pre-prod)

‣ Everyone forks from master and sends pull requests to office

‣ Pull changes from office to master as needed

15

Page 16: Puppet Camp Chicago 2014: Puppet at backstop another year of lessons

‣ Everyone has their own fork with work branches

‣ Branch names probably are Jira ticket numbers

‣ Everyone bases from master, not office, so we can pull changes independently

16

Page 17: Puppet Camp Chicago 2014: Puppet at backstop another year of lessons

This is why we have so many contributors

17

Page 18: Puppet Camp Chicago 2014: Puppet at backstop another year of lessons

‣ If you’re a software shop, you already have a workflow. Do that

‣ Otherwise, this is working well for us

18

Page 19: Puppet Camp Chicago 2014: Puppet at backstop another year of lessons

" git hooks‣ We had a pretty good set of pre-commit hooks in

svn to test changes

‣ Github doesn’t do that #

‣ Git pre-commit hooks exist, but it’s up to each person to set them up

‣ No awesome answer yet

‣ The answer might be…

19

Page 20: Puppet Camp Chicago 2014: Puppet at backstop another year of lessons

! Jenkins!

‣ We used to have this “deploy” job on the Puppet masters as a cron job:

• (cd /etc/puppet && svn up)

‣ Nothing could go wrong there, right?

‣ For a while we just did it manually instead

20

Page 21: Puppet Camp Chicago 2014: Puppet at backstop another year of lessons

‣ Jenkins polls for changes to either branch

‣ Runs a deploy job that grabs repo, runs librarian-puppet, a “build” step, and then pushes it out to the masters

‣ Determines masters via mco call

‣ All the good (and bad) of capistrano for the push

21

Page 22: Puppet Camp Chicago 2014: Puppet at backstop another year of lessons

22

alias puppet-test='sudo puppet agent --test --noop --environment'

That deploys an environment titled UserBranch, camel-cased

Page 23: Puppet Camp Chicago 2014: Puppet at backstop another year of lessons

‣ Jenkins also runs a test suite in parallel

‣ Some day that’ll be a precursor to the deploy job. Some day…

23

Page 24: Puppet Camp Chicago 2014: Puppet at backstop another year of lessons

" Sometimes you just want to do something to prod

‣ All that well-defined procedure means time for quick fixes goes up

‣ Make a branch, make some changes, commit, push, PR to office, merge, PR to prod, merge, run deploy…

24

Page 25: Puppet Camp Chicago 2014: Puppet at backstop another year of lessons

‣ Possible answers here:

• Pull some things out into their own repos

• Accept that it’s slower

• Tool it up, make the machines do the slow parts

25

Page 26: Puppet Camp Chicago 2014: Puppet at backstop another year of lessons

! MCollective is still awesome

26

Original image: http://xkcd.com/353/ Cheapo editing courtesy OS X Preview “Annotate” Same graphic as last year’s talk. I love you, mco!

Page 27: Puppet Camp Chicago 2014: Puppet at backstop another year of lessons

It’s like Frank’s Red Hot

‣ Our deploys (not IT, app teams) now use it to figure out which machines to deploy to

‣ We wrote an agent for our VM system (Proxmox) Which, uh, evidently we haven’t released. Will do.

‣ Stop/start the world for Oracle maintenance

27

Page 28: Puppet Camp Chicago 2014: Puppet at backstop another year of lessons

" ActiveMQ is hard

‣ MCollective sits on top of ActiveMQ

‣ Easy, right? Just install it (with Puppet, even) and go to town

‣ Second datacenter? Yeah, just get them talking to each other and…

28

Page 29: Puppet Camp Chicago 2014: Puppet at backstop another year of lessons

A sad example

29

Page 30: Puppet Camp Chicago 2014: Puppet at backstop another year of lessons

Suddenly, one day…

‣ Pretend x is time

‣ y is memory usage

‣ That’s our activeMQ

• At 2AM

• Every day

30

Page 31: Puppet Camp Chicago 2014: Puppet at backstop another year of lessons

31

“Sudden Clarity Clarence” via memecreator.eu Original image? Who knows. Might be Clarence.

Page 32: Puppet Camp Chicago 2014: Puppet at backstop another year of lessons

‣ Long story short: make really sure your broker names are unique across your network

‣ Really really sure

32

Page 33: Puppet Camp Chicago 2014: Puppet at backstop another year of lessons

That won’t happen to us

‣ Maybe not

‣ Just know you’re adding another service you rely on

‣ Monitor it

‣ Measure it

‣ Have a game plan for what to do when it goes horribly wrong

33

Page 34: Puppet Camp Chicago 2014: Puppet at backstop another year of lessons

‣ R.I.’s scripts [1]

‣ Erwan Ben Souiden, aka labynocle [2]

‣ A script I butchered to help

34

[1]: https://github.com/ripienaar/monitoring-scripts/tree/master/activemq [2]: https://github.com/labynocle/nagios_plugins_by_labynocle/tree/master/check_activeMQ [3]: https://github.com/BillWeiss/MiscScripts/blob/master/check_activemq.pl

I know, I know, bleh, Nagios

Page 35: Puppet Camp Chicago 2014: Puppet at backstop another year of lessons

! Cloudstack!

‣ It’s great

‣ Setup was easy

‣ Only using it in test now (so we only kinda care if the machines burn down)

35

That’s the CloudStack monkey, owned by the Apache Software Foundation

Page 36: Puppet Camp Chicago 2014: Puppet at backstop another year of lessons

‣ Remember that puppet-test alias?

‣ That + CloudStack means people can build machines to test Puppet changes to

‣ I was surprised recently by a service that just showed up ready to run in prod, Puppet and all

36

Page 37: Puppet Camp Chicago 2014: Puppet at backstop another year of lessons

You don’t have to use CloudStack, but you need something like it

‣ That could be OpenStack, Vagrant, even some AWS credit

‣ You just need fast to build disposable machines

37

Page 38: Puppet Camp Chicago 2014: Puppet at backstop another year of lessons

" Would be better in prod

‣ We’re not yet running CloudStack in production. It’ll happen someday.

‣ So, while I’m singing its praises, I can’t say we’re all in.

38

Page 39: Puppet Camp Chicago 2014: Puppet at backstop another year of lessons

! create_resources‣ I have to show off one chunk of code

‣ Let me quote from TFM:

39

‣ That’s vague, right? The example in TFM didn’t inspire me either, so I glossed over it for years.

Converts a hash into a set of resources and adds them to the catalog.

Page 40: Puppet Camp Chicago 2014: Puppet at backstop another year of lessons

I already said something about Frank’s Red Hot, right?

Almost everywhere I use it looks like this

40

$thing = loadYaml(“${yamlDir}/thing/${environment}.yaml”)create_resources( some::define, $thing )

That same YAML gets used in a bunch of those.

backstopsolutions: lastOctet: 226 clientFqdn: 'www.backstopsolutions.com' seconddn: 'backstopsolutions.com' includeFile: 'true'

Page 41: Puppet Camp Chicago 2014: Puppet at backstop another year of lessons

‣ One define uses the lastOctet and some knowledge about our systems to set up an interface on the load balancers

‣ Another uses the hostnames to set up a couple of vhosts for the Rails app

‣ Yet another adds it into several DNS zones

41

Page 42: Puppet Camp Chicago 2014: Puppet at backstop another year of lessons

‣ Another benefit: it’s YAML. You don’t have to write it by hand

‣ Grab some external data source, frob as needed, dump out some YAML. As long as you meet the spec, you’ll be fine

42

Page 43: Puppet Camp Chicago 2014: Puppet at backstop another year of lessons

Huge gotcha here

‣ Everything you pass that YAML to needs to do something with all the parameters named in the file

‣ Adding a field thus means changing all those defines

‣ We have a lot of ‘$foo = “dontcare”’ in there. Just come up with an idiom and stick to it

‣ You could probably do something clever to filter out params?

43

Page 44: Puppet Camp Chicago 2014: Puppet at backstop another year of lessons

" Maybe not everything goes in Puppet

‣ Last year I had this slide (included verbatim)

44

Page 45: Puppet Camp Chicago 2014: Puppet at backstop another year of lessons

Well, I can’t always be right

45

Page 46: Puppet Camp Chicago 2014: Puppet at backstop another year of lessons

‣ Think to yourself: do I ever want to do this thing without running Puppet?

‣ Does it make sense for this to go through the same test -> prod cycle?

‣ Do the same people need to see this content as the Puppet manifests?

‣ Can it be generated in one place, or do you need to gather data from several?

46

Page 47: Puppet Camp Chicago 2014: Puppet at backstop another year of lessons

‣ As we’ve grown to more sites and more Puppet masters, this has hurt all over the place

‣ The deploy concept (vs `svn up`) made a mess of the checkin of this derived data

‣ I still think it’s an OK approach, but it needs thought

47

Page 48: Puppet Camp Chicago 2014: Puppet at backstop another year of lessons

Examples

‣ DNS data: there’s only one actual copy of your DNS, and that’s what the world can see. What does a beta machine do with it?

‣ Load balancer configs: multiple datacenters need to know about each other, but can’t see the other’s database to derive config from

48

Page 49: Puppet Camp Chicago 2014: Puppet at backstop another year of lessons

</TechnicalContent>

49

Page 50: Puppet Camp Chicago 2014: Puppet at backstop another year of lessons

Want to help out?We’re hiring

50

‣ Sysadmins

‣ Developers (Rails or Java)

‣ Testers

‣ Lots more

backstopsolutions.com/careers

Page 51: Puppet Camp Chicago 2014: Puppet at backstop another year of lessons

DevOpsDays Chicago!

‣ October 7th and 8th @ the Sears Tower

‣ CFP open until the 22nd

‣ Registration open now! Use code PUPPET_CAMP for 10% off devopsdays.org/events/2014-chicago/registration/

‣ I might be on the committee

51

I refuse to call it the Willis Tower, y’all

Page 52: Puppet Camp Chicago 2014: Puppet at backstop another year of lessons

Puppet Users Group

‣ Hosted by this guy, downtown, ~monthly (coming soon!)

‣ meetup.com/Chicago-Puppet-users-group/

52

Page 53: Puppet Camp Chicago 2014: Puppet at backstop another year of lessons

That’s itQuestions?

53