how appfog built a paas around cloudfoundry€¦ · cloud infrastructure [...] applications created...

55
How AppFog Built a PaaS around CloudFoundry Jeremy Voorhis Senior Engineer, AppFog Inc [email protected] @jvoorhis http://www.appfog.com Thursday, March 8, 12

Upload: others

Post on 22-Jun-2020

2 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: How AppFog Built a PaaS around CloudFoundry€¦ · cloud infrastructure [...] applications created using programming languages, libraries, services, and tools supported by the provider.”

How AppFogBuilt a PaaS around

CloudFoundryJeremy VoorhisSenior Engineer, AppFog [email protected]@jvoorhishttp://www.appfog.com

Thursday, March 8, 12

Page 2: How AppFog Built a PaaS around CloudFoundry€¦ · cloud infrastructure [...] applications created using programming languages, libraries, services, and tools supported by the provider.”

Agenda

• What is PaaS?

• What is CloudFoundry?

• Adopting CloudFoundry at AppFog

Thursday, March 8, 12

Page 3: How AppFog Built a PaaS around CloudFoundry€¦ · cloud infrastructure [...] applications created using programming languages, libraries, services, and tools supported by the provider.”

What is PaaS?

“The capability [...] to deploy onto the cloud infrastructure [...] applications created using programming languages, libraries, services, and tools supported by the provider.”

The NIST Definition of Cloud ComputingNIST 800-145

Thursday, March 8, 12

Page 4: How AppFog Built a PaaS around CloudFoundry€¦ · cloud infrastructure [...] applications created using programming languages, libraries, services, and tools supported by the provider.”

Why PaaS?

• Product teams focus on development

• Shortens the feedback loop

• Promotes horizontal scalability

Thursday, March 8, 12

Page 5: How AppFog Built a PaaS around CloudFoundry€¦ · cloud infrastructure [...] applications created using programming languages, libraries, services, and tools supported by the provider.”

A Word on NoOps

http://www.linkedin.com/groups/Cloud-moves-towards-NoOps-world-4084799.S.92540468

Thursday, March 8, 12

Page 6: How AppFog Built a PaaS around CloudFoundry€¦ · cloud infrastructure [...] applications created using programming languages, libraries, services, and tools supported by the provider.”

Thursday, March 8, 12

Page 7: How AppFog Built a PaaS around CloudFoundry€¦ · cloud infrastructure [...] applications created using programming languages, libraries, services, and tools supported by the provider.”

Thursday, March 8, 12

Page 8: How AppFog Built a PaaS around CloudFoundry€¦ · cloud infrastructure [...] applications created using programming languages, libraries, services, and tools supported by the provider.”

http://blog.appfog.com/appfog-entrepreneur-enabler-2/

Data from theNational Venture Capital Association

and theCenter for Venture Research

Thursday, March 8, 12

Page 9: How AppFog Built a PaaS around CloudFoundry€¦ · cloud infrastructure [...] applications created using programming languages, libraries, services, and tools supported by the provider.”

Thursday, March 8, 12

Page 10: How AppFog Built a PaaS around CloudFoundry€¦ · cloud infrastructure [...] applications created using programming languages, libraries, services, and tools supported by the provider.”

Thursday, March 8, 12

Page 11: How AppFog Built a PaaS around CloudFoundry€¦ · cloud infrastructure [...] applications created using programming languages, libraries, services, and tools supported by the provider.”

Thursday, March 8, 12

Page 12: How AppFog Built a PaaS around CloudFoundry€¦ · cloud infrastructure [...] applications created using programming languages, libraries, services, and tools supported by the provider.”

Thursday, March 8, 12

Page 13: How AppFog Built a PaaS around CloudFoundry€¦ · cloud infrastructure [...] applications created using programming languages, libraries, services, and tools supported by the provider.”

Layers of PaaS

• User experience

• Application lifecycle management

• Orchestration

Thursday, March 8, 12

Page 14: How AppFog Built a PaaS around CloudFoundry€¦ · cloud infrastructure [...] applications created using programming languages, libraries, services, and tools supported by the provider.”

UX = Developer Experience

• Understand their problems

• Concentrate their efforts

• Help them ship faster!

Thursday, March 8, 12

Page 15: How AppFog Built a PaaS around CloudFoundry€¦ · cloud infrastructure [...] applications created using programming languages, libraries, services, and tools supported by the provider.”

UX ∋ InterfaceThursday, March 8, 12

Page 16: How AppFog Built a PaaS around CloudFoundry€¦ · cloud infrastructure [...] applications created using programming languages, libraries, services, and tools supported by the provider.”

