29
© 2012 VMware, Inc. All rights reserved Cloud Foundry and OpenStack Cloud Foundry, BOSH, and CPIs like OpenStack Vadim Spivak Cloud Foundry Engineering @vadimspivak

Cloud Foundry and OpenStack

Embed Size (px)

Citation preview

Page 1: Cloud Foundry and OpenStack

© 2012 VMware, Inc. All rights reserved

Cloud Foundry and OpenStack

Cloud Foundry, BOSH, and CPIs like OpenStack

Vadim Spivak

Cloud Foundry Engineering

@vadimspivak

Page 2: Cloud Foundry and OpenStack

2

CONFIDENTIAL

Background

Concepts

Contracts

Control

Consistency

Components

Cloud Provider Interface

Agenda

© 2012 VMware, Inc. All rights reserved

Page 3: Cloud Foundry and OpenStack

3

CONFIDENTIAL

Cloud Foundry

BOSH

• Release engineering

• Lifecycle management

• Single tool / Ease of use

• Infrastructure portability

Background

© 2012 VMware, Inc. All rights reserved

Page 4: Cloud Foundry and OpenStack

4

CONFIDENTIAL

Source / Blobs

Packages

Jobs

Releases

Stemcells

Deployments

Concepts

© 2012 VMware, Inc. All rights reserved

Page 5: Cloud Foundry and OpenStack

5

CONFIDENTIAL

-rw-r--r-- 1 vspivak staff 29000 Apr 11 11:16 blob_index.yml

drwxr-xr-x 25 vspivak staff 850 Apr 16 13:07 blobs

drwxr-xr-x 3 vspivak staff 102 Apr 16 12:22 config

drwxr-xr-x 42 vspivak staff 1428 Apr 16 12:22 jobs

drwxr-xr-x 61 vspivak staff 2074 Apr 16 12:22 packages

drwxr-xr-x 61 vspivak staff 2074 Apr 11 11:16 releases

drwxr-xr-x 16 vspivak staff 544 Apr 16 13:40 src

Source / Blobs

© 2012 VMware, Inc. All rights reserved

All deployed software

git (submodules)

bosh blobs

bosh sync blobs

Page 6: Cloud Foundry and OpenStack

6

CONFIDENTIAL

Source / blobs

Dependencies

Versioning

Pre-packaging

Packaging (compilation)

Packages

© 2012 VMware, Inc. All rights reserved

Page 7: Cloud Foundry and OpenStack

7

CONFIDENTIAL

release/packages/redis/spec

Sample Package (Redis)

© 2012 VMware, Inc. All rights reserved

---

name: redis

files:

- redis/redis-2.2.4.tar.gz

release/packages/redis/packaging

set -e

tar zxf redis/redis-2.2.4.tar.gz

(

cd redis-2.2.4

make

make PREFIX=$BOSH_INSTALL_TARGET install

)

Page 8: Cloud Foundry and OpenStack

8

CONFIDENTIAL

release/packages/warden/spec

Sample Package (Warden)

© 2012 VMware, Inc. All rights reserved

---

name: warden

dependencies:

- ruby

files:

- core/warden/**/*

- core/common/bin/fetch_gems

release/packages/warden/packaging

set -o errexit

cp -a * ${BOSH_INSTALL_TARGET}

(

set -o errexit

cd ${BOSH_INSTALL_TARGET}/warden

/var/vcap/packages/ruby/bin/bundle --local install --deployment --without=development test

# Unzip base chroot from stemcell

...

env SKIP_DEBOOTSTRAP=true SKIP_APT=true /var/vcap/packages/ruby/bin/bundle exec rake setup

)

release/packages/warden/pre_packaging

set -e

cd ${BUILD_DIR}

cp -a core/warden .

ruby core/common/bin/fetch_gems /warden/Gemfile ./warden/Gemfile.lock ./warden/vendor/cache

Page 9: Cloud Foundry and OpenStack

9

CONFIDENTIAL

Packages

Templates

Versioned

Supervision

Monitoring

Lifecycle hooks

Jobs

@cloudfoundry

Page 10: Cloud Foundry and OpenStack

10

CONFIDENTIAL

release/jobs/vcap_redis/spec

Sample Job (Redis)

© 2012 VMware, Inc. All rights reserved

---

name: vcap_redis

templates:

vcap_redis_ctl: bin/vcap_redis_ctl

vcap_redis.conf.erb: config/vcap_redis.conf

packages:

- common

- redis

Page 11: Cloud Foundry and OpenStack

11

CONFIDENTIAL

release/jobs/vcap_redis/monit

Sample Job (Redis)

© 2012 VMware, Inc. All rights reserved

check process vcap_redis

with pidfile /var/vcap/sys/run/vcap_redis/vcap_redis.pid

start program "/var/vcap/jobs/vcap_redis/bin/vcap_redis_ctl start"

stop program "/var/vcap/jobs/vcap_redis/bin/vcap_redis_ctl stop"

group vcap

Page 12: Cloud Foundry and OpenStack

12

CONFIDENTIAL

release/jobs/vcap_redis/templates/vcap_redis_ctl

Sample Job (Redis)

© 2012 VMware, Inc. All rights reserved

#!/bin/bash

RUN_DIR=/var/vcap/sys/run/vcap_redis

...

case $1 in

start)

pid_guard $PIDFILE "VCAP Redis"

mkdir -p $RUN_DIR

mkdir -p $LOG_DIR

echo $$ > $PIDFILE

exec /var/vcap/packages/redis/bin/redis-server /var/vcap/jobs/vcap_redis/config/vcap_redis.conf

;;

stop)

