1 DevOp vs 1.000 servers - Amazon EC2 and Chef automation intro

41
1 Admin vs. 1.000 Servers phpunconf Hamburg 2011 Thomas Metschke @tmetschke 2011/09/10 Peritor GmbH DevOp

description

Short intro into Chef and infrastructure automation on the phpunconf in Hamburg, Germany

Transcript of 1 DevOp vs 1.000 servers - Amazon EC2 and Chef automation intro

Page 1: 1 DevOp vs 1.000 servers - Amazon EC2 and Chef automation intro

1 Admin vs. 1.000 Serversphpunconf Hamburg 2011

Thomas Metschke@tmetschke2011/09/10Peritor GmbH

DevO

p

Page 2: 1 DevOp vs 1.000 servers - Amazon EC2 and Chef automation intro

Peritor GmbH

Consulting, development and workshops since 2005

2

DatabasesSelectionIntegrationMigration

Ruby & RoRCode ReviewSecurity ReviewWorkshopsDevelopment

PerformanceAnalysisOptimization

AutomationDeploymentWorkflowsClusters

Page 3: 1 DevOp vs 1.000 servers - Amazon EC2 and Chef automation intro

3

Page 4: 1 DevOp vs 1.000 servers - Amazon EC2 and Chef automation intro

EC2 & EucalyptusCluster Management

Automatic Configuration

Self Healing Clusters

Auto Scaling Clusters

One Click Deployment

One Click Cluster Cloning

Monitoring & Alerting

Logs & Accounting

Firewalls & Backups

Access & Rights Management

4

Page 5: 1 DevOp vs 1.000 servers - Amazon EC2 and Chef automation intro

Project life cycle

Production & Growth

Concept & Developme

nt

Maturity &Decline

Niche /EOL

5

Page 6: 1 DevOp vs 1.000 servers - Amazon EC2 and Chef automation intro

Cloud Computing

6

Page 7: 1 DevOp vs 1.000 servers - Amazon EC2 and Chef automation intro

7

Page 8: 1 DevOp vs 1.000 servers - Amazon EC2 and Chef automation intro

8

Amazon Elastic Compute Cloud

Virtual servers via API call

Pay per hour

Different instance types in different regions

Page 9: 1 DevOp vs 1.000 servers - Amazon EC2 and Chef automation intro

9

Regions and Availability Zones

Regions Multiple Availability Zones

Slightly different costs

Availability Zones 4 x US-east – Northern Virginia

3 x US-west – Northern California

3 x EU-west – Ireland

2 x AP-southeast – Singapore

2 x AP-northeast – Tokyo

Page 10: 1 DevOp vs 1.000 servers - Amazon EC2 and Chef automation intro

10

Server types

RAM Cores x ECU Arch Hourly Cost (US-East)

Monthly Cost(US-East)

Standard

Small 1.7 GB 1 x 1 32bit $0.085 $62

Large 7.5 GB 2 x 2 64bit $0.34 $248

Extra Large 15 GB 4 x 2 64bit $0.68 $496

High-Memory

Extra Large 17.1 GB

2 x 3.25 64bit $0.50 $366

Double Extra Large 34.2 GB

4 x 3.25 64bit $1.00 $732

Quadruple Extra Large

68.4 GB

8 x 3.25 64bit $2.00 $1464

High-CPU

Medium 1.7 GB 2x 2.5 32bit $0.17 $124

Extra Large 7 GB 8 x 2.5 64bit $0.68 $496

Page 11: 1 DevOp vs 1.000 servers - Amazon EC2 and Chef automation intro

11

Amazon EC2 additional services

Elastic Load Balancing

Virtual Private Cloud 

Elastic IP

CloudWatch

Spot instances

Elastic Block Storage

And a lot more …

Page 12: 1 DevOp vs 1.000 servers - Amazon EC2 and Chef automation intro

12

Amazon EC2

Page 13: 1 DevOp vs 1.000 servers - Amazon EC2 and Chef automation intro

13

Storage &IP Addresses

Page 14: 1 DevOp vs 1.000 servers - Amazon EC2 and Chef automation intro

14

Single AZ Deployment

Page 15: 1 DevOp vs 1.000 servers - Amazon EC2 and Chef automation intro

15

Multi AZ Deployment

Page 16: 1 DevOp vs 1.000 servers - Amazon EC2 and Chef automation intro

Amazon EC2 is

16

Infrastructure as a Service

Page 17: 1 DevOp vs 1.000 servers - Amazon EC2 and Chef automation intro

What you can build fast

17

Page 18: 1 DevOp vs 1.000 servers - Amazon EC2 and Chef automation intro

18

But what if …

Page 19: 1 DevOp vs 1.000 servers - Amazon EC2 and Chef automation intro