UX ∋ ToolsThursday, March 8, 12

Page 17: How AppFog Built a PaaS around CloudFoundry€¦ · cloud infrastructure [...] applications created using programming languages, libraries, services, and tools supported by the provider.”

Solve Your Own Problems!

• API for app lifecycle management

• Roll your own tools

• IDE integration

• Continuous Integration

• Autoscaling

Thursday, March 8, 12

Page 18: How AppFog Built a PaaS around CloudFoundry€¦ · cloud infrastructure [...] applications created using programming languages, libraries, services, and tools supported by the provider.”

UX ∋ Plans and Pricing

• Free plan for dev / test

• What is the fundamental unit?

• No calculators from hell!

Thursday, March 8, 12

Page 19: How AppFog Built a PaaS around CloudFoundry€¦ · cloud infrastructure [...] applications created using programming languages, libraries, services, and tools supported by the provider.”

UX ∋ Support

• Fast response times

• Comprehensive docs

• Example code

• Community!

Thursday, March 8, 12

Page 20: How AppFog Built a PaaS around CloudFoundry€¦ · cloud infrastructure [...] applications created using programming languages, libraries, services, and tools supported by the provider.”

Application Lifecycle

• HTTP pipeline

• Language runtimes and libraries

• Services

• App configuration

• Lifecycle events

• Visibility

Thursday, March 8, 12

Page 21: How AppFog Built a PaaS around CloudFoundry€¦ · cloud infrastructure [...] applications created using programming languages, libraries, services, and tools supported by the provider.”

Orchestration

• Provisioning infrastructure

• Capacity planning / scaling

• Monitoring

• Configuration management

Thursday, March 8, 12

Page 22: How AppFog Built a PaaS around CloudFoundry€¦ · cloud infrastructure [...] applications created using programming languages, libraries, services, and tools supported by the provider.”

What is CloudFoundry?

Thursday, March 8, 12

Page 23: How AppFog Built a PaaS around CloudFoundry€¦ · cloud infrastructure [...] applications created using programming languages, libraries, services, and tools supported by the provider.”

CloudFoundry.com- vs -

CloudFoundry OSS• CloudFoundry.com is operated by VMware

• Runs on vSphere

• In public beta

• CloudFoundry OSS created by VMware

• http://github.com/cloudfoundry

• Powers CloudFoundry.com, AppFog and others

• This talk is about CloudFoundry OSS

Thursday, March 8, 12

Page 24: How AppFog Built a PaaS around CloudFoundry€¦ · cloud infrastructure [...] applications created using programming languages, libraries, services, and tools supported by the provider.”

CloudFoundry isa kernel for

Application LifecycleManagement

Thursday, March 8, 12

Page 25: How AppFog Built a PaaS around CloudFoundry€¦ · cloud infrastructure [...] applications created using programming languages, libraries, services, and tools supported by the provider.”

CloudFoundry Tenets

• Loosely coupled

• Fails fast

• Minimizes single points of failure

• Infrastructure agnostic

Thursday, March 8, 12

Page 26: How AppFog Built a PaaS around CloudFoundry€¦ · cloud infrastructure [...] applications created using programming languages, libraries, services, and tools supported by the provider.”

Loosely Coupled

• Collection of single-purpose daemons

• Connected by pub/sub

• Distributed state

• Controlled by an HTTP API

Thursday, March 8, 12

Page 27: How AppFog Built a PaaS around CloudFoundry€¦ · cloud infrastructure [...] applications created using programming languages, libraries, services, and tools supported by the provider.”

Fails Fast

• Optimized for mean-time-to-recovery

• Not mean-time-to-failure

Thursday, March 8, 12

Page 28: How AppFog Built a PaaS around CloudFoundry€¦ · cloud infrastructure [...] applications created using programming languages, libraries, services, and tools supported by the provider.”

Minimizes SinglePoints of Failure

• Each component scales horizontally

• (Except for CCDB, HM, NATS)

Thursday, March 8, 12

Page 29: How AppFog Built a PaaS around CloudFoundry€¦ · cloud infrastructure [...] applications created using programming languages, libraries, services, and tools supported by the provider.”

Infrastructure Agnostic

• Run on your workstation for dev/test

• Run in your data center

• Public Cloud: AWS, Rackspace, HP, Joyent

Thursday, March 8, 12

Page 30: How AppFog Built a PaaS around CloudFoundry€¦ · cloud infrastructure [...] applications created using programming languages, libraries, services, and tools supported by the provider.”

CF Components

• NATS

