deploy your multi-tier application in cloud foundry

23
1 © Copyright 2013 Pivotal. All rights reserved. 1 © Copyright 2013 Pivotal. All rights reserved. Deploying a Multi-tier App in Cloud Foundry A tour Cornelia Davis Cloud Foundry Platform Engineering [email protected] | twitter: @cdavisafc | March 2014

Upload: cornelia-davis

Post on 27-Aug-2014

571 views

Category:

Software


1 download

DESCRIPTION

Walk through the modifications made to a Spring app (mostly config) to deploy it to the Cloud Foundry PaaS.

TRANSCRIPT

Page 1: Deploy your Multi-tier Application in Cloud Foundry

1© Copyright 2013 Pivotal. All rights reserved. 1© Copyright 2013 Pivotal. All rights reserved.

Deploying a Multi-tier App in Cloud FoundryA tour

Cornelia DavisCloud Foundry Platform [email protected] | twitter: @cdavisafc | March 2014

Page 2: Deploy your Multi-tier Application in Cloud Foundry

2© Copyright 2013 Pivotal. All rights reserved.

Let’s push an app

Page 3: Deploy your Multi-tier Application in Cloud Foundry

3© Copyright 2013 Pivotal. All rights reserved.

Overview: Deploying App to Cloud Foundry Runtime

① Upload app bits and metadata

push app

Rout

er② Create and bind services

③ Stage application

④ Deploy application

⑤ Manage application health…which is a whole ‘nother meetup topic

Cloud FoundryRuntime (PaaS)

Blobstore DB

Cloud Controller

Service Broker Node(s)

DEADEA

DEADEA

+ app MD

+ =

Servicecredentials

Page 4: Deploy your Multi-tier Application in Cloud Foundry

4© Copyright 2013 Pivotal. All rights reserved.

Software

Page 5: Deploy your Multi-tier Application in Cloud Foundry

5© Copyright 2013 Pivotal. All rights reserved.

Software is Changing Industries

$3.5B valuation –Financial Services

$3.5B valuation– Travel & Hospitality

$3.5B valuation – Transportation

$1.1B acquisition by Monsanto – Agriculture

$19B valuation – Entertainment

$3.2B acquisition by Google– Digital Home

Page 6: Deploy your Multi-tier Application in Cloud Foundry

6© Copyright 2013 Pivotal. All rights reserved.

Reference Application from VMWare to demonstrate the vFabric SuiteSpring Trader

https://github.com/cf-platform-eng/springtrader-cf

Page 7: Deploy your Multi-tier Application in Cloud Foundry

7© Copyright 2013 Pivotal. All rights reserved.

From here …

Page 8: Deploy your Multi-tier Application in Cloud Foundry

8© Copyright 2013 Pivotal. All rights reserved.

Agenda

Cross-site scripting JNDI Service Catalog Spring Cloud

Apps and Manifests

Services plans

Auto reconfiguration

Page 9: Deploy your Multi-tier Application in Cloud Foundry

9© Copyright 2013 Pivotal. All rights reserved.

Cross-site Scripting

http://springtrader.com/services

http://springtrader.com/web

Page 10: Deploy your Multi-tier Application in Cloud Foundry

10© Copyright 2013 Pivotal. All rights reserved.

Cross-site Scripting

http://traderweb.cfapps.io

http://traderservices.cfapps.io

Page 11: Deploy your Multi-tier Application in Cloud Foundry

11© Copyright 2013 Pivotal. All rights reserved.

Cross-site Scripting

http://traderfront.cfapps.ioOne war file

This is a hack!!

Page 12: Deploy your Multi-tier Application in Cloud Foundry

12© Copyright 2013 Pivotal. All rights reserved.

JNDI Service Instances

<jee:jndi-lookup id="dataSource" jndi-name="jdbc/nanodb" />Old:

Page 13: Deploy your Multi-tier Application in Cloud Foundry

13© Copyright 2013 Pivotal. All rights reserved.

Spring Cloud

VCAP_SERVICES locally

cf bind-service traderfront devsql

cf bind-service traderfront stagingsql OR

<cloud:data-source id="dataSource"> <cloud:connection properties="sessionVariables=sql_mode='ANSI'; characterEncoding=UTF-8;defaultTransactionIsolation=2”/> <cloud:pool pool-size="2" max-wait-time="200" /></cloud:data-source>

VCAP_SERVICES={"cleardb-n/a":[{"name":"tradersql","label":"cleardb-n/a","tags":["mysql","relational"],"plan":"spark","credentials":{"jdbcUrl":"jdbc:mysql://baf8a1e6a292a2:[email protected]:3306/ad_595d583f143adee","uri":"mysql://baf8a1e6a292a2:[email protected]:3306/ad_595d583f143adee?reconnect=true","name":"ad_595d583f143adee","hostname":"us-cdbr-east-05.cleardb.net","port":"3306","username":"baf8a1e6a292a2","password":"79581497"}}],"cloudamqp-n/a":[{"name":"tradermessaging","label":"cloudamqp-n/a","tags":["amqp","rabbitmq"],"plan":"lemur","credentials":{"uri":"amqp://klrdpgoo:[email protected]/klrdpgoo"}}]}

