cloud foundry bootcamp

69
© 2012 VMware, Inc. All rights reserved Cloud Foundry Bootcamp Alvaro Videla Developer Advocate [email protected] @old_sound Wednesday, November 21, 12

Upload: alvaro-videla

Post on 15-May-2015

2.215 views

Category:

Technology


1 download

DESCRIPTION

Presentation given in Zurich at the Zurich IT Geeks Meetup demoing Cloud Foundry PaaS.

TRANSCRIPT

Page 1: Cloud Foundry Bootcamp

© 2012 VMware, Inc. All rights reserved

Cloud Foundry Bootcamp

Alvaro Videla Developer [email protected]@old_sound

Wednesday, November 21, 12

Page 2: Cloud Foundry Bootcamp

About Me

• Developer Advocate for Cloud Foundry• Blog: http://videlalvaro.github.com/• Twitter: @old_sound• http://slideshare.net/old_sound

2

Wednesday, November 21, 12

Page 3: Cloud Foundry Bootcamp

About Me

• Developer Advocate for Cloud Foundry• Blog: http://videlalvaro.github.com/• Twitter: @old_sound• I created gifsockets™

3

Wednesday, November 21, 12

Page 4: Cloud Foundry Bootcamp

About Me

Co-authored

RabbitMQ in Action

http://bit.ly/rabbitmq

4

Wednesday, November 21, 12

Page 5: Cloud Foundry Bootcamp

CONFIDENTIAL

Capabilities

The Basics

How it Works (Architecture)

Micro Cloud Foundry

5Wednesday, November 21, 12

Page 6: Cloud Foundry Bootcamp

CONFIDENTIAL

What does Cloud Foundry

offer?

6Wednesday, November 21, 12

Page 7: Cloud Foundry Bootcamp

CONFIDENTIAL

Cloud Foundry: Choice of Runtimes

Wednesday, November 21, 12

Page 8: Cloud Foundry Bootcamp

CONFIDENTIAL

Frameworks and Runtimes Supported• Out of the Box

• Java (.WAR files, on Tomcat. Spring’s an ideal choice here, of course..)

• Scala (Lift, Play!)

• Ruby (Rails, Sinatra, etc.)

• Node.js

• Ecosystem Partners

• .NET (Uhuru, Tier3)

• Python (Stackato)

• PHP (AppFog)

• Haskell (1)

• Erlang (2)

1) http://www.cakesolutions.net/teamblogs/2011/11/25/haskell-happstack-on-cloudfoundry/2) https://github.com/cloudfoundry/vcap/pull/20

Wednesday, November 21, 12

Page 9: Cloud Foundry Bootcamp

CONFIDENTIAL

Cloud Foundry: Choice of Clouds

9Wednesday, November 21, 12

Page 10: Cloud Foundry Bootcamp

CONFIDENTIAL

Main Risk: Lock In

10

Welcome to the hotel California

Such a lovely place

Such a lovely face

Plenty of room at the hotel California

Any time of year, you can find it here

Last thing I remember, I was

Running for the door

I had to find the passage back

To 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!

-the Eagles

Wednesday, November 21, 12

Page 11: Cloud Foundry Bootcamp

CONFIDENTIAL

11

Cloud Foundry.org

Wednesday, November 21, 12

Page 12: Cloud Foundry Bootcamp

CONFIDENTIAL

Cloud Foundry: Clouds

12

§ Joyent

• community lead for Node.js

§ ActiveState

• community lead for Python, Perl

• Providers of Stackato private PaaS

§ AppFog.com

• community lead for PHP

• PaaS for PHP

Wednesday, November 21, 12

Page 13: Cloud Foundry Bootcamp

CONFIDENTIAL

Micro Cloud Foundry

13Wednesday, November 21, 12

Page 14: Cloud Foundry Bootcamp

CONFIDENTIAL

Cloud Foundry: Services

14Wednesday, November 21, 12

Page 15: Cloud Foundry Bootcamp

CONFIDENTIAL

Cloud Foundry: Services

15

§ Services are one of the extensibility planes in Cloud Foundry• there are more services being contributed by the community daily!

§ MySQL, Redis, MongoDB, RabbitMQ, PostgreSQL

§ Services may be shared across applications

