120
BUILD YOUR VERY OWN PRIVATE CLOUD FOUNDRY MATT STINE COMMUNITY ENGINEER, CLOUD FOUNDRY [email protected] HTTP://CLOUDFOUNDRY.ORG TWITTER: @MSTINE

Build Your Very Own Private Cloud Foundry

Embed Size (px)

DESCRIPTION

Speaker: Matt Stine This session will focus on how you can build your very own Cloud Foundry private PaaS running in your own data center or on AWS or even on OpenStack on your own Mac mini. You will learn how the Cloud Foundry BOSH tool constructs a full Cloud Foundry instance from a bare bones virtual machine and continues to coordinate and manage the entire PaaS cloud once it is operational. If you want the convenience of developing against your own private custom PaaS within your company, then this session will give you all the steps you need to get started.

Citation preview

Page 1: Build Your Very Own Private Cloud Foundry

BUILD YOUR VERY OWN PRIVATE CLOUD FOUNDRY

MATT STINECOMMUNITY ENGINEER, CLOUD FOUNDRY

[email protected]://CLOUDFOUNDRY.ORG

TWITTER: @MSTINE

Page 2: Build Your Very Own Private Cloud Foundry

•CF Architecture - Quick Overview

•What is BOSH? Why BOSH?

•BOSH Architecture

•BOSH Releases

•BOSH Deployments

•CF to BOSH: cf-release

•[:vsphere, :openstack, :aws].each { |iaas| iaas.deploy_cf }

Agenda

Page 3: Build Your Very Own Private Cloud Foundry

Cloud Foundry Architecture(in FIVE minutes or less!)

Page 4: Build Your Very Own Private Cloud Foundry

Cloud Foundry ArchitectureRouter

DEA  Pool    

Apps

Build  Packs

Service  Broker

Service  Nodes

Messaging

User  Authen=ca=on  and  Authoriza=on

Cloud  ControllerHealth  Manager

Page 5: Build Your Very Own Private Cloud Foundry

•Load balancing

•Maintain routing table

•Access logs

Router

PLATFORM

MARKETING ORG FINANCE ORG ENGINEERING ORG

TESTDEV PROD TESTDEV PROD TESTDEV PROD

A S S S A S A S A A A

ROUTER

app1

.mktg

.acme.c

om

app3

.fina

nce.

acm

e.co

m

app2.eng.acme.com

Page 6: Build Your Very Own Private Cloud Foundry

UAA

•Token Server

•ID Server (User management)

•OAuth Scopes (Groups)

•Login Server

• UAA Database

• SAML support (for SSO integration) and Active Directory support with the VMWare SSO Appliance

•Access auditing

Page 7: Build Your Very Own Private Cloud Foundry

Cloud Controller

• App expected state

• Permissions/Auth

• Orgs/Spaces/Users

• Services management

• App placement

• App desired state convergence

• Auditing/Journaling

• Billing events

• Blob storage

Page 8: Build Your Very Own Private Cloud Foundry

Messaging (NATS)

•Non-Persistent messaging

•Pub/Sub

•Queues (app events)

•Directed messages (INBOX)

Page 9: Build Your Very Own Private Cloud Foundry

Droplet Execution Agent (DEA)

•Manage Linux containers (Warden)

• Process

• File system

• Network

• Memory

•Manage app lifecycle

•App log and file streaming

•DEA heartbeats (NATS to CC, HM)

DEA/Warden

Router

App

App

AppApp

DEA/Warden

Page 10: Build Your Very Own Private Cloud Foundry

Health Manager

•Maintains the actual state of apps

•Compares to expected state

•Sends suggestions to make actual match expected

App

App

App

DesiredState

App

App

App

ActualState

HARMONIZER

CloudController

DEA

NATSBulk API

SCHEDULER

NUDGER

NATS

NATS

Observes Observes

Schedule Observation

TriggerHarmonization

HealthManager

Page 11: Build Your Very Own Private Cloud Foundry

Service Broker

•Advertising service catalog

•Makes create/delete/bind/unbind calls to service nodes

•Requests inventory of existing instances and bindings from cloud controller for caching, orphan management

•SaaS marketplace gateway

Page 12: Build Your Very Own Private Cloud Foundry

CF Architecture: Why?

•Component Isolation

•Scalability

•Fault Tolerance

•Pre-provisioned Capacity (Containers / Warden)

Page 13: Build Your Very Own Private Cloud Foundry

How do we manage this thing?

Page 14: Build Your Very Own Private Cloud Foundry