kill_and_wait $PIDFILE

;;

*)

echo "Usage: vcap_redis_ctl {start|stop}”

;;

esac

Page 13: Cloud Foundry and OpenStack

13

CONFIDENTIAL

Packages

Jobs

Versioned

Self contained

Incremental

Published

Releases

@cloudfoundry

» bosh create release

» bosh upload release

» bosh delete release

» bosh releases

Page 14: Cloud Foundry and OpenStack

14

CONFIDENTIAL

VM template

BOSH Agent

Versioned

VMBuilder

IaaS Plugin

Stemcells

© 2012 VMware, Inc. All rights reserved

» bosh upload stemcell

» bosh delete stemcell

» bosh stemcells

Page 15: Cloud Foundry and OpenStack

15

CONFIDENTIAL

Release

Networks

Resource pools

Compilation workers

Jobs

Update concurrency

Properties

Cloud properties

Deployments

© 2012 VMware, Inc. All rights reserved

Page 16: Cloud Foundry and OpenStack

16

CONFIDENTIAL

Sample Deployment

© 2012 VMware, Inc. All rights reserved

---

name: wordpress

release:

name: sample

version: 1

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

Page 17: Cloud Foundry and OpenStack

17

CONFIDENTIAL

Sample Deployment

© 2012 VMware, Inc. All rights reserved

networks:

- name: default

subnets:

- reserved:

- 192.0.2.2 - 192.0.2.10

- 192.0.2.200 - 192.0.2.254

static:

- 192.0.2.11 - 192.0.2.100

range: 192.0.2.0/24

gateway: 192.0.2.1

dns:

- 192.0.2.245

- 192.0.2.246

cloud_properties:

name: VLAN2220

Page 18: Cloud Foundry and OpenStack

18

CONFIDENTIAL

Sample Deployment

© 2012 VMware, Inc. All rights reserved

resource_pools:

- name: infrastructure

network: default

size: 6

stemcell:

name: bosh-stemcell

version: 0.4.6

cloud_properties:

cpu: 1

disk: 8192

ram: 4096

Page 19: Cloud Foundry and OpenStack

19

CONFIDENTIAL

Sample Deployment

© 2012 VMware, Inc. All rights reserved

jobs:

- name: mysql

template: mysql

instances: 1

resource_pool: infrastructure

persistent_disk: 16384

networks:

- name: default

static_ips:

- 192.0.2.20

- name: wordpress

template: wordpress

instances: 4

resource_pool: infrastructure

networks:

- name: default

static_ips:

- 192.0.2.30 - 192.0.2.33

Page 20: Cloud Foundry and OpenStack

20

CONFIDENTIAL

Sample Deployment

© 2012 VMware, Inc. All rights reserved

properties:

wordpress:

admin: [email protected]

port: 8008

servers:

- 192.0.2.30

- 192.0.2.31

- 192.0.2.32

- 192.0.2.33

servername: wp.appcloud14.dev.mozycloud.com

db:

name: wp

user: wordpress

pass: w0rdpr3ss

auth_key: random key

secure_auth_key: random key

logged_in_key: random key

nonce_key: random key

Page 21: Cloud Foundry and OpenStack

21

CONFIDENTIAL

Usage

© 2012 VMware, Inc. All rights reserved

» bosh target http://mydirector:25555

» bosh upload stemcell ~/stemcells/stemcell-0.5.5.tgz

» cd sample_release

» bosh create release

» bosh upload release

» bosh deployment ~/deployment/sample.yml

» vim ~/deployment/sample.yml

» bosh deploy

Page 22: Cloud Foundry and OpenStack

22

CONFIDENTIAL

Jobs

Releases

Cloud Provider Interface

Contracts

© 2012 VMware, Inc. All rights reserved

Page 23: Cloud Foundry and OpenStack

23

CONFIDENTIAL

Repeatable deployments

Predictable rollout

Control

© 2012 VMware, Inc. All rights reserved

Page 24: Cloud Foundry and OpenStack

24

CONFIDENTIAL

Dev / Staging / Production

BOSH targets

Consistency

© 2012 VMware, Inc. All rights reserved

Page 25: Cloud Foundry and OpenStack

25

CONFIDENTIAL

Director / Workers

Agent

Monitor

CLI

NATS

Redis

Database

Blobstore

Components

© 2012 VMware, Inc. All rights reserved

Page 26: Cloud Foundry and OpenStack

26

CONFIDENTIAL

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

© 2012 VMware, Inc. All rights reserved

BOSH User

Page 27: Cloud Foundry and OpenStack

27

CONFIDENTIAL

Stemcellcreate_stemcell(image, cloud_properties)delete_stemcell(stemcell)

VMcreate_vm(agent_id, stemcell, resource_pool, networks, disk_locality, env)delete_vm(vm)reboot_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

© 2012 VMware, Inc. All rights reserved

Page 28: Cloud Foundry and OpenStack

28

CONFIDENTIAL

Agent plugin

Bootstrap

BOSH Deployer

Cloud Provider Interface

© 2012 VMware, Inc. All rights reserved

Page 29: Cloud Foundry and OpenStack

29

CONFIDENTIAL

Mailing lists

• http://groups.google.com/a/cloudfoundry.org/group/bosh-users

• http://groups.google.com/a/cloudfoundry.org/group/bosh-dev

File a Bug

• http://cloudfoundry.atlassian.net

Browse, Fork, Contribute

• https://github.com/cloudfoundry/bosh

• gerrit-clone ssh://reviews.cloudfoundry.org:29418/bosh.git

Reference / Q&A

© 2012 VMware, Inc. All rights reserved