cloud foundry bosh where the platform rubber meets the infrastructure road - chefconf

61
Cloud Foundry BOSH Where the Platform rubber meets the Infrastructure road Patrick Chanezon Senior Director Developer Relations [email protected] http://twitter.com/chanezon ChefConf, San Francisco, May 2012 with slides from Martin Englund Cloud Foundry Engineering @pmenglund Wednesday, May 16, 12

Upload: patrick-chanezon

Post on 06-May-2015

11.793 views

Category:

Technology


4 download

DESCRIPTION

Cloud Foundry is an open source Cloud Platform as a Service "OpenPaaS" project created by VMware. It is multi-language/framework (Java, Ruby, Node), multi-service (MongoDB, Reddis, MySQL, Postgres, RabbitMQ) and multi-cloud (public, private, micro). Cloud Foundry BOSH is an open source tool chain for release engineering, deployment and lifecycle management of large scale distributed services. This presentation will describe the architecture, topology, configuration, and use of BOSH, as well as the structure and conventions used in packaging and deployment. BOSH is the system VMware is using to manage CloudFoundry.com, the Cloud Foundry based service operated by VMware, on several thousand VMs, with 40+ unique node types, 75+ unique software packages, 2x/week updates and 24x7x365 non-stop operation. BOSH is infrastructure independent, and can be used to deploy Cloud Foundry on top of Infrastructure as a Service (IaaS) products such as VMware vSphere, Amazon Web Services, or OpenStack.

TRANSCRIPT

Page 1: Cloud Foundry BOSH Where the Platform rubber meets the Infrastructure road - ChefConf

Cloud Foundry BOSHWhere the Platform rubber

meets the Infrastructure road

Patrick ChanezonSenior DirectorDeveloper [email protected]://twitter.com/chanezon ChefConf, San Francisco, May 2012

with slides from Martin Englund

Cloud Foundry Engineering

@pmenglund

Wednesday, May 16, 12

Page 2: Cloud Foundry BOSH Where the Platform rubber meets the Infrastructure road - ChefConf

What is Cloud Computing?

2

Cloud According to my daughter Eliette

Wednesday, May 16, 12

Page 3: Cloud Foundry BOSH Where the Platform rubber meets the Infrastructure road - ChefConf

Cloud Stack - Classic Pyramid

3

Platform As A Service

Infrastructure As A Service

SoftwareAs A Service

Wednesday, May 16, 12

Page 4: Cloud Foundry BOSH Where the Platform rubber meets the Infrastructure road - ChefConf

Cloud Stack - Developer Perspective

4

InfrastructureAs A Service

SoftwareAs A Service

Platform As A Service

Wednesday, May 16, 12

Page 5: Cloud Foundry BOSH Where the Platform rubber meets the Infrastructure road - ChefConf

5

Infrastructure

Wednesday, May 16, 12

Page 6: Cloud Foundry BOSH Where the Platform rubber meets the Infrastructure road - ChefConf

IaaS/Virtualization getting mainstream

§ AWS, Joyent, Rackspace,...

§ Open Source projects: OpenStack, DeltaCloud, Eucalyptus

§ Automation: Chef, Juju

§ Standardization? DMTF

§ Inside the Firewall, Virtualization: VMware, Microsoft, Xen, KVM

§ 50% of workloads are virtualized

§ Easy to provision, manage instance...BUT

§ Still need to manage backups, software stacks, monitor, upgrades

6

Wednesday, May 16, 12

Page 7: Cloud Foundry BOSH Where the Platform rubber meets the Infrastructure road - ChefConf

With Infrastructure, you still need to build your own platform

§ Need to build a distributed platform on top of you infrastructure

§ Story of the AWS meltdown from last summer• http://blog.reddit.com/2011/03/why-reddit-was-down-for-6-of-last-24.html

• http://www.readwriteweb.com/cloud/2010/12/chaos-monkey-how-netflix-uses.php

• http://news.ycombinator.com/item?id=2477296

• http://stu.mp/2011/04/the-cloud-is-not-a-silver-bullet.html