§ Cloud Foundry abstracts the provisioning aspect of services through a uniform API hosted in the Cloud Controller

§ It’s very easy to take an app and add a service to the app in a uniform way

Wednesday, November 21, 12

Page 16: Cloud Foundry Bootcamp

CONFIDENTIAL

Cloud Foundry: Services

16

§ Take Advantage of Services • they cost nothing to setup

• they deliver value

§ They Encourage Better Architectures• Need a fast read-write cache? Redis is ready to go!

• Need to store long-tail documents? Give MongoDB a try

• Need to decouple what applications do from when they do it? Use messaging and RabbitMQ

Wednesday, November 21, 12

Page 17: Cloud Foundry Bootcamp

CONFIDENTIAL

Demo: logging in, asking questions, & deploying from the CLI

17Wednesday, November 21, 12

Page 18: Cloud Foundry Bootcamp

CONFIDENTIAL

Cloud Foundry architecture

18Wednesday, November 21, 12

Page 19: Cloud Foundry Bootcamp

CONFIDENTIAL

Cloud Foundry - Architecture

DEAs

Web

App

Services

DB

HealthManager

RoutersCloudControllers

Load Balancers

DEAs

Web

App

DEAs

App

100s

of D

EA

s

CloudControllersCloud

Controllers

Services

DB

Services

DB

Load BalancersLoad

Balancers

Routers

HealthManagerHealth

Manager

Routers

Message Bus

(NATS)Message Bus

(NATS)Message Bus

(NATS)

Web Service API

Client, e.g. VMC

Wednesday, November 21, 12

Page 20: Cloud Foundry Bootcamp

CONFIDENTIAL

Application deployment flow

VMCCloud

Controller DEADEA

RouterRouter

Application

Wednesday, November 21, 12

Page 21: Cloud Foundry Bootcamp

CONFIDENTIAL

Application deployment flow

VMCvmc push Cloud

Controller DEADEA

RouterRouter

Application

Wednesday, November 21, 12

Page 22: Cloud Foundry Bootcamp

CONFIDENTIAL

Application deployment flow

VMCvmc push

Framework detection

Cloud Controller DEADEA

RouterRouter

Application

Wednesday, November 21, 12

Page 23: Cloud Foundry Bootcamp

CONFIDENTIAL

Application deployment flow

VMCvmc push

Framework detection

Cloud Controller

create app DEADEA

RouterRouter

Application

Wednesday, November 21, 12

Page 24: Cloud Foundry Bootcamp

CONFIDENTIAL

Application deployment flow

VMCvmc push

Framework detection

Cloud Controller

create app

Framework specific staging

plugin

DEADEA

CreatesDroplet

RouterRouter

Application

Wednesday, November 21, 12

Page 25: Cloud Foundry Bootcamp

CONFIDENTIAL

Application deployment flow

VMCvmc push

Framework detection

Cloud Controller

create app

Framework specific staging

plugin

DEADEA

find DEA for app

CreatesDroplet

RouterRouter

Application

Wednesday, November 21, 12

Page 26: Cloud Foundry Bootcamp

CONFIDENTIAL

Application deployment flow

VMCvmc push

Framework detection

Cloud Controller

create app

Framework specific staging

plugin

DEADEA

find DEA for app

CreatesDroplet

I’m available

RouterRouter

Application

Wednesday, November 21, 12

Page 27: Cloud Foundry Bootcamp

CONFIDENTIAL

Application deployment flow

VMCvmc push

Framework detection

Cloud Controller

create app

Framework specific staging

plugin

DEADEA

find DEA for app

CreatesDroplet

deploy droplet

I’m available

RouterRouter

Application

Wednesday, November 21, 12

Page 28: Cloud Foundry Bootcamp

CONFIDENTIAL

Application deployment flow

VMCvmc push

Framework detection

Cloud Controller

create app

Framework specific staging

plugin

DEADEA

find DEA for app

CreatesDroplet

deploy droplet

I’m available

RouterRouter

Applicationstart

Wednesday, November 21, 12

Page 29: Cloud Foundry Bootcamp

CONFIDENTIAL

Application deployment flow

VMCvmc push

Framework detection

Cloud Controller

create app

Framework specific staging

plugin

DEADEA

