Structure and Opinions - Software Deployments with Cloud Foundry

41
Structure and Opinions Software Deployment with Cloud Foundry Image credit - http://www.rmeoc.org/wp-content/uploads/2016/07/foundry.jpg

Transcript of Structure and Opinions - Software Deployments with Cloud Foundry

background image: 960x540 pixels - send to back of slide and set to 80% transparency

Structure and OpinionsSoftware Deployment with Cloud Foundry

Image credit - http://www.rmeoc.org/wp-content/uploads/2016/07/foundry.jpg

A little about me

• Andrew Ripka

• @rippmn

Twin Cities Cloud Foundry Meetup

Topics

● Structure and Opinions● Introduction to Cloud Foundry● Developer Demo● Elastic Runtime Components● BOSH Components

Setting the StageStructure and Opinions

Structured - Stronger Guarantees

Opinionated - More DefaultsLogs

Lumber

Treehouse

Structure, Frameworks, and Opinions

● Structure - coherent form or organization

● Framework - a basic structure underlying a system,

concept, or text.

● Opinions - Specific Implementation of Something

Introduction to Cloud Foundry

Cloud Foundry gives companies the speed, simplicity and control they need to develop and

deploy applications faster and easier.

• Platform As a Service– Polyglot Runtime supporting multiple languages

and frameworks

– Choice of IaaS Providers

– Choice of Application Services

https://www.cloudfoundry.org/foundation/

Foundation Driven

Certified Distros

https://cloudfoundry.org/certified-platforms/

Essential Elements of Enterprise Platform• Rapid Provisioning• Rapid Application Deployment & Management• Scale Horizontally• Basic Monitoring, Logs & Metrics• No-downtime platform upgrades• Dynamic load balancing and routing• Manage supporting services (data, messaging)• Failure detection and health remediation

http://blog.cloudfoundry.org/2013/10/24/essential-elements-of-an-enterprise-paas/

https://www.youtube.com/watch?v=SSxI9eonBVs

The developer haiku

https://blog.pivotal.io/pivotal-cloud-foundry/products/pivotal-cloud-foundrys-roadmap-for-2016

The operator haiku

Cloud Foundry

Contract: 12 Factor App

Contract: BOSH Release

Contract: Cloud Provider Interface

Culture

Dev

Dev IT Ops

Applications

Runtime Platform

Infrastructure Automation

InfrastructureIT

Ops

IT Ops

Tools

BOSH

Developer DemoUsing Elastic Runtime

Automate App Deployments

Step 1 - Upload

Upload application files via the Platform Controller API

Step 2 - Stage

Take application files and package with other dependencies into the container file

Step 3 - Distribute

Platform controller schedules (assigns) the container to cluster cell

Step 4 - Run

Assigned cluster cell starts application using provided metadata and informs the platform load balancer/router that application traffic can be routed to container endpoint

Elastic Runtime High Level Architecture

Cloud Foundry Elastic Runtime

Dynamic Router

OAuth 2.0 Server (UAA)

CELL

Garden

Build Packs

Login Server

CC & CC Bridge

Blob Store

BBS/etcd

Sys Log

Serv

ice

Bro

kers

Collector App Log

ROUTING

AUTHENTICATION

APP LIFECYCLE

APP STORAGE& EXECUTION

MESSAGING

METRICS & LOGGING

Cloud Foundry BOSH

BBS Converger

Elastic Runtime What You Care About

• Cloud Controller

• Applications

• Buildpacks

• Services

• Service Brokers

• Routing

• Health Management

• Loggregator

Cloud Foundry Elastic Runtime

Dynamic Router

APP HOSTS

App

Build Packs

Loggregator

Serv

ice

Bro

kers

ROUTING

AUTHENTICATION

APP STORAGE& EXECUTION

METRICS & LOGGING

Cloud Foundry BOSH

Cloud Controller

App AppApp

Applications

Source code and application frameworks used by developers to create application

– Java/Spring

– Ruby/Rails

– JavaScript for Node.js

– .Net

– others