§ Twilio, Smugmug, SimpleGeo survived it because they built their own distributed platform on top of IaaS

§ Enterprise customers want to consider Infrastructure like CDNs• Multi Cloud usage

• Based on Open Source de facto standards, or full standards whenever that happens

7

Wednesday, May 16, 12

Page 8: Cloud Foundry BOSH Where the Platform rubber meets the Infrastructure road - ChefConf

8

Platforms

Let the wild rumpus begin!

Wednesday, May 16, 12

Page 9: Cloud Foundry BOSH Where the Platform rubber meets the Infrastructure road - ChefConf

Platforms

§ Raise the Unit of currency to be application & services instead of infrastructure

§ Google App Engine, Cloud Foundry, SalesForce Heroku, Cloudbees, Amazon Elastic Beanstalk, Microsoft ex-Azure, AppFog

§ Single or a few languages, services

§ Start of Multi language Polyglot platforms

§ Enabler for Agile Developers -> Create Business value faster

§ Lack of standards: risk, vendor lock-in

§ Enterprise needs:•Control, customizability

•Private/Hybrid Cloud

•Avoid lock-in

9

Wednesday, May 16, 12

Page 10: Cloud Foundry BOSH Where the Platform rubber meets the Infrastructure road - ChefConf

Main Risk: Lock-In

10

Welcome to the hotel californiaSuch a lovely placeSuch a lovely facePlenty of room at the hotel californiaAny time of year, you can find it here

Last thing I remember, I wasRunning for the doorI had to find the passage backTo the place I was before’relax,’ said the night man,We are programmed to receive.You can checkout any time you like,But you can never leave!

Wednesday, May 16, 12

Page 11: Cloud Foundry BOSH Where the Platform rubber meets the Infrastructure road - ChefConf

Cloud Foundry: The Open PaaS

11

Clou

d Pr

ovide

r Int

erfa

ce

Application Service Private Clouds

PublicCloud

MicroCloud

Data Services

Other Services

Msg Services

vFabric Postgres

vFabric RabbitMQTM

• Open Source: Apache 2 Licensed

• multi language/frameworks

• multi services

• multi cloud

Wednesday, May 16, 12

Page 12: Cloud Foundry BOSH Where the Platform rubber meets the Infrastructure road - ChefConf

12

Open Source

Wednesday, May 16, 12

Page 13: Cloud Foundry BOSH Where the Platform rubber meets the Infrastructure road - ChefConf

Open Source Advantage: moves faster

§ http://code.google.com/p/googleappengine/issues/detail?id=13

13

• https://github.com/cloudfoundry/vcap/pull/25

Wednesday, May 16, 12

Page 15: Cloud Foundry BOSH Where the Platform rubber meets the Infrastructure road - ChefConf

Open Source Advantage: more innovation

15

Wednesday, May 16, 12

Page 16: Cloud Foundry BOSH Where the Platform rubber meets the Infrastructure road - ChefConf

16

CloudFoundry.org

Wednesday, May 16, 12

Page 17: Cloud Foundry BOSH Where the Platform rubber meets the Infrastructure road - ChefConf

17

Cloud Foundry Open Source Workflow

Reviewers +2/-2

test verification score ✓ ✗ git push triggers test execution

Gerrit Code Review

reviews.cloudfoundry.org

Jenkins CI

ci.cloudfoundry.org

github

github.com/cloudfoundry

+1/-1 Committers

on +2 and ✓ change pushed to github

cloudfoundry.com

production updated ~2x/week

Wednesday, May 16, 12

Page 18: Cloud Foundry BOSH Where the Platform rubber meets the Infrastructure road - ChefConf

Cloud Foundry is 1 year old

18

§ Services• Caldecott – tunnel into your services, explore with standard client tools

• PostgreSQL, RabbitMQ

§ Frameworks, Runtimes, and Tools• Java and Ruby Auto-Reconfiguration

• Scala, node.JS 0.6.*, Erlang, JRuby, PHP, Python, .NET, Spring 3.1, Grails 2.0, Play 2.0

• Multi-Node Chef based deployment tools

• Maven Plugin, Eclipse Integration