We need a toolchain that can manage a large distributed system through:•Deployment

•Configuration Changes

•Updates/Upgrades (w/ minimal - zero - downtime!)

•Component Failure / Restoration of Service

•Scale Out / Scale In

•Across multiple IaaS providers: vSphere, OpenStack, AWS, and beyond...

Page 15: Build Your Very Own Private Cloud Foundry

What about?

Page 16: Build Your Very Own Private Cloud Foundry

BOSH!(Bosh Outer SHell)

Page 17: Build Your Very Own Private Cloud Foundry

What is BOSH?

Page 18: Build Your Very Own Private Cloud Foundry

Why BOSH?

•Provision services, not machines

•Eliminate bespoke automation on top of configuration management

•Enable continuous delivery of platform services

•Cloud-agnostic view of platform operations

•Holistic toolchain to “rule them all”

•How we manage Cloud Foundry in production!

Page 19: Build Your Very Own Private Cloud Foundry

BOSH Architecture

Page 20: Build Your Very Own Private Cloud Foundry

BOSH Architecture

Page 21: Build Your Very Own Private Cloud Foundry

Director

•Core orchestrating component

•Controls:

• creation/deletion of VMs, Disks, Networks

• software deployment

• lifecycle events for software and services

•Via:

• Cloud Provider Interface

• Director-Agent Interaction

Page 22: Build Your Very Own Private Cloud Foundry

Agent

•Carries out instructions from the Director

•Fetches packages/jobs from Blobstore

•Installs packages/jobs onto VM

•Starts/monitors jobs via Monit

Page 23: Build Your Very Own Private Cloud Foundry

Message Bus (NATS)

•Non-Persistent messaging

•Pub/Sub

•Queues (app events)

•Directed messages (INBOX)

Page 24: Build Your Very Own Private Cloud Foundry

Health Monitor

•Receives from Agent:

• VM health status

• Agent lifecycle events

•Triggers:

• Alerts (Email, CloudWatch, DataDog, PagerDuty, ...)

• Resurrection!

Page 25: Build Your Very Own Private Cloud Foundry

Stemcells

•“Pleuripotent” VMs

• Base VM filesystem image

• Never booted

• Currently ~Ubuntu 10.04.4 LTS

• Embedded BOSH Agent

Page 26: Build Your Very Own Private Cloud Foundry

Blobstore• Stores the content of BOSH Releases

• Uploaded via BOSH CLI

• Stored via Director

• Also stores:

• packages compiled by BOSH

• intermediate location for large payloads

• Options:

• EMC Atmos

• S3

• OpenStack Swift

• Simple/Local

Page 27: Build Your Very Own Private Cloud Foundry

Cloud Provider Interface (CPI)• current_vm_id

• create_stemcell

• delete_stemcell

• create_vm

• delete_vm

• has_vm?

• reboot_vm

• set_vm_metadata

• configure_networks

• create_disk

• delete_disk

• attach_disk

• snapshot_disk

• delete_snapshot

• detach_disk

• get_disks

Page 28: Build Your Very Own Private Cloud Foundry

Great! So how do I deploy my stuff with BOSH?

Page 29: Build Your Very Own Private Cloud Foundry

BOSH Releases

Page 30: Build Your Very Own Private Cloud Foundry

Redis

Hello BOSH Release!

Page 31: Build Your Very Own Private Cloud Foundry
Page 32: Build Your Very Own Private Cloud Foundry

Anatomy of a BOSH Release

•Release Manifest

• Package

•spec

•packaging

• Job

•spec

•monit

•templates

Page 33: Build Your Very Own Private Cloud Foundry

Release Manifest

redis-boshrelease/releases/redis-1.yml

Page 34: Build Your Very Own Private Cloud Foundry

Package

redis-boshrelease/packages/redis/spec

Page 35: Build Your Very Own Private Cloud Foundry

Packages

redis-boshrelease/packages/redis/packaging

Page 36: Build Your Very Own Private Cloud Foundry

Jobs

redis-boshrelease/jobs/redis/spec

Page 37: Build Your Very Own Private Cloud Foundry

Jobs

http://mmonit.com/monit

redis-boshrelease/jobs/redis/monit

Page 38: Build Your Very Own Private Cloud Foundry

Jobs

redis-boshrelease/jobs/redis/templates/bin/redis_ctl

Page 39: Build Your Very Own Private Cloud Foundry

Jobs

redis-boshrelease/jobs/redis/templates/conf/redis.conf.erb