• Router

• CloudController

• DEA

• Health Manager

• Service Architecture

Thursday, March 8, 12

Page 31: How AppFog Built a PaaS around CloudFoundry€¦ · cloud infrastructure [...] applications created using programming languages, libraries, services, and tools supported by the provider.”

NATS

• The “Nervous System”

• Pub/Sub message bus

• Topic + Payload (JSON)

• Subscribe to patterns of topics

Thursday, March 8, 12

Page 32: How AppFog Built a PaaS around CloudFoundry€¦ · cloud infrastructure [...] applications created using programming languages, libraries, services, and tools supported by the provider.”

Router

• Proxies web requests to backends

• Balances load

• Discovers routes and backends via NATS

• Eventually consistent

• Proxies apps and CF components alike

• Scales horizontally

Thursday, March 8, 12

Page 33: How AppFog Built a PaaS around CloudFoundry€¦ · cloud infrastructure [...] applications created using programming languages, libraries, services, and tools supported by the provider.”

CloudController

• REST + JSON API

• Stages and deploys apps

• Single point of truth (CCDB)

• Users

• Apps

• Services

Thursday, March 8, 12

Page 34: How AppFog Built a PaaS around CloudFoundry€¦ · cloud infrastructure [...] applications created using programming languages, libraries, services, and tools supported by the provider.”

DEA

• “Droplet Execution Agent”

• Starts and stops apps

• Monitors apps

• Announces transitions via NATS

Thursday, March 8, 12

Page 35: How AppFog Built a PaaS around CloudFoundry€¦ · cloud infrastructure [...] applications created using programming languages, libraries, services, and tools supported by the provider.”

Health Manager

• Reads CloudController’s database

• Runloop checks for drift

• i.e. # instances / app

• Signals to CloudController via NATS

Thursday, March 8, 12

Page 36: How AppFog Built a PaaS around CloudFoundry€¦ · cloud infrastructure [...] applications created using programming languages, libraries, services, and tools supported by the provider.”

Services Architecture

• Nodes control service installations

• i.e. MySQL, MongoDB, Postgres, Redis

• Service gateways

• Expose cluster of nodes to system

• Gateway abstracts CF-hosted services

Thursday, March 8, 12

Page 37: How AppFog Built a PaaS around CloudFoundry€¦ · cloud infrastructure [...] applications created using programming languages, libraries, services, and tools supported by the provider.”

Scenario: deployments• Client POSTs app metadata

• Client sends resource manifest, missing files, binds services

• CC stages app

• CC requests DEA with capacity / capabilities

• First DEA to respond wins, pulls app package

• DEA starts app, signals NATS

• Router discovers app, proxies HTTP

Thursday, March 8, 12

Page 38: How AppFog Built a PaaS around CloudFoundry€¦ · cloud infrastructure [...] applications created using programming languages, libraries, services, and tools supported by the provider.”

Binding to Services$ head wp-config.php<?php// ** Consume service configuration ** //$services = getenv("VCAP_SERVICES");$services_json = json_decode($services,true);$mysql_config = $services_json["mysql-5.1"][0]["credentials"];

// ** MySQL settings from resource descriptor ** //define('DB_NAME', $mysql_config["name"]);define('DB_USER', $mysql_config["user"]);define('DB_PASSWORD', $mysql_config["password"]);define('DB_HOST', $mysql_config["hostname"]);define('DB_PORT', $mysql_config["port"]);// ** MySQL settings from resource descriptor ** //

$ af bind-service my-service my-app

Thursday, March 8, 12

Page 39: How AppFog Built a PaaS around CloudFoundry€¦ · cloud infrastructure [...] applications created using programming languages, libraries, services, and tools supported by the provider.”

Binding to Ports

  var app = express.createServer(); // app definition elided  var port = process.env.VCAP_APP_PORT || 8001;  app.listen(port);

Thursday, March 8, 12

Page 40: How AppFog Built a PaaS around CloudFoundry€¦ · cloud infrastructure [...] applications created using programming languages, libraries, services, and tools supported by the provider.”

CloudFoundry at AppFog

Thursday, March 8, 12

Page 41: How AppFog Built a PaaS around CloudFoundry€¦ · cloud infrastructure [...] applications created using programming languages, libraries, services, and tools supported by the provider.”

Lessons Learned

• AppFog is our second PaaS product

• We built our first PaaS, PHP Fog, from first principles

• We built all three layers from scratch

• We learned a lot!

Thursday, March 8, 12