Cloud Controller

• Restful API to allow clients to access platform functionality • Several Clients exist to call functionality

– Command Line Interface

– Apps Manager

– IDE Plugins

Cloud Controller API

http://apidocs.cloudfoundry.org

Cloud Foundry CLI

• CLI is a RESTful client to Cloud Controller• Commands Structured as CF <<command>> <<parameters>>• Built in Architecture for Plugin extensions• Getting help

– cf –h returns available commands– cf <<command>> -h returns help for a specific command

• Includes ability to write plugins to extend

Buildpacks

• A Buildpack is a combination of scripts that will combine the application with the frameworks and runtimes necessary to deploy

• Written as scripts that:

– Detect if buildpack should be applied

– Compile container file by combining application code and defined runtime components

– Release describe how app container can be deployed to an assigned container host

• Installed into a Cloud Foundry instance or loaded from an external location

• Monitor applications to determine version, current state, and number of instances and status via health checks

• On changes Determine desired application state and instances from cloud controller and converges to desired state

Health Management

Services

• Services are an add on that can be provisioned to provide service an application

– Databases (MySQL, Mongo, Redis) and Rabbit MQ

• Marketplace service instances are created and bound using a Service Broker

• Bound services connection information is placed in application environment variable

Service Broker

• Restful endpoint that provides contract allowing self service creation and binding to apps by authorized users

– create

– delete

– bind

– unbind

– catalog

• Router shapes and routes all external system traffic (HTTP/API/TCP)– maintains a dynamic routing table for each load-balanced

app instance• URL Routes to applications consist of domain, host, and

optionally a path• Applications are either assigned route based upon application

name or defined host• Allows extension through Route Services

Router and URL Routes

• Applications write logs to STDOUT and STDERR• Relevant Cloud Foundry component events added to

application stream• Log events collected, collated, and expose via API and the

firehose • API Allows application users and operators to:

– Tail their application logs– Dump a recent set of application logs– Continually drain their application logs to 3rd party log

archive and analysis service

Loggregator

Automated Systems BOSH

What Is BOSH?

• BOSH is an open source tool chain for release engineering, deployment, and lifecycle management of large-scale distributed services.

• BOSH was specifically developed to facilitate the deployment of Cloud Foundry

• BOSH Interacts with IaaS via Cloud Provider Interface (CPI)

BOSH Architecture

DB Blob Store

Worker NATSHealth Monitor

CPI

DirectorCLI

Inner shell

Outer shellAgents

Cloud Provider Interface

Stemcell▪ create_stemcell(image, cloud_properties)▪ delete_stemcell(stemcell_id)

VM▪ create_vm(agent_id, stemcell_id, resource_pool,

networks, disk_locality, env)▪ delete_vm(vm_id)▪ reboot_vm(vm_id)▪ has_vm(vm_id)▪ set_vm_metadata(vn_id, metadata)▪ configure_networks(vm_id, networks)

Cloud Provider Interface

Diskcreate_disk(size, vm_locality)delete_disk(disk_id)attach_disk(vm_id, disk_id)detach_disk(vm_id, disk_id)has_disk(disk_id)get_disks(disk_id, metadata)

Disk Snapshotssnapshot_disk(disk_id, metadata)delete_snapshot (disk_id)current_vm_id(vm_id)

BOSH Delivery Concepts

• Stemcells• Release• Deployment

Stemcell

• Base OS System

• BOSH Agent

• Same for all Infrastructures

• No specific info about software to be installed

• Wrapped in IaaS packaging that allows fast cloning▪ vSphere - VMDK

▪ AWS – AMI

▪ Google Compute - Image

Release

• Versioned collection of:

– configuration properties

– configuration templates

– start up scripts

– source code

– binary artifacts

– Other stuff (like config)

• Collection of VMs (1 or more)• Built from stemcells• Populated with Releases and Persistent Disk

Deployment

background image: 960x540 pixels - send to back of slide and set to 80% transparency

Any Questions?

http://i.onionstatic.com/avclub/6077/85/16x9/960.jpg