• VMC manifests, Java Debugging, Rails Console

• Standalone applications

§ Micro Cloud Foundry x 3

Wednesday, May 16, 12

Page 19: Cloud Foundry BOSH Where the Platform rubber meets the Infrastructure road - ChefConf

Cloud Foundry is 1 year old

18

§ Services• Caldecott – tunnel into your services, explore with standard client tools

• PostgreSQL, RabbitMQ

§ Frameworks, Runtimes, and Tools• Java and Ruby Auto-Reconfiguration

• Scala, node.JS 0.6.*, Erlang, JRuby, PHP, Python, .NET, Spring 3.1, Grails 2.0, Play 2.0

• Multi-Node Chef based deployment tools

• Maven Plugin, Eclipse Integration

• VMC manifests, Java Debugging, Rails Console

• Standalone applications

§ Micro Cloud Foundry x 3

Wednesday, May 16, 12

Page 20: Cloud Foundry BOSH Where the Platform rubber meets the Infrastructure road - ChefConf

Cloud Foundry Ecosystem

19

Wednesday, May 16, 12

Page 21: Cloud Foundry BOSH Where the Platform rubber meets the Infrastructure road - ChefConf

Cloud Foundry Ecosystem

20

Wednesday, May 16, 12

Page 22: Cloud Foundry BOSH Where the Platform rubber meets the Infrastructure road - ChefConf

Register today

21

http://cloudfoundry.com/signup

ChefConfUse Promo Code

To avoid approval queue waiting time

Wednesday, May 16, 12

Page 23: Cloud Foundry BOSH Where the Platform rubber meets the Infrastructure road - ChefConf

Logical View

22

VMC client STS plugin Browser(user app access)

Routers

CloudControllers App

Services

App

HealthManager

DEA Pool

Messaging

Wednesday, May 16, 12

Page 24: Cloud Foundry BOSH Where the Platform rubber meets the Infrastructure road - ChefConf

23

Cloud Foundry BOSH

Wednesday, May 16, 12

Page 25: Cloud Foundry BOSH Where the Platform rubber meets the Infrastructure road - ChefConf

24

Chef at VMware

§ Chef is used internally in several projects at VMware

§ To manage the Cloud Foundry deployment and Life Cycle, we developed a more specific system: BOSH

Wednesday, May 16, 12

Page 26: Cloud Foundry BOSH Where the Platform rubber meets the Infrastructure road - ChefConf

25

§ 500 – 5,000 VMs

§ 40+ unique node types

§ 75+ unique software packages

§ 75+ unique environments

§ 2x/week cf.com updates

§ 24x7x365 non-stop operation

§ No-downtime deployments

§ Reliable, robust, repeatable deployments, updates, capacity adjustments

§ Small teams manage many instances

Production Grade Cloud Foundry Clusters

Google style problem è Google style solution

cloudfoundry.com

production, staging, stress, qa, dev

Wednesday, May 16, 12

Page 27: Cloud Foundry BOSH Where the Platform rubber meets the Infrastructure road - ChefConf

26

§ Cloud Foundry BOSH is an open source tool-chain for release engineering, deployment, and lifecycle management of large scale distributed services• Prescriptive way of creating releases and managing systems and services

• It is not a collection of shell scripts, not a pile of Perl

§ Built to deploy and manage production-class, large scale clusters• Production grade Cloud Foundry clusters: 500+ VMs, 40+ jobs, 75+ packages

• Multi-node, multi-tier, complex clusters: e.g., our Gerrit/Jenkins Cluster

§ Built for devops usage and scale by a crack team of veterans• A project, not a product: command line interface, YAML, etc.

• Continuous improvement, iterative development, rough edges

Cloud Foundry BOSH

github.com/cloudfoundry/bosh

Wednesday, May 16, 12

Page 28: Cloud Foundry BOSH Where the Platform rubber meets the Infrastructure road - ChefConf

27

§ Background

§ Concepts

§ Demo

§ Workflow

§ Under the hood

BOSH Agenda

Wednesday, May 16, 12

Page 29: Cloud Foundry BOSH Where the Platform rubber meets the Infrastructure road - ChefConf