find DEA for app

CreatesDroplet

deploy droplet

I’m available

RouterRouter

update routes

Applicationstart

Wednesday, November 21, 12

Page 30: Cloud Foundry Bootcamp

CONFIDENTIAL

About the staging plugin

21

§ Framework specific

§ Creates a zip file = black box• Contains everything necessary for DEA to run the application

• Two scripts: start.sh, stop.sh

Wednesday, November 21, 12

Page 31: Cloud Foundry Bootcamp

CONFIDENTIAL

Request handling flow

22

Load Balancer RouterRouterLoad Balancer

HTTP Request HTTP Request

DEAApplication

HTTP Request

Wednesday, November 21, 12

Page 32: Cloud Foundry Bootcamp

CONFIDENTIAL

Request handling flow

22

Load Balancer RouterRouterLoad Balancer

HTTP Request HTTP Request

DEAApplication

HTTP Request

Wednesday, November 21, 12

Page 33: Cloud Foundry Bootcamp

CONFIDENTIAL

Self Healing Infrastructure§ If an application instance crashes

• DEA detects unexpected exit => DEA broadcasts message• Routers remove instance from routing• Health manager notifies Cloud Controller• Cloud Controller re-launches instance

§ If an DEA VM crashes• Application instances become unavailable• Health Manager notices the missing instances and notifies the

Cloud Controller• Cloud Controller requests application instances to be started• Existing DEA will reply and start the applications

Wednesday, November 21, 12

Page 34: Cloud Foundry Bootcamp

CONFIDENTIAL

Micro Cloud Foundry

24Wednesday, November 21, 12

Page 35: Cloud Foundry Bootcamp

CONFIDENTIAL

What is in Micro Cloud Foundry?

25

Open source Platform as a Service project

App Instances Services

A cloud packaged as a VMware Virtual Machine

Use as a developer sandbox

• Use the services from Junit integration tests

• Deploy your application for functional testing

• Remote debugging from STS

Wednesday, November 21, 12

Page 36: Cloud Foundry Bootcamp

CONFIDENTIAL

Pre-requisites for using Micro Cloud Foundry

26

Minimum 1 GB

RAM

Minimum 8 GB

Disk

Internet Connectivity

(w/DHCP is ideal)

VMC STSCommand line GUI

Wednesday, November 21, 12

Page 37: Cloud Foundry Bootcamp

CONFIDENTIAL

Register and login to CloudFoundry.com

27Wednesday, November 21, 12

Page 38: Cloud Foundry Bootcamp

CONFIDENTIAL

Select a domain name

28

*.cloudfoundry.me => IP address of your machine where Micro Cloud Foundry is running

Wednesday, November 21, 12

Page 39: Cloud Foundry Bootcamp

CONFIDENTIAL

Remember the configuration token

29Wednesday, November 21, 12

Page 40: Cloud Foundry Bootcamp

CONFIDENTIAL

Download, unzip and open micro.vmx

30Wednesday, November 21, 12

Page 41: Cloud Foundry Bootcamp

CONFIDENTIAL

Configure Micro Cloud Foundry

31Wednesday, November 21, 12

Page 42: Cloud Foundry Bootcamp

CONFIDENTIAL

Configure Micro Cloud Foundry

31

Pick password

Wednesday, November 21, 12

Page 43: Cloud Foundry Bootcamp

CONFIDENTIAL

Configure Micro Cloud Foundry

31

Pick password

Enter token

Wednesday, November 21, 12

Page 44: Cloud Foundry Bootcamp

CONFIDENTIAL

Getting started with Cloud Foundry...

32Wednesday, November 21, 12

Page 45: Cloud Foundry Bootcamp

CONFIDENTIAL

Register

33

http://cloudfoundry.com/signup

Use promo code

cfnownov12

Wednesday, November 21, 12

Page 46: Cloud Foundry Bootcamp

CONFIDENTIAL

Welcome email

34Wednesday, November 21, 12

Page 47: Cloud Foundry Bootcamp

CONFIDENTIAL

Ways to use Cloud Foundry

35

command line...

IDE plugin...

toolchain plugin...

Cloud IDEs

Wednesday, November 21, 12

Page 48: Cloud Foundry Bootcamp

CONFIDENTIAL