New:

Page 14: Deploy your Multi-tier Application in Cloud Foundry

14© Copyright 2013 Pivotal. All rights reserved.

(Big-A) Applications and Manifests

http://traderfront.cfapps.ioOne war file

Another war file

Page 15: Deploy your Multi-tier Application in Cloud Foundry

15© Copyright 2013 Pivotal. All rights reserved.

(Big-A) Applications and Manifests---timeout: 180memory: 1Gdomain: cfapps.ioinstances: 1services:- tradersql- tradermessagingapplications:- name: traderback path: dist/spring-nanotrader-asynch-services-1.0.1.BUILD-SNAPSHOT.war host: traderback- name: traderfront path: dist/spring-nanotrader-services-1.0.1.BUILD-SNAPSHOT.war host: traderfront

Page 16: Deploy your Multi-tier Application in Cloud Foundry

16© Copyright 2013 Pivotal. All rights reserved.

(Big-A) Applications and Manifests---timeout: 180memory: 1Gdomain: cfapps.ioinstances: 1services:- tradersql- tradermessagingapplications:- name: traderback path: dist/spring-nanotrader-asynch-services-1.0.1.BUILD-SNAPSHOT.war host: traderback- name: traderfront path: dist/spring-nanotrader-services-1.0.1.BUILD-SNAPSHOT.war host: traderfront

---timeout: 180memory: 1Gdomain: cfapps.ioinstances: 1services:- devsql- devmessagingapplications:- name: traderback path: dist/spring-nanotrader-asynch-services-1.0.1.BUILD-SNAPSHOT.war host: traderback- name: traderfront path: dist/spring-nanotrader-services-1.0.1.BUILD-SNAPSHOT.war host: traderfront

Page 17: Deploy your Multi-tier Application in Cloud Foundry

17© Copyright 2013 Pivotal. All rights reserved.

(Big-A) Applications and Manifests---timeout: 180memory: 1Gdomain: cfapps.ioinstances: 1services:- tradersql- tradermessagingapplications:- name: traderback path: dist/spring-nanotrader-asynch-services-1.0.1.BUILD-SNAPSHOT.war host: traderback- name: traderfront path: dist/spring-nanotrader-services-1.0.1.BUILD-SNAPSHOT.war host: traderfront

---timeout: 180memory: 1Gdomain: cfapps.ioinstances: 1services:- devsql- devmessagingapplications:- name: traderback path: dist/spring-nanotrader-asynch-services-1.0.1.BUILD-SNAPSHOT.war host: traderback- name: traderfront path: dist/spring-nanotrader-services-1.0.1.BUILD-SNAPSHOT.war host: traderfront

---timeout: 180memory: 1Gdomain: cfapps.ioinstances: 1services:- stagingsql- stagingmessagingapplications:- name: traderback path: dist/spring-nanotrader-asynch-services-1.0.1.BUILD-SNAPSHOT.war host: traderback- name: traderfront path: dist/spring-nanotrader-services-1.0.1.BUILD-SNAPSHOT.war host: traderfront

Page 18: Deploy your Multi-tier Application in Cloud Foundry

18© Copyright 2013 Pivotal. All rights reserved.

Services Marketplace and Plans

Page 19: Deploy your Multi-tier Application in Cloud Foundry

19© Copyright 2013 Pivotal. All rights reserved.

Auto-reconfiguration

<rabbit:connection-factory id="connectionFactory" host="${NANO_RABBIT_HOST:localhost}" port="${NANO_RABBIT_PORT:5672}"/>

Old:

New:<cloud:rabbit-connection-factory id="connectionFactory"/>

DO NOT USE AUTORECONFIGURATION!! (esp. in production)

Page 20: Deploy your Multi-tier Application in Cloud Foundry

20© Copyright 2013 Pivotal. All rights reserved.

Pull Requests Welcome!

Cross-site scripting Session State Caching

Page 21: Deploy your Multi-tier Application in Cloud Foundry

21© Copyright 2013 Pivotal. All rights reserved.

State, Statelessness and Scale

Cloud Controller Health Manager

Stateless part of your app Stateful part

Browser

CLI

Native App

Mobile App

DEA

DEA

Application Runners (DEA)

Rout

er

Page 22: Deploy your Multi-tier Application in Cloud Foundry

22© Copyright 2013 Pivotal. All rights reserved.

… to here

Page 23: Deploy your Multi-tier Application in Cloud Foundry

A NEW PLATFORM FOR A NEW ERA