Slide 1

Slide 1 text

Automating the Cloud Mat Schaffer CPOSC October 2012

Slide 2

Slide 2 text

Our agenda • Me • You • Old cars • How Chef works • Setting up Chef • An Example deployment

Slide 3

Slide 3 text

Mat Schaffer about.me/matschaffer

Slide 4

Slide 4 text

(for hire)

Slide 5

Slide 5 text

•Linux Sys Admin •PHP & Java •Ruby on Rails •DevOps

Slide 6

Slide 6 text

You

Slide 7

Slide 7 text

Automation & You

Slide 8

Slide 8 text

Expensive ($2k-$3k) Hand made 12.5 hours

Slide 9

Slide 9 text

$850 Heavily Automated 1.5 hours

Slide 10

Slide 10 text

Many early car companies failed by 1930 https://en.wikipedia.org/wiki/List_of_defunct_United_States_automobile_manufacturers

Slide 11

Slide 11 text

Continuous Delivery

Slide 12

Slide 12 text

“... continuous delivery will move from being a competitive advantage to being a prerequisite for survival.” - Jez Humble

Slide 13

Slide 13 text

Configuration Management

Slide 14

Slide 14 text

Chef

Slide 15

Slide 15 text

(Chef server) b my_cookbook $ chef-client $ chef-client my_cookbook my_cookbook $ chef-server my_cookbook ├── README.rdoc ├── attributes ├── definitions ├── files │ └── default ├── libraries ├── metadata.rb ├── providers ├── recipes │ └── default.rb ├── resources └── templates └── default

Slide 16

Slide 16 text

cookbook role node environment

Slide 17

Slide 17 text

Cookbook: mysql default['mysql']['memory'] = "32M" Role: db default_attributes 'mysql' => { 'memory' = "2G" } Environment: dev "mysql" : { "memory": "1G" } Node: db3.dev.mashion.net "mysql" : { "memory": "512M" }

Slide 18

Slide 18 text

Step 1: Get a Chef server

Slide 19

Slide 19 text

http://manage.opscode.com

Slide 20

Slide 20 text

http://devops.mashion.net/chef-install

Slide 21

Slide 21 text

Step 2: Set up your workstation

Slide 22

Slide 22 text

wiki.opscode.com/display/ chef/Workstation+Setup

Slide 23

Slide 23 text

No content

Slide 24

Slide 24 text

No content

Slide 25

Slide 25 text

No content

Slide 26

Slide 26 text

Step 3: Make a cookbook

Slide 27

Slide 27 text

Cookbooks?

Slide 28

Slide 28 text

39 service 'nginx' do 40 action :start 41 end Recipes 1 default['nginx']['version'] = "1.2.3" 2 default['nginx']['dir'] = "/etc/nginx" Attributes 2 DAEMON=<%= @src_binary %> 3 NAME=nginx 4 DESC=nginx 5 PID=<%= @pid %> Templates

Slide 29

Slide 29 text

http://community.opscode.com

Slide 30

Slide 30 text

gem install berkshelf berks install

Slide 31

Slide 31 text

github.com/matschaffer/ cposc-cloud

Slide 32

Slide 32 text

git clone https://github.../matschaffer/cposc-cloud cd cposc-cloud gem install berkshelf berks install berks upload knife role from file roles/* # store cposc-cloud.pem to ./

Slide 33

Slide 33 text

Step 4: Prepare a server

Slide 34

Slide 34 text

No content

Slide 35

Slide 35 text

No content

Slide 36

Slide 36 text

gem install knife-ec2 # in ~/.chef/knife.rb knife[:aws_access_key_id] = "AKI..." knife[:aws_secret_access_key] = "wmw..." knife[:availability_zone] = "us-east-1d" knife[:image] = "ami-8fac75e6" knife[:aws_ssh_key_id] = "cposc-cloud" knife ec2 server create -x ubuntu -i cposc-cloud.pem \ -r 'recipe[cposc-cloud]' github.com/opscode/knife-ec2

Slide 37

Slide 37 text

$ ntpdate pool.ntp.org C:\> w32tm /resync

Slide 38

Slide 38 text

No content

Slide 39

Slide 39 text

Wrap-UP • Automation can save your business • CM is a key part of your automation stack • You can get started today

Slide 40

Slide 40 text

Thank you! about.me/matschaffer