Page 40: Build Your Very Own Private Cloud Foundry

OK. So what happens when I deploy?

Page 41: Build Your Very Own Private Cloud Foundry

BOSH Agent

Page 42: Build Your Very Own Private Cloud Foundry

Director creates VM from Stemcell

Director VM

CPI

Page 43: Build Your Very Own Private Cloud Foundry

Agent Boots

Director VM

Page 44: Build Your Very Own Private Cloud Foundry

Director Pings Agent

Director VMNATS

Page 45: Build Your Very Own Private Cloud Foundry

Director Assigns Job to Agent

Director VMNATS

Page 46: Build Your Very Own Private Cloud Foundry

Agent Fetches Blobs from Blobstore

BlobstoreVMHTTP

Page 47: Build Your Very Own Private Cloud Foundry

Agent Starts Jobs

Director VM

http://mmonit.com/monit

Page 48: Build Your Very Own Private Cloud Foundry

Now let’s go outside-in!

Page 49: Build Your Very Own Private Cloud Foundry

BOSH Deployments

Page 50: Build Your Very Own Private Cloud Foundry

Deployment Manifests

• The mapping of a BOSH release to infrastructure

• Specifies:

• Release

• Compilation VMs

• Update (canary) settings

• Network configuration

• Resource pools (VM “templates”)

• Jobs

• Job Properties

Page 51: Build Your Very Own Private Cloud Foundry
Page 52: Build Your Very Own Private Cloud Foundry

redis-boshrelease/examples/aws-solo.yml

Page 53: Build Your Very Own Private Cloud Foundry

redis-boshrelease/examples/aws-solo.yml

Page 54: Build Your Very Own Private Cloud Foundry

redis-boshrelease/examples/aws-solo.yml

Page 55: Build Your Very Own Private Cloud Foundry

redis-boshrelease/examples/aws-solo.yml

Page 56: Build Your Very Own Private Cloud Foundry

cf-release

Page 57: Build Your Very Own Private Cloud Foundry

Let’s follow one of our components...

• GoRouter

• Release Manifest

• Package

• spec

• packaging

• Job

• spec

• monit

• templates

Page 58: Build Your Very Own Private Cloud Foundry

Release Manifest

cf-release/releases/cf-release-134.yml

Page 59: Build Your Very Own Private Cloud Foundry

Package

cf-release/packages/gorouter/spec

Page 60: Build Your Very Own Private Cloud Foundry

Package

cf-release/packages/gorouter/packaging

Page 61: Build Your Very Own Private Cloud Foundry

Job

cf-release/jobs/gorouter/spec

Page 62: Build Your Very Own Private Cloud Foundry

Jobs

cf-release/jobs/gorouter/monit

http://mmonit.com/monit

Page 63: Build Your Very Own Private Cloud Foundry

Jobs

cf-release/jobs/gorouter/templates/gorouter_ctl.erb

Page 64: Build Your Very Own Private Cloud Foundry

Jobs

cf-release/jobs/gorouter/templates/gorouter_yml.erb

Page 65: Build Your Very Own Private Cloud Foundry

Cloud Foundry on vSphere

Page 66: Build Your Very Own Private Cloud Foundry

vSphere 101

• Minimum Lab HW:

• 6 Cores (12 threads)

• 64 GB RAM

• 4 TB Disk

• vSphere 5.1 (2 ESXi hosts, 1 vCenter)

• can get 30 day evals!