Heal and restore

19

Page 20: 1 DevOp vs 1.000 servers - Amazon EC2 and Chef automation intro

Scaling up and down

Manual Time APILoad

20

Different triggers make it possible to scale any part of the infrastructure or create new clusters

Page 21: 1 DevOp vs 1.000 servers - Amazon EC2 and Chef automation intro

Deployment

21

ClusterApplication

Handle deployments of applications out of source control systems or via http downloads. Allow update code on running servers. User management and GUI.

Page 22: 1 DevOp vs 1.000 servers - Amazon EC2 and Chef automation intro

Automationis needed

flickr.com/photos/torek/378818160322

Configuration Healing Scaling Deployment

Page 23: 1 DevOp vs 1.000 servers - Amazon EC2 and Chef automation intro

23

Chef– short intro

Page 24: 1 DevOp vs 1.000 servers - Amazon EC2 and Chef automation intro

24

Chef

Open Source Provisioning Tool Configures your servers

Cookbooks & recipes

Ruby DSL

Page 25: 1 DevOp vs 1.000 servers - Amazon EC2 and Chef automation intro

25

Chef Solo/Client

ChefSolo JSON

Cookbooks

(re)configurepushconfiguration

Page 26: 1 DevOp vs 1.000 servers - Amazon EC2 and Chef automation intro

26

Cookbooks

Cookbooks

apache2

memcached

mysql

zend

Page 27: 1 DevOp vs 1.000 servers - Amazon EC2 and Chef automation intro

27

Memcached Cookbook

Cookbooks

memcached

attributes

recipes

templates

Page 28: 1 DevOp vs 1.000 servers - Amazon EC2 and Chef automation intro

28

Memcached Cookbook

memcached

attributes

default.rb

recipes

service.rb

install.rb

templates

default

memcached.conf.erb

Page 29: 1 DevOp vs 1.000 servers - Amazon EC2 and Chef automation intro

29

Attributes

Set default values for variables to use in recipes & templates

cookbooks/memcached/attributes/default.rb

Page 30: 1 DevOp vs 1.000 servers - Amazon EC2 and Chef automation intro

30

Recipes

Actual instructions to execute

cookbooks/memcached/recipes/service.rb

Page 31: 1 DevOp vs 1.000 servers - Amazon EC2 and Chef automation intro

31

Recipes

cookbooks/memcached/recipes/install.rb

Page 32: 1 DevOp vs 1.000 servers - Amazon EC2 and Chef automation intro

32

Templates

cookbooks/memcached/templates/default/memcached.conf.erb

Page 33: 1 DevOp vs 1.000 servers - Amazon EC2 and Chef automation intro

33

/etc/chef/solo.json (configuration JSON)

Chef Solo Run

Run Chef solo

Page 34: 1 DevOp vs 1.000 servers - Amazon EC2 and Chef automation intro

Let’s talk about cute little Monsters

34

Page 35: 1 DevOp vs 1.000 servers - Amazon EC2 and Chef automation intro

Monster World

1.6 million DAU 8.2 million MAU Peak 130 servers ~ 240.000

requests per minute on average

35

Page 36: 1 DevOp vs 1.000 servers - Amazon EC2 and Chef automation intro

Basic architecture

36

Load Balancer

App Server

App Server

App Server

App Server

App Server

App Server

Slave DBs

DBs

EBS Volume

S3

App Server

All configuration, management and deployment through Scalarium.No other tools needed.

App Server

EBS Volume

Page 37: 1 DevOp vs 1.000 servers - Amazon EC2 and Chef automation intro

Flexibility and Scalability

1:5 facebook1:20 local social networks

Page 38: 1 DevOp vs 1.000 servers - Amazon EC2 and Chef automation intro

Flexibility and Scalability

Cost savings of ~ 40%!

Page 39: 1 DevOp vs 1.000 servers - Amazon EC2 and Chef automation intro

39

DEMO?

Page 40: 1 DevOp vs 1.000 servers - Amazon EC2 and Chef automation intro

40

Want to try Scalarium

SignUp on

http://scalarium.com

and use it for free as long as you are in test & dev mode

Chef examples and guides

https://github.com/scalarium/example-cookbooks

http://wiki.opscode.com/display/chef/Resources

Page 41: 1 DevOp vs 1.000 servers - Amazon EC2 and Chef automation intro

© Peritor GmbH - Alle Rechte vorbehalten / all rights reserved

Peritor GmbHBlücherstr. 22, Hof III Aufgang 610961 Berlin

Tel.: +49 (0)30 69 20 09 84 0Fax: +49 (0)30 69 20 09 84 9

Internet: www.peritor.comE-Mail: [email protected]