cloud foundry open tour keynote

50
© 2012 VMware, Inc. All rights reserved Ramnivas Laddad @ramnivas Framework Integration in Cloud Foundry

Upload: ramnivasladdad

Post on 20-Jan-2015

980 views

Category:

Technology


2 download

DESCRIPTION

 

TRANSCRIPT

Page 1: Cloud Foundry Open Tour Keynote

© 2012 VMware, Inc. All rights reserved

Ramnivas Laddad

@ramnivas

Framework Integration in Cloud Foundry

Page 2: Cloud Foundry Open Tour Keynote

2

CONFIDENTIAL

@ramnivas

Spring framework committer

Cloud Foundry committer

Main interests

• Cloud computing

• Aspect-oriented programming

• Scala and functional programming

Author of books and articles

• AspectJ in Action (1st and 2nd edition)

Speaker at many professional conferences

• JavaOne, JavaPolis, SpringOne, Software Development, No Fluff Just Stuff, EclipseCon, O’Reilly OSCON etc.

Active involvement in AspectJ, Spring, and Cloud Foundry since their early form

Page 3: Cloud Foundry Open Tour Keynote

3

CONFIDENTIAL

Technologies “Я” Us

RabbitMQ

Postgres

REST

MySQLJPA

HibernateJDBC

Django

node.jsRedis

JTA

JMS

Web Services

Spring

Security

Caching

Mongo AMQP

Neo4j

JSF

Sinatra

TestingScripting

HTML5

RailsLift

Batch Job

LDAP

Grails

Ruby

Java

Python

AkkaScala

Closure

Hadoop

Page 4: Cloud Foundry Open Tour Keynote

4

CONFIDENTIAL

Technologies “Я” Us

Monitoring

Hardware failures

Backups

Rolling Updates

Patches

Security DoS

OS

DNSStorage

Routing

DBA

Network

Load balancing

User managementAuditing

Access logs

Page 5: Cloud Foundry Open Tour Keynote

5

CONFIDENTIAL

More functionality

Time to market pressure

Complex integration

Higher stake in quality

Facets of complexity: Product

Page 6: Cloud Foundry Open Tour Keynote

6

CONFIDENTIAL

Sound architecture: future proofing without overdoing

Unit and integration tests

Responding to changing business needs

Confusing technology landscape

Facets of complexity: Development

Page 7: Cloud Foundry Open Tour Keynote

7

CONFIDENTIAL

Choosing the right hardware, operating system, web server

Monitoring applications

Responding to scalability needs

Dealing with hardware- and system-level failures

Upgrading without substantial down time

Facets of complexity: Deployment and operation

Page 8: Cloud Foundry Open Tour Keynote

8

CONFIDENTIAL

Inherent vs. Apparent Complexity

ImplementationFunctional logic

Implementation overhead

Inherent

complexity

Apparent

complexity

What can we do about this?

Page 9: Cloud Foundry Open Tour Keynote

9

CONFIDENTIAL

What can we do?

?

Page 10: Cloud Foundry Open Tour Keynote

10

CONFIDENTIAL

SaaSSoftware as a Service

PaaSPlatform as a Service

IaaSInfrastructure as a

Service

Three layers of Cloud Computing

Page 11: Cloud Foundry Open Tour Keynote

11

CONFIDENTIAL

Clou

d Pr

ovid

er In

terfa

ce

Application Service Interface

Private Clouds

PublicClouds

Micro Clouds

Cloud Foundry open PaaS - Choice of clouds

Data Services

Other Services

Msg Services

Page 12: Cloud Foundry Open Tour Keynote

12

CONFIDENTIAL

Clou

d Pr

ovid

er In

terfa

ce

Application Service Interface

Private Clouds

PublicClouds

Data Services

Other Services

Msg Services

Partners

Apache2 license

Cloud Foundry open PaaS - Choice of clouds

Micro Clouds

Page 13: Cloud Foundry Open Tour Keynote

13

CONFIDENTIAL

Frameworks in Cloud Foundry

Page 14: Cloud Foundry Open Tour Keynote

14

CONFIDENTIAL

Community and Partner contributions

The Cloud Foundry Universe

Core Frameworks

Page 15: Cloud Foundry Open Tour Keynote

15

CONFIDENTIAL

Java

• Spring

• Grails

• Lift

Ruby

• Rails

• Sinatra

• Rack

Node.js (Community lead: Joyent)

Core Runtimes and Frameworks

Page 16: Cloud Foundry Open Tour Keynote

16

CONFIDENTIAL

Python

• Django

• WSGI

Erlang OTP/Rebar

PHP

Perl

.Net

• On Iron Foundry

Community and partners contributions

Page 17: Cloud Foundry Open Tour Keynote

17

CONFIDENTIAL

The Platinum Rule

Treat each framework

the way it will like to be treated!

Page 18: Cloud Foundry Open Tour Keynote

18

CONFIDENTIAL

Common Framework Support

Page 19: Cloud Foundry Open Tour Keynote

19

CONFIDENTIAL

Create apps and services

Update bindings, memory etc.

Scale instances

Command-line access

$ vmc push conference

