deploy your multi-tier application in cloud foundry

Post on 27-Aug-2014

572 Views

Category:

Software

1 Downloads

Preview:

Click to see full reader

DESCRIPTION

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

TRANSCRIPT

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 Engineeringcdavisafc@gopivotal.com | twitter: @cdavisafc | March 2014

2© Copyright 2013 Pivotal. All rights reserved.

Let’s push an app

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

4© Copyright 2013 Pivotal. All rights reserved.

Software

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

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

7© Copyright 2013 Pivotal. All rights reserved.

From here …

8© Copyright 2013 Pivotal. All rights reserved.

Agenda

Cross-site scripting JNDI Service Catalog Spring Cloud

Apps and Manifests

Services plans

Auto reconfiguration

9© Copyright 2013 Pivotal. All rights reserved.

Cross-site Scripting

http://springtrader.com/services

http://springtrader.com/web

10© Copyright 2013 Pivotal. All rights reserved.

Cross-site Scripting

http://traderweb.cfapps.io

http://traderservices.cfapps.io

11© Copyright 2013 Pivotal. All rights reserved.

Cross-site Scripting

http://traderfront.cfapps.ioOne war file

This is a hack!!

12© Copyright 2013 Pivotal. All rights reserved.

JNDI Service Instances

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

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:79581497@us-cdbr-east-05.cleardb.net:3306/ad_595d583f143adee","uri":"mysql://baf8a1e6a292a2:79581497@us-cdbr-east-05.cleardb.net: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:mLpx_XtpEY7eJg-rG489FRs_J-jArqP6@tiger.cloudamqp.com/klrdpgoo"}}]}

New:

14© Copyright 2013 Pivotal. All rights reserved.

(Big-A) Applications and Manifests

http://traderfront.cfapps.ioOne war file

Another war file

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

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

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

18© Copyright 2013 Pivotal. All rights reserved.

Services Marketplace and Plans

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)

20© Copyright 2013 Pivotal. All rights reserved.

Pull Requests Welcome!

Cross-site scripting Session State Caching

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

22© Copyright 2013 Pivotal. All rights reserved.

… to here

A NEW PLATFORM FOR A NEW ERA

top related