Background

§ Built from the need to operate cloudfoundry.com• Over 40 different types of VMs

• Hundreds of running instances of VMs

• Pushing at least 2 changes per week

§ End-to-end management• Release engineering

• Deployment

• Lifecycle management

§ Generic solution• Any service

• Any cloud

• Any operating system

28

Wednesday, May 16, 12

Page 30: Cloud Foundry BOSH Where the Platform rubber meets the Infrastructure road - ChefConf

29

§ Packages

§ Jobs

§ Releases• http://github.com/cloudfoundry/bosh-sample-release

§ Stemcells

§ Deployments

Concepts

Wednesday, May 16, 12

Page 31: Cloud Foundry BOSH Where the Platform rubber meets the Infrastructure road - ChefConf

30

§ Source / blobs• Don’t commit large objects in the SCM

§ Dependencies• Compile time dependencies

§ Versioning• Auto-increment

§ Pre-packaging• Preparation for compilation

§ Packaging• Compiling the source

Packages

Wednesday, May 16, 12

Page 32: Cloud Foundry BOSH Where the Platform rubber meets the Infrastructure road - ChefConf

Packages (nginx)

31

src/nginx-rw-r--r-- 1 martin staff 25490 Apr 11 19:17 headers-more-v0.15rc1.tgz-rw-r--r-- 1 martin staff 691501 Apr 11 19:17 nginx-1.0.11.tar.gz-rw-r--r-- 1 martin staff 1556329 Apr 11 19:17 pcre-8.21.tar.gz

Wednesday, May 16, 12

Page 33: Cloud Foundry BOSH Where the Platform rubber meets the Infrastructure road - ChefConf

Packages (nginx)

32

packages/nginx/spec---name: nginxfiles: - nginx/headers-more-v0.15rc1.tgz - nginx/nginx-1.0.11.tar.gz - nginx/pcre-8.21.tar.gz

Wednesday, May 16, 12

Page 34: Cloud Foundry BOSH Where the Platform rubber meets the Infrastructure road - ChefConf

Packages (nginx)

33

packages/nginx/packaging# abort script on any command that exit with a non zero valueset -e

echo "Extracting pcre..."tar xzf nginx/pcre-8.21.tar.gz

echo "Extracting headers-more module..."tar xzf nginx/headers-more-v0.15rc1.tgz

echo "Extracting nginx..."tar xzf nginx/nginx-1.0.11.tar.gz

echo "Building nginx..."cd nginx-1.0.11./configure \ --prefix=${BOSH_INSTALL_TARGET} \ --with-pcre=../pcre-8.21 \ --with-http_ssl_module \ --add-module=../headers-more-v0.15rc1makemake install

Wednesday, May 16, 12

Page 35: Cloud Foundry BOSH Where the Platform rubber meets the Infrastructure road - ChefConf

34

§ Packages• Runtime dependencies

§ Templates• Converting a generalized form to an instance specific file

§ Versioned• Auto increments

§ Supervision• Through monit

§ Monitoring• Reported to the health monitor

§ Lifecycle hooks• E.g. drain workload from job

Jobs

Wednesday, May 16, 12

Page 36: Cloud Foundry BOSH Where the Platform rubber meets the Infrastructure road - ChefConf

Jobs (nginx)

35

jobs/nginx/spec---name: nginx

templates: nginx_ctl: bin/nginx_ctl nginx.conf.erb: config/nginx.conf mime.types: config/mime.types

packages: - nginx

Wednesday, May 16, 12

Page 37: Cloud Foundry BOSH Where the Platform rubber meets the Infrastructure road - ChefConf

Jobs (nginx)

36

jobs/nginx/monitcheck process nginx with pidfile /var/vcap/sys/run/nginx/nginx.pid start program "/var/vcap/jobs/nginx/bin/nginx_ctl start" stop program "/var/vcap/jobs/nginx/bin/nginx_ctl stop" group vcap

Wednesday, May 16, 12

Page 38: Cloud Foundry BOSH Where the Platform rubber meets the Infrastructure road - ChefConf

Jobs (nginx)

37