$ vmc create-service mysql conf-db

$ vmc bind-service conf-db conference

$ vmc instances conference +2

Page 20: Cloud Foundry Open Tour Keynote

20

CONFIDENTIAL

Access to services and app info through environment variables

• Service host, port, credentials

• App ip and port

Access to services and app info

VCAP_SERVICES: {

"postgresql-9.0": [{

"name": "env-postgresql",

"label": "postgresql-9.0",

"plan": "free",

"credentials": {

"name": "de24667f9344b4eeaad6b5a2326d52faa",

"host": "172.30.48.122",

"port": 5432,

"user": "u50ce600bba434bacbc99e034bb415644",

"password": "pf4dca5bd449d4732841f0c4ae3f299d0"

}

}]

}

Page 21: Cloud Foundry Open Tour Keynote

21

CONFIDENTIAL

A runtime library to access service and app info

Auto-reconfiguration for typical apps

• Node.js coming soon

Simplified app configration

Page 22: Cloud Foundry Open Tour Keynote

22

CONFIDENTIAL

Access to service through Caldecott

$ vmc tunnel conf-dbBinding Service [conf-db]: OKStopping Application 'caldecott': OKStaging Application 'caldecott': OK Starting Application 'caldecott': OK Getting tunnel connection info: OK Service connection info: username : uG5jVXaBPmjl6 password : pE3HOwIwGgkbv name : d76e62447a4c04f2b8e7b79f41c450aa0 Starting tunnel to conf-db on port 10000.1: none2: mysql3: mysqldumpWhich client would you like to start?: 2

Page 23: Cloud Foundry Open Tour Keynote

23

CONFIDENTIAL

Access to service through Caldecott

Launching 'mysql --protocol=TCP --host=localhost --port=10000 --user=uG5jVXaBPmjl6 --password=pE3HOwIwGgkbv d76e62447a4c04f2b8e7b79f41c450aa0' ...  mysql> select * from users; 

Page 24: Cloud Foundry Open Tour Keynote

24

CONFIDENTIAL

Manifest Support---

applications:

.:

name: conference

url: ${name}.${target-base}

framework:

name: rails3

info:

mem: 256M

description: Rails Application

exec:

mem: 256M

instances: 1

services:

conf-db:

type: mysql

Page 25: Cloud Foundry Open Tour Keynote

25

CONFIDENTIAL

Spring

Page 26: Cloud Foundry Open Tour Keynote

26

CONFIDENTIAL

IDE integration

• SpringSource Tools Suite and Eclipse

• Open source

Auto-reconfiguration by hooking into Spring application context

<cloud:> namespace

Spring 3.1 profile support

Maven plugin

The Platinum Rule: Spring and Grails

Page 27: Cloud Foundry Open Tour Keynote

27

CONFIDENTIAL

IDE Integration

Page 28: Cloud Foundry Open Tour Keynote

28

CONFIDENTIAL

Auto-Reconfiguration: Relational DB Detects beans of type javax.sql.DataSource

Connects to MySQL or PostgreSQL services

• Specifies driver, url, username, password, validation query

Creates Commons DBCP or Tomcat DataSource

<bean class="org.apache.commons.dbcp.BasicDataSource"

destroy-method="close" id="dataSource">

<property name="driverClassName" value="org.h2.Driver" />

<property name="url" value="jdbc:h2:mem:" />

<property name="username" value="sa" />

<property name="password" value="" />

</bean>

Page 29: Cloud Foundry Open Tour Keynote

29

CONFIDENTIAL

<cloud:service-scan>

Scans all services bound to the application and creates a bean of an appropriate type for each

• Same bean types as auto-reconfiguration

Useful during early development phases

<beans …>

<cloud:service-scan/>

</beans>

Page 30: Cloud Foundry Open Tour Keynote

30

CONFIDENTIAL

<cloud:service-scan> Autowire Dependencies

Created beans can be autowired as dependencies

Use @Qualifier with service name if multiple services of same type bound to app

@Autowired(required=false) private ConnectionFactory rabbitConnectionFactory;

@Autowired private RedisConnectionFactory redisConnectionFactory;

@Autowired @Qualifier("test_mysql_database")

private DataSource mysqlDataSource;

@Autowired(required=false) @Qualifier("test_postgres_database")

private DataSource postgresDataSource;

Page 31: Cloud Foundry Open Tour Keynote

31

CONFIDENTIAL

<cloud:data-source>

Configures a DataSource bean

• Commons DBCP or Tomcat DataSource

Basic attributes:

• id: defaults to service name

• service-name: only needed if you have multiple relational database services bound to the app

<cloud:data-source id="dataSource"/>

Page 32: Cloud Foundry Open Tour Keynote

32

CONFIDENTIAL

Isolating Cloud Foundry Configuration

<bean class="org.sf.orm.jpa.LocalContainerEntityManagerFactoryBean"

id="entityManagerFactory">

<property name="dataSource" ref="dataSource"/>

</bean>

<beans profile="cloud">

<cloud:data-source id="dataSource" />

</beans>

<beans profile="default">

<bean class=”o.a.commons.dbcp.BasicDataSource" id="dataSource">