• iSCSI Data Store (http://www.openfiler.com/)

• Available IP addresses = 2X number of VMs

• https://github.com/cloudfoundry-community/vsphere-home-lab

Page 67: Build Your Very Own Private Cloud Foundry
Page 68: Build Your Very Own Private Cloud Foundry
Page 69: Build Your Very Own Private Cloud Foundry

BOSH Bootstrap

•Provide vCenter Credentials (via http://fog.io/)

•Provide Network Settings

•Provide vCenter Settings (Datacenter, Cluster, ...)

•Provide NTP Settings

•Provide MicroBOSH VM Sizing

•Provision MicroBOSH!

Page 70: Build Your Very Own Private Cloud Foundry

BOSH Bootstrap Deploy

Page 71: Build Your Very Own Private Cloud Foundry
Page 72: Build Your Very Own Private Cloud Foundry
Page 73: Build Your Very Own Private Cloud Foundry

BOSH Prepare CF

Page 74: Build Your Very Own Private Cloud Foundry
Page 75: Build Your Very Own Private Cloud Foundry

vSphere Deployment Manifest

Page 76: Build Your Very Own Private Cloud Foundry

vSphere Deployment Manifest

Page 77: Build Your Very Own Private Cloud Foundry

vSphere Deployment Manifest

Page 78: Build Your Very Own Private Cloud Foundry

vSphere Deployment Manifest

Page 79: Build Your Very Own Private Cloud Foundry

http://xip.io

Page 80: Build Your Very Own Private Cloud Foundry

BOSH Create CF

Page 81: Build Your Very Own Private Cloud Foundry
Page 82: Build Your Very Own Private Cloud Foundry

Cloud Foundry on AWS

Page 83: Build Your Very Own Private Cloud Foundry

AWS 101

•Requirements:

• AWS Credentials

• Capacity to provision 8 servers and 3 elastic IPs

• Approximately $0.42/hour you keep it running (us-east-1/us-west-1)

• Manually configured security group for CF

Page 84: Build Your Very Own Private Cloud Foundry
Page 85: Build Your Very Own Private Cloud Foundry
Page 86: Build Your Very Own Private Cloud Foundry
Page 87: Build Your Very Own Private Cloud Foundry

BOSH Bootstrap

•Provide AWS Credentials (via http://fog.io/)

•Provide AWS Region

•Provision MicroBOSH!

Page 88: Build Your Very Own Private Cloud Foundry

BOSH Bootstrap Deploy

Page 89: Build Your Very Own Private Cloud Foundry
Page 90: Build Your Very Own Private Cloud Foundry

BOSH Prepare CF

Page 91: Build Your Very Own Private Cloud Foundry
Page 92: Build Your Very Own Private Cloud Foundry

AWS Deployment Manifest

Page 93: Build Your Very Own Private Cloud Foundry

AWS Deployment Manifest

Page 94: Build Your Very Own Private Cloud Foundry

AWS Deployment Manifest

Page 95: Build Your Very Own Private Cloud Foundry

AWS Deployment Manifest

Page 96: Build Your Very Own Private Cloud Foundry

BOSH Create CF

Page 97: Build Your Very Own Private Cloud Foundry

Create ‘cf’ Security Group

Page 98: Build Your Very Own Private Cloud Foundry

Allocate Elastic IP for CF Router

Page 99: Build Your Very Own Private Cloud Foundry
Page 100: Build Your Very Own Private Cloud Foundry

Cloud Foundry on OpenStack

Page 101: Build Your Very Own Private Cloud Foundry

OpenStack 101

•Requirements:

• OpenStack Credentials

• Capacity to provision 8 servers and 3 floating IPs

• Manually configured security group for CF

Page 102: Build Your Very Own Private Cloud Foundry

BOSH Bootstrap

•Provide OpenStack Credentials (via http://fog.io/)

•Provide OpenStack Region (optional)

•Provision MicroBOSH!

Page 103: Build Your Very Own Private Cloud Foundry

BOSH Bootstrap Deploy

Page 104: Build Your Very Own Private Cloud Foundry
Page 105: Build Your Very Own Private Cloud Foundry

BOSH Prepare CF

Page 106: Build Your Very Own Private Cloud Foundry

OpenStack Deployment Manifest

Page 107: Build Your Very Own Private Cloud Foundry

OpenStack Deployment Manifest

Page 108: Build Your Very Own Private Cloud Foundry

OpenStack Deployment Manifest

Page 109: Build Your Very Own Private Cloud Foundry

OpenStack Deployment Manifest

Page 110: Build Your Very Own Private Cloud Foundry

BOSH Create CF

Page 111: Build Your Very Own Private Cloud Foundry

Create ‘cf’ Security Group

Page 112: Build Your Very Own Private Cloud Foundry

Allocate Floating IP for CF Router

Page 113: Build Your Very Own Private Cloud Foundry
Page 114: Build Your Very Own Private Cloud Foundry

Web Console UI

Page 115: Build Your Very Own Private Cloud Foundry
Page 116: Build Your Very Own Private Cloud Foundry

Edit src/main/resources/styx.properties

Page 117: Build Your Very Own Private Cloud Foundry

mvn clean package

Page 118: Build Your Very Own Private Cloud Foundry

cf push!

Page 119: Build Your Very Own Private Cloud Foundry
Page 120: Build Your Very Own Private Cloud Foundry

THANK YOU!

MATT STINECOMMUNITY ENGINEER, CLOUD FOUNDRY

[email protected]://WWW.CLOUDFOUNDRY.COM

TWITTER: @MSTINE