Page 42: How AppFog Built a PaaS around CloudFoundry€¦ · cloud infrastructure [...] applications created using programming languages, libraries, services, and tools supported by the provider.”

Up the ante:create the bestmulti-language,multi-service,

multi-infrastructureplatform

Thursday, March 8, 12

Page 43: How AppFog Built a PaaS around CloudFoundry€¦ · cloud infrastructure [...] applications created using programming languages, libraries, services, and tools supported by the provider.”

Why did we choose CloudFoundry?

• Embraces polyglot programming,polyglot persistence

• Focus our energies on UX, orchestration

• Excellent code quality

• Vibrant OSS community

Thursday, March 8, 12

Page 44: How AppFog Built a PaaS around CloudFoundry€¦ · cloud infrastructure [...] applications created using programming languages, libraries, services, and tools supported by the provider.”

PHP Fog / CloudFoundry Architecture Comparison

Thursday, March 8, 12

Page 45: How AppFog Built a PaaS around CloudFoundry€¦ · cloud infrastructure [...] applications created using programming languages, libraries, services, and tools supported by the provider.”

Similarities

• Provides N-tier architecture for PHP apps

• Isolates apps for multi-tenant

• Scales horizontally

• Manages app configuration

Thursday, March 8, 12

Page 46: How AppFog Built a PaaS around CloudFoundry€¦ · cloud infrastructure [...] applications created using programming languages, libraries, services, and tools supported by the provider.”

PHP Fog UX

• Comprehensive management console

• New API!

• Tiered pricing model

• Fundamental unit is the dedicated VM

• Easy plan changes, a la carte upgrades

Thursday, March 8, 12

Page 47: How AppFog Built a PaaS around CloudFoundry€¦ · cloud infrastructure [...] applications created using programming languages, libraries, services, and tools supported by the provider.”

PHP Fog App Lifecycle

• PHP-specific

• Every app gets a MySQL database

• (More services available as add-ons)

• One URL per app

• Git deployments

Thursday, March 8, 12

Page 48: How AppFog Built a PaaS around CloudFoundry€¦ · cloud infrastructure [...] applications created using programming languages, libraries, services, and tools supported by the provider.”

PHP Fog Lifecycle Innovations

• HTTP caching tier (Varnish)

• Wildcard subdomains

• SSL termination for custom domains

• Dedicated app servers

Thursday, March 8, 12

Page 49: How AppFog Built a PaaS around CloudFoundry€¦ · cloud infrastructure [...] applications created using programming languages, libraries, services, and tools supported by the provider.”

PHP Fog Orchestration

• Config management (Puppet)

• Ad hoc scripting

• Web UI

Thursday, March 8, 12

Page 50: How AppFog Built a PaaS around CloudFoundry€¦ · cloud infrastructure [...] applications created using programming languages, libraries, services, and tools supported by the provider.”

Where are we now?

• Next generation of our web console

• HTTP caching tier for CF

• PHP / Apache2 runtime support

• Orchestration for multiple public clouds

• Lots of example apps and spinoffs!

Thursday, March 8, 12

Page 51: How AppFog Built a PaaS around CloudFoundry€¦ · cloud infrastructure [...] applications created using programming languages, libraries, services, and tools supported by the provider.”

(spinoff)

https://github.com/lhitchon/befunge

Thursday, March 8, 12

Page 52: How AppFog Built a PaaS around CloudFoundry€¦ · cloud infrastructure [...] applications created using programming languages, libraries, services, and tools supported by the provider.”

Supported Technologies

• Runtimes: PHP, Ruby (1.8, 1.9), NodeJS

• Services: MySQL, MongoDB

Thursday, March 8, 12

Page 53: How AppFog Built a PaaS around CloudFoundry€¦ · cloud infrastructure [...] applications created using programming languages, libraries, services, and tools supported by the provider.”

What’s Next?

• AppFog exits private beta,opens registration

• Support for PHP Fog’s add-on ecosystem

• More infrastructure choices

• More services and runtimes

Thursday, March 8, 12

Page 54: How AppFog Built a PaaS around CloudFoundry€¦ · cloud infrastructure [...] applications created using programming languages, libraries, services, and tools supported by the provider.”

8 accepted pull requests(and counting!)

http://octodex.github.com/constructocat-v2

Thursday, March 8, 12

Page 55: How AppFog Built a PaaS around CloudFoundry€¦ · cloud infrastructure [...] applications created using programming languages, libraries, services, and tools supported by the provider.”

Thank you!

Jeremy VoorhisSenior Engineer, AppFog [email protected]@jvoorhishttp://www.appfog.com

Thursday, March 8, 12