Example vmc commands

36

$  gem  install  vmc

$  vmc  target  <any  cloud>$  vmc  login  <credentials>$  vmc  push  <my-­‐app>      >  bind  services?  Yes

$  vmc  update  <my-­‐app>$  vmc  instances  <my-­‐app>  +100  

Wednesday, November 21, 12

Page 49: Cloud Foundry Bootcamp

CONFIDENTIAL

Installing vmc on Windows

37

Wednesday, November 21, 12

Page 50: Cloud Foundry Bootcamp

CONFIDENTIAL

Installing vmc on Windows

37

Install the vmc gem

Wednesday, November 21, 12

Page 51: Cloud Foundry Bootcamp

CONFIDENTIAL

Installing vmc on Mac OSX

38

$ curl -L https://get.rvm.io | bash -s stable --ruby

$ rvm install 1.9.2

$ rvm use 1.9.2

$ gem install vmc

Use Ruby Version Manager http://beginrescueend.com/

You need:Command Line Tools for OSX orXCode 4.1

Wednesday, November 21, 12

Page 52: Cloud Foundry Bootcamp

CONFIDENTIAL

Logging into CloudFoundry.com

39

Wednesday, November 21, 12

Page 53: Cloud Foundry Bootcamp

CONFIDENTIAL

Logging into CloudFoundry.com

39

$  vmc  target  api.cloudfoundry.comSuccessfully  targeted  to                  [http://api.cloudfoundry.com]

Wednesday, November 21, 12

Page 54: Cloud Foundry Bootcamp

CONFIDENTIAL

Logging into CloudFoundry.com

39

$  vmc  target  api.cloudfoundry.comSuccessfully  targeted  to                  [http://api.cloudfoundry.com]

$  vmc  loginAttempting  login  to      [http://api.cloudfoundry.com]Email:  [email protected]:  ********Successfully  logged  into      [http://api.cloudfoundry.com]

Wednesday, November 21, 12

Page 55: Cloud Foundry Bootcamp

Cloud Foundry Integration plugin for Eclipse

40

Eclipse support:

✦ CF Integration for Eclipse

✦ SpringSource Tool Suite

Wednesday, November 21, 12

Page 56: Cloud Foundry Bootcamp

Cloud Foundry Integration plugin for Eclipse

41

Wednesday, November 21, 12

Page 57: Cloud Foundry Bootcamp

Sample App: CloudStagram

42

Wednesday, November 21, 12

Page 58: Cloud Foundry Bootcamp

Sample App: CloudStagram

43

Wednesday, November 21, 12

Page 59: Cloud Foundry Bootcamp

Sample App: CloudStagram

44

Wednesday, November 21, 12

Page 60: Cloud Foundry Bootcamp

Sample App: CloudStagram

45

Wednesday, November 21, 12

Page 61: Cloud Foundry Bootcamp

Sample App: CloudStagram

46

Wednesday, November 21, 12

Page 62: Cloud Foundry Bootcamp

Sample App: CloudStagram

47

Wednesday, November 21, 12

Page 63: Cloud Foundry Bootcamp

Sample App: CloudStagram

48

Wednesday, November 21, 12

Page 64: Cloud Foundry Bootcamp

Sample App: CloudStagram

49

Wednesday, November 21, 12

Page 65: Cloud Foundry Bootcamp

Sample App: CloudStagram

50

Frontend Appnode.js

Wednesday, November 21, 12

Page 66: Cloud Foundry Bootcamp

Sample App: CloudStagram

51

Frontend Appnode.js

Image Resizersnode.js

Wednesday, November 21, 12

Page 67: Cloud Foundry Bootcamp

Sample App: CloudStagram

52

Frontend Appnode.js

Image ResizersClojure

Wednesday, November 21, 12

Page 68: Cloud Foundry Bootcamp

CODE OR IT DIDN’T HAPPEN

53

Wednesday, November 21, 12

Page 69: Cloud Foundry Bootcamp

© 2012 VMware, Inc. All rights reserved

Thank You

CloudFoundry Source Samples: https://github.com/cloudfoundry-samples/

http://cloudfoundry.com

Questions? @cloudfoundry #cloudfoundry

@old_sound / [email protected]

Wednesday, November 21, 12