jobs/nginx/templates/nginx.conf.erbuser root root;worker_processes <%= properties.nginx.workers || 1 %>;

error_log /var/vcap/sys/log/nginx/nginx.error.log;pid /var/vcap/sys/run/nginx/nginx.pid;

events { worker_connections 8192; use epoll;}... upstream wordpress { <% properties.wordpress.servers.each do |server| %> server <%= server %>:<%= properties.wordpress.port %>; <% end %> }

server { listen 80; server_name "<%= properties.wordpress.servername %>"; server_name_in_redirect off;...

Wednesday, May 16, 12

Page 39: Cloud Foundry BOSH Where the Platform rubber meets the Infrastructure road - ChefConf

38

§ Packages

§ Jobs

§ Versioned

§ Self contained

§ Incremental

§ Published

Releases

» bosh create release» bosh upload release» bosh delete release» bosh releases

Wednesday, May 16, 12

Page 40: Cloud Foundry BOSH Where the Platform rubber meets the Infrastructure road - ChefConf

39

§ VM template

§ BOSH Agent

§ Versioned

§ Built using vmbuilder

§ IaaS Plugin

Stemcells

» bosh upload stemcell» bosh delete stemcell» bosh stemcells

Wednesday, May 16, 12

Page 41: Cloud Foundry BOSH Where the Platform rubber meets the Infrastructure road - ChefConf

40

§ Release

§ Networks

§ Resource pools

§ Compilation workers

§ Jobs

§ Update concurrency

§ Properties

§ Cloud properties

Deployments

Wednesday, May 16, 12

Page 42: Cloud Foundry BOSH Where the Platform rubber meets the Infrastructure road - ChefConf

Deployment (wordpress)

41

wordpress.yml---name: bosh-wordpressrelease: name: wordpress version: 3

compilation: workers: 4 network: default cloud_properties: ram: 2048 disk: 8096 cpu: 2

update: canaries: 1 canary_watch_time: 60000 update_watch_time: 30000 max_in_flight: 4 max_errors: 1

Wednesday, May 16, 12

Page 43: Cloud Foundry BOSH Where the Platform rubber meets the Infrastructure road - ChefConf

Deployment (wordpress)

42

wordpress.yml (continued)networks: - name: default subnets: - reserved: - 172.31.220.2 - 172.31.220.10 static: - 172.31.220.11 - 172.31.220.100 range: 172.31.220.0/22 gateway: 172.31.220.1 dns: - 172.30.22.153 cloud_properties: name: VLAN2220 - name: dmz subnets: - static: - 172.28.5.209 - 172.28.5.210 range: 172.28.5.208/28 dns: - 172.22.22.153 cloud_properties: name: VLAN3093

Wednesday, May 16, 12

Page 44: Cloud Foundry BOSH Where the Platform rubber meets the Infrastructure road - ChefConf

Deployment (wordpress)

43

wordpress.yml (continued)resource_pools: - name: infrastructure network: default size: 6 stemcell: name: bosh-stemcell version: 0.4.6 cloud_properties: cpu: 1 disk: 8192 ram: 4096

Wednesday, May 16, 12

Page 45: Cloud Foundry BOSH Where the Platform rubber meets the Infrastructure road - ChefConf

Deployment (wordpress)

44

wordpress.yml (continued)jobs: - name: mysql template: mysql instances: 1 resource_pool: infrastructure persistent_disk: 16384 networks: - name: default static_ips: - 172.31.220.20

- name: wordpress template: wordpress instances: 4 resource_pool: infrastructure networks: - name: default static_ips: - 172.31.220.30 - 172.31.220.33

Wednesday, May 16, 12

Page 46: Cloud Foundry BOSH Where the Platform rubber meets the Infrastructure road - ChefConf

Deployment (wordpress)

45

wordpress.yml (continued) - name: nginx template: nginx instances: 1 resource_pool: infrastructure networks: - name: default default: [dns, gateway] static_ips: - 172.31.220.40 - name: dmz static_ips: - 172.28.5.209

Wednesday, May 16, 12

Page 47: Cloud Foundry BOSH Where the Platform rubber meets the Infrastructure road - ChefConf

Deployment (wordpress)

46

wordpress.yml (continued)properties: wordpress: admin: [email protected] port: 8008 servers: - 172.31.220.30 - 172.31.220.31 - 172.31.220.32 - 172.31.220.33 servername: wordpress.cloudfoundry.com db: name: wp user: wordpress pass: w0rdpr3ss auth_key: random key secure_auth_key: random key logged_in_key: random key mysql: address: 172.31.220.20 port: 3306 password: rootpass nginx: workers: 1

Wednesday, May 16, 12

Page 48: Cloud Foundry BOSH Where the Platform rubber meets the Infrastructure road - ChefConf

BOSH Demo

47

Wednesday, May 16, 12

Page 49: Cloud Foundry BOSH Where the Platform rubber meets the Infrastructure road - ChefConf

Dev Workflow

48

bosh create release

bosh upload release

bosh deployment~/dev.yml

bosh deploy

write code

run tests

git commit

bosh target dev

Wednesday, May 16, 12

Page 50: Cloud Foundry BOSH Where the Platform rubber meets the Infrastructure road - ChefConf

QA Workflow

49

bosh create release

bosh upload release

bosh deployment~/qa.yml

bosh deploy

git pull

run tests

bosh createrelease --final

bosh target qa

bug reports to dev

git commit

Wednesday, May 16, 12

Page 51: Cloud Foundry BOSH Where the Platform rubber meets the Infrastructure road - ChefConf

Ops Workflow

50

bosh upload release

bosh deployment~/prod.yml

bosh deploy

git pull

run tests

bosh target prod

bug reports to dev

done!

Wednesday, May 16, 12

Page 52: Cloud Foundry BOSH Where the Platform rubber meets the Infrastructure road - ChefConf

51

§ Repeatable deployments

§ Predictable rollout

Control

Wednesday, May 16, 12

Page 53: Cloud Foundry BOSH Where the Platform rubber meets the Infrastructure road - ChefConf

52

§ Dev / Staging / Production

§ BOSH targets

Consistency

Wednesday, May 16, 12

Page 54: Cloud Foundry BOSH Where the Platform rubber meets the Infrastructure road - ChefConf

53

§ Director / Workers

§ Agent

§ Monitor

§ CLI

§ NATS

§ Redis

§ Database

§ Blobstore

Components

Wednesday, May 16, 12

Page 55: Cloud Foundry BOSH Where the Platform rubber meets the Infrastructure road - ChefConf

54

BOSH: under the hood

active jobs

diskIaaS CPI

workers

bosh cli

redis nats

stemcellagent

db

blobs

director healthmon

“BOSH is deployed by BOSH”

cloudfoundry.com

BOSH User

Wednesday, May 16, 12

Page 56: Cloud Foundry BOSH Where the Platform rubber meets the Infrastructure road - ChefConf

55

IaaS neutral by design

CPI: code completefunctional status: “work in progress”

vSphere: battle tested implementation, thousands of deploymentsvCloud Director: “work in progress”, 2H 2012

contribute: github.com/cloudfoundry/bosh

Cloud Provider Interface (CPI)

Cloud Foundry BOSH

github.com/piston/openstack-bosh-cpi

Wednesday, May 16, 12

Page 57: Cloud Foundry BOSH Where the Platform rubber meets the Infrastructure road - ChefConf

56

Stemcellcreate_stemcell(image, cloud_properties)delete_stemcell(stemcell)

VMcreate_vm(agent_id, stemcell, resource_pool, networks, disk_locality, env)delete_vm(vm)configure_networks(vm, networks)

Diskcreate_disk(size, vm_locality)delete_disk(disk)attach_disk(vm, disk)detach_disk(vm, disk)

Cloud Provider Interface

Wednesday, May 16, 12

Page 61: Cloud Foundry BOSH Where the Platform rubber meets the Infrastructure road - ChefConf

Acknowledgement

§ Drawings from my daughters Eliette

§ Slides from Mark Lucovsky, Dave McCrory, Derek Collison, Martin Englund

60

Wednesday, May 16, 12