<property name="url" value="jdbc:mysql://localhost/inventory" />

</bean>

</beans>

Page 33: Cloud Foundry Open Tour Keynote

33

CONFIDENTIAL

Scala/Lift Auto-reconfiguration for Scala Lift apps

PostgreSQL support coming soon

Page 34: Cloud Foundry Open Tour Keynote

34

CONFIDENTIAL

Ruby

Page 35: Cloud Foundry Open Tour Keynote

35

CONFIDENTIAL

Bundle support

• Just include a Gemfile.lock

Rails console

• Debugging

Auto-reconfiguration through meta-programming

cf-runtime gem

The Platinum Rule: Rails, Sinatra, Rack

Page 36: Cloud Foundry Open Tour Keynote

36

CONFIDENTIAL

$ vmc rails-console conf

Connecting to 'conf' console: OK

irb():001:0> u = User.find_by_email('[email protected]')

=> #<User id: 1, email: "[email protected]", reason: "It is cool!", created_at: "2012-03-29 23:10:34", updated_at: "2012-03-29 23:10:34">

irb():002:0> u.email = "[email protected]"

=> "[email protected]"

irb():003:0> u.save

=> true

irb():004:0> u = User.find_by_email('[email protected]')

=> #<User id: 1, email: "[email protected]", reason: "It is cool!", created_at: "2012-03-29 23:10:34", updated_at: "2012-03-29 23:14:17">

Rails Console

Page 37: Cloud Foundry Open Tour Keynote

37

CONFIDENTIAL

require 'mongo' module Demo  class App < Sinatra::Base    configure do      mongo =  Mongo::Connection.new(:host => '127.0.0.1', :port => 27017) db = mongo['db']    end    ...  endend

Ruby auto-reconfiguration

Page 38: Cloud Foundry Open Tour Keynote

38

CONFIDENTIAL

cf-runtime: Ruby Runtime Gem

require 'cfruntime/mongodb'

connection =

CFRuntime::MongoClient.create_from_svc('docs')

db = connection.db

...

Page 39: Cloud Foundry Open Tour Keynote

39

CONFIDENTIAL

Running locally and in Cloud Foundry

require 'cfruntime/mongodb'

...

db = CFRuntime::MongoClient.create.db

rescue Mongo::Connection.new("localhost",

27017)

.db("db”)

...

Page 40: Cloud Foundry Open Tour Keynote

40

CONFIDENTIAL

Taking full control

if CFRuntime::CloudApp.running_in_cloud?  @service_props = CFRuntime::CloudApp.service_props('docs’)else  @service_props = {}  @service_props[:host] = 'localhost'  @service_props[:port] = 27017  @service_props[:db] = 'testdb'enddb = Mongo::Connection.new(@service_props[:host], @service_props[:port]) .db(@service_props[:db])if CFRuntime::CloudApp.running_in_cloud?  db.authenticate(@service_props[:username], @service_props[:password])end

Page 41: Cloud Foundry Open Tour Keynote

41

CONFIDENTIAL

Node.js

Page 42: Cloud Foundry Open Tour Keynote

42

CONFIDENTIAL

NPM support

• Coming soon!

Debugging using node-inspector

Auto-reconfiguration and runtime package

• Coming soon!

The Platinum Rule: Node.js

Page 43: Cloud Foundry Open Tour Keynote

43

CONFIDENTIAL

Debugging node.js apps

Page 44: Cloud Foundry Open Tour Keynote

44

CONFIDENTIAL

Auto-reconfiguration in node.jsvar host = 'localhost', port = 3000, url = require('url'); var client = require("redis").createClient(); require('http').createServer(function (req, res) { ...

Page 45: Cloud Foundry Open Tour Keynote

45

CONFIDENTIAL

var cfruntime = require('cfruntime'), host = cfruntime.CloudApp.host || 'localhost', port = cfruntime.CloudApp.port || 3000, url = require('url'); if (cfruntime.CloudApp.runningInCloud) { var client = cfruntime.RedisClient.create();} else { var client = require("redis").createClient();} require('http').createServer(function (req, res) { ...

Accessing apps and services info

Page 46: Cloud Foundry Open Tour Keynote

46

CONFIDENTIAL

Peeking into future

Page 47: Cloud Foundry Open Tour Keynote

47

CONFIDENTIAL

Bring your own container

• Jetty

• Netty

• …

Non-web apps

• Resque workers

• Spring Batch

• Spring Integration

Still to come

• Short-running apps

• Scheduled tasks

Standalone apps

Page 48: Cloud Foundry Open Tour Keynote

48

CONFIDENTIAL

Lift updated support

Play!

Akka

Enhanced Scala Support

Page 49: Cloud Foundry Open Tour Keynote

49

CONFIDENTIAL

Revamped vmc

• Embeddable core

• Scripting friendly

• Even more intuitive user interaction

Eclipse plugin

• Enhanced wizard with service requirement detection

• Manifest support

• Caldecott integration

Improved Tools

Page 50: Cloud Foundry Open Tour Keynote

© 2012 VMware, Inc. All rights reserved

Ramnivas Laddad

@ramnivas

Questions?