SlideShare uma empresa Scribd logo
1 de 34
Running Your Spring Apps in 
the Cloud 
At JavaOne 
Cornelia Davis 
Director, Platform Engineering, Cloud Foundry, Pivotal 
cdavis@pivotal.io | @cdavisafc | October 2014 
© Copyright 2013 Pivotal. All rights reserved. 1
Let’s push an app 
© Copyright 2013 Pivotal. All rights reserved. 2
Overview: Deploying App to 
Cloud Foundry Runtime 
① Upload app 
bits and 
metadata 
push app 
Router 
+ app MD 
② Create and bind services 
③ Stage application 
④ Deploy application 
⑤ Manage application health 
…which is a whole ‘nother topic 
Service 
credentials 
Service Broker 
Node(s) 
Cloud Foundry 
Runtime (PaaS) 
Blobstore DB 
Cloud 
Controller 
DEA 
DEA 
DEA 
DEA 
+ = 
© Copyright 2013 Pivotal. All rights reserved. 3
Software 
© Copyright 2013 Pivotal. All rights reserved. 4
Software is Changing Industries 
$3.5B valuation 
–Financial Services 
$3.5B valuation 
– Travel & Hospitality 
$17B valuation 
– Transportation 
$1.1B acquisition by 
Monsanto – Agriculture 
$19B valuation 
– Entertainment 
$3.2B acquisition by 
Google– Digital Home 
© Copyright 2013 Pivotal. All rights reserved. 5
Spring Trader 
Reference Application from VMWare to demonstrate the vFabric Suite 
https://github.com/cf-platform-eng/springtrader-cf 
© Copyright 2013 Pivotal. All rights reserved. 6
From here … 
© Copyright 2013 Pivotal. All rights reserved. 7
Agenda (1/2) 
 Auto reconfiguration 
 Services plans 
 Apps and Manifests 
 Cross-site scripting 
 JNDI  Service Catalog 
 Spring Cloud Connector 
© Copyright 2013 Pivotal. All rights reserved. 8
Agenda (2/2) 
 Apps as Services 
 Define Service Type 
 XSS 
© Copyright 2013 Pivotal. All rights reserved. 9
Cross-site Scripting 
hhtttptp:/://s/tpraridnegrtwraedbe.rc.cfaopmp/sw.ieob 
http://springtrader.com/services 
http://traderservices.cfapps.io 
© Copyright 2013 Pivotal. All rights reserved. 10
Cross-site Scripting 
http://traderfront.cfapps.io 
One war file 
© Copyright 2013 Pivotal. All rights reserved. 11
JNDI  Service Instances 
Old: <jee:jndi-lookup id="dataSource" jndi-name="jdbc/nanodb" /> 
© Copyright 2013 Pivotal. All rights reserved. 12
Spring Cloud 
VCAP_SERVICES={"cleardb-n/ 
a":[{"name":"tradersql","label":"cleardb-n/ 
a","tags":["mysql","relational"],"plan":"spark","credentials":{"jdbcUrl":"jd 
bc: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_595d583f143a 
dee","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://kl 
rdpgoo:mLpx_XtpEY7eJg-rG489FRs_J-jArqP6@tiger.cloudamqp.com/klrdpgoo"}}]} 
New: 
<cloud:data-source id="dataSource" service-name="tradersql"> 
characterEncoding=UTF-8;defaultTransactionIsolation=2”/> 
VCAP_SERVICES locally 
cf bind-service traderfront tradersql 
<cloud:connection 
properties="sessionVariables=sql_mode='ANSI'; 
<cloud:pool pool-size="2" max-wait-time="200" /> 
</cloud:data-source> 
OR 
<cloud:data-source id="dataSource"> 
... 
© Copyright 2013 Pivotal. All rights reserved. 13
(Big-A) Applications and Manifests 
http://traderfront.cfapps.io 
One war file 
Another war file 
© Copyright 2013 Pivotal. All rights reserved. 14
(Big-A) Applications and Manifests 
--- 
timeout: 180 
memory: 1G 
domain: cfapps.io 
instances: 1 
services: 
- tradersql 
- tradermessaging 
applications: 
- name: traderback 
Global properties apply to all applications 
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 
© Copyright 2013 Pivotal. All rights reserved. 15
Services Marketplace and Plans 
<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> 
© Copyright 2013 Pivotal. All rights reserved. 16
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"/> 
USE AUTORECONFIGURATION WITH CARE!! (esp. in production) 
© Copyright 2013 Pivotal. All rights reserved. 17
Deal with Cross-site Scripting 
<script> 
… accessing doc.something 
</script> 
… 
doc = XMLHTTPRequest 
http://example.com/foo 
… 
When one domain is 
responsible for both 
the HTML (with 
embedded scripts) 
and the content of the 
XMLHTTPRequest, 
all is fine. 
© Copyright 2013 Pivotal. All rights reserved. 18
Deal with Cross-site Scripting 
EVIL 
<script> 
… accessing doc.something 
</script> 
… 
doc = XMLHTTPRequest 
http://example.com/foo 
… 
When different domains: 
• Request will be sent 
• Browser will not make 
response available 
To accommodate: 
• Service lists domains 
from which requests will 
be allowed 
© Copyright 2013 Pivotal. All rights reserved. 19
Spring Cloud Connector Extension: HTTP Web Service 
public class BasicHttpWebServiceInfo extends UriBasedServiceInfo { 
public BasicHttpWebServiceInfo(String id, String host, 
int port, String username, 
String password, String virtualHost) 
{ 
super(id, "http", host, port, username, password, virtualHost); 
} 
public BasicHttpWebServiceInfo(String id, String uri) 
throws CloudException { 
super(id, uri); 
} 
… 
} 
SpringCloud built in: 
• Amqp 
• Mongo 
• Monitoring 
• Mysql 
• Oracle 
• Postgresql 
• Redis 
• Smtp 
© Copyright 2013 Pivotal. All rights reserved. 20
Spring Cloud Connector Extension: HTTP Web Service 
public class BasicHttpWebServiceInfoCreator extends CloudFoundryServiceInfoCreator<BasicHttpWebServiceInfo>{ 
public BasicHttpWebServiceInfoCreator() { 
super(new Tags(), "http"); 
} 
public BasicHttpWebServiceInfo createServiceInfo(Map<String,Object> serviceData) { 
@SuppressWarnings("unchecked") 
Map<String,Object> credentials = (Map<String, Object>) serviceData.get("credentials"); 
String id = (String) serviceData.get("name"); 
String uri = getStringFromCredentials(credentials, "uri", "url"); 
return new BasicHttpWebServiceInfo(id, uri); 
} 
} 
Here’s the tricky part: 
Put a file called org.springframework.cloud.cloudfoundry.CloudFoundryServiceInfoCreator on your 
classpath containing 
com.gopivotal.cloudfoundry.example.springcloud.BasicHttpWebServiceInfoCreator 
https://github.com/spring-cloud/spring-cloud-connectors/tree/master/spring-cloud-core 
© Copyright 2013 Pivotal. All rights reserved. 21
Cross-site Scripting 
© Copyright 2013 Pivotal. All rights reserved. 22
Apps as Services 
cf create-service … tradersql 
cf create-service … tradermessaging 
Message Broker 
Data Tier 
© Copyright 2013 Pivotal. All rights reserved. 23
Apps as Services 
cf push traderback 
cf bind-service traderback stsql 
cf bind-service traderback stmessaging 
Message Broker Trader Back 
Data Tier 
© Copyright 2013 Pivotal. All rights reserved. 24
Apps as Services 
cf push traderfront 
cf bind-service traderfront stsql 
cf bind-service traderfront stmessaging 
Trader Front Message Broker Trader Back 
Data Tier 
© Copyright 2013 Pivotal. All rights reserved. 25
Apps as Services 
Trader Front 
cf cups traderfront 
-p '{"uri": 
"http://traderfront.cfapps.io/api/"}' 
Message Broker Trader Back 
Data Tier 
app is a service 
© Copyright 2013 Pivotal. All rights reserved. 26
Apps as Services 
Trader Web 
cf push traderweb 
cf bind-service traderweb traderfront 
Trader Front Message Broker Trader Back 
Data Tier 
app is a service 
© Copyright 2013 Pivotal. All rights reserved. 27
And that is the current state of the repo 
© Copyright 2013 Pivotal. All rights reserved. 28
Login Session Replication 
Originally designed to use 
Gemfire peer to peer 
Trader Front 
Trader Front 
Trader Front 
© Copyright 2013 Pivotal. All rights reserved. 29
Login Session Replication 
DEA 
Firewalled application 
containers restrict this! 
Trader Front 
Trader Front 
Trader Front 
© Copyright 2013 Pivotal. All rights reserved. 30
Login Session Replication 
Redis for session state 
caching – Java buildpack v2.1 
BUT, we aren’t using 
HTTP sessions for 
auth tokens! 
(but the idea is right) 
Pull Requests 
Welcome!! 
Trader Front 
Trader Front 
Trader Front 
https://github.com/cloudfoundry/java-buildpack/blob/master/docs/container-tomcat.md#session-replication 
© Copyright 2013 Pivotal. All rights reserved. 31
… to here 
© Copyright 2013 Pivotal. All rights reserved. 32
© Copyright 2013 Pivotal. All rights reserved. 33
A NEW PLATFORM FOR A NEW ERA

Mais conteúdo relacionado

Mais procurados

PaaS application in Heroku
PaaS application in HerokuPaaS application in Heroku
PaaS application in Heroku
Dileepa Jayakody
 

Mais procurados (20)

Pivotal cloud foundry introduction
Pivotal cloud foundry introductionPivotal cloud foundry introduction
Pivotal cloud foundry introduction
 
Cloud Foundry Roadmap Update - OSCON - May 2017
Cloud Foundry Roadmap Update - OSCON - May 2017Cloud Foundry Roadmap Update - OSCON - May 2017
Cloud Foundry Roadmap Update - OSCON - May 2017
 
Manchester geek night pcf 101
Manchester geek night   pcf 101Manchester geek night   pcf 101
Manchester geek night pcf 101
 
Simplify Cloud Applications using Spring Cloud
Simplify Cloud Applications using Spring CloudSimplify Cloud Applications using Spring Cloud
Simplify Cloud Applications using Spring Cloud
 
Cloud Foundry - An Open Innovation Platform
Cloud Foundry - An Open Innovation PlatformCloud Foundry - An Open Innovation Platform
Cloud Foundry - An Open Innovation Platform
 
Four levels of HA in Cloud Foundry
Four levels of HA in Cloud FoundryFour levels of HA in Cloud Foundry
Four levels of HA in Cloud Foundry
 
Cloud Foundry Platform Operations - CF Summit 2015
Cloud Foundry Platform Operations - CF Summit 2015Cloud Foundry Platform Operations - CF Summit 2015
Cloud Foundry Platform Operations - CF Summit 2015
 
PCF Cloud-Native Workshop Slides
PCF Cloud-Native Workshop SlidesPCF Cloud-Native Workshop Slides
PCF Cloud-Native Workshop Slides
 
Building REST APIs with Spring Boot and Spring Cloud
Building REST APIs with Spring Boot and Spring CloudBuilding REST APIs with Spring Boot and Spring Cloud
Building REST APIs with Spring Boot and Spring Cloud
 
How to Scale Operations for a Multi-Cloud Platform using PCF
How to Scale Operations for a Multi-Cloud Platform using PCFHow to Scale Operations for a Multi-Cloud Platform using PCF
How to Scale Operations for a Multi-Cloud Platform using PCF
 
Pivotal Power Lunch - Why Cloud Native?
Pivotal Power Lunch - Why Cloud Native?Pivotal Power Lunch - Why Cloud Native?
Pivotal Power Lunch - Why Cloud Native?
 
Devops: Who Does What? - Devops Enterprise Summit 2016
Devops: Who Does What? - Devops Enterprise Summit 2016Devops: Who Does What? - Devops Enterprise Summit 2016
Devops: Who Does What? - Devops Enterprise Summit 2016
 
Cloud Foundry vs Docker vs Kubernetes - http://bit.ly/2rzUM2U
Cloud Foundry vs Docker vs Kubernetes - http://bit.ly/2rzUM2UCloud Foundry vs Docker vs Kubernetes - http://bit.ly/2rzUM2U
Cloud Foundry vs Docker vs Kubernetes - http://bit.ly/2rzUM2U
 
Pivotal microservices spring_pcf_skillsmatter.pptx
Pivotal microservices spring_pcf_skillsmatter.pptxPivotal microservices spring_pcf_skillsmatter.pptx
Pivotal microservices spring_pcf_skillsmatter.pptx
 
Stackato & Lessons Learned with Cloud Foundry (Cloud Foundry Summit 2014)
Stackato & Lessons Learned with Cloud Foundry (Cloud Foundry Summit 2014)Stackato & Lessons Learned with Cloud Foundry (Cloud Foundry Summit 2014)
Stackato & Lessons Learned with Cloud Foundry (Cloud Foundry Summit 2014)
 
Spring Boot Whirlwind Tour
Spring Boot Whirlwind TourSpring Boot Whirlwind Tour
Spring Boot Whirlwind Tour
 
What's new in Pivotal Cloud Foundry 1.6
What's new in Pivotal Cloud Foundry 1.6What's new in Pivotal Cloud Foundry 1.6
What's new in Pivotal Cloud Foundry 1.6
 
Pivotal Cloud Foundry 2.5: A First Look
Pivotal Cloud Foundry 2.5: A First LookPivotal Cloud Foundry 2.5: A First Look
Pivotal Cloud Foundry 2.5: A First Look
 
PaaS application in Heroku
PaaS application in HerokuPaaS application in Heroku
PaaS application in Heroku
 
Spring Boot Loves K8s
Spring Boot Loves K8sSpring Boot Loves K8s
Spring Boot Loves K8s
 

Destaque

Velocity NY 2016 - Devops: Who Does What?
Velocity NY 2016 - Devops: Who Does What?Velocity NY 2016 - Devops: Who Does What?
Velocity NY 2016 - Devops: Who Does What?
cornelia davis
 

Destaque (19)

Cloud Foundry - Platform as a Service for vSphere
Cloud Foundry - Platform as a Service for vSphereCloud Foundry - Platform as a Service for vSphere
Cloud Foundry - Platform as a Service for vSphere
 
Enterprise PaaS Golden Pitch
Enterprise PaaS Golden Pitch Enterprise PaaS Golden Pitch
Enterprise PaaS Golden Pitch
 
IoT and Microservice
IoT and MicroserviceIoT and Microservice
IoT and Microservice
 
Unlock Your VMW IaaS Investment with Pivotal CF - VMWorld 2014
Unlock Your VMW IaaS Investment with Pivotal CF - VMWorld 2014Unlock Your VMW IaaS Investment with Pivotal CF - VMWorld 2014
Unlock Your VMW IaaS Investment with Pivotal CF - VMWorld 2014
 
Pivotal Cloud Platform Roadshow Keynote
Pivotal Cloud Platform Roadshow KeynotePivotal Cloud Platform Roadshow Keynote
Pivotal Cloud Platform Roadshow Keynote
 
Competing with Software: It Takes a Platform -- Devops @ EMC World
Competing with Software: It Takes a Platform -- Devops @ EMC WorldCompeting with Software: It Takes a Platform -- Devops @ EMC World
Competing with Software: It Takes a Platform -- Devops @ EMC World
 
12 Factor, or Cloud Native Apps – What EXACTLY Does that Mean for Spring Deve...
12 Factor, or Cloud Native Apps – What EXACTLY Does that Mean for Spring Deve...12 Factor, or Cloud Native Apps – What EXACTLY Does that Mean for Spring Deve...
12 Factor, or Cloud Native Apps – What EXACTLY Does that Mean for Spring Deve...
 
Removing Barriers Between Dev and Ops
Removing Barriers Between Dev and OpsRemoving Barriers Between Dev and Ops
Removing Barriers Between Dev and Ops
 
Software Quality in the Devops World: The Impact of Continuous Delivery on Te...
Software Quality in the Devops World: The Impact of Continuous Delivery on Te...Software Quality in the Devops World: The Impact of Continuous Delivery on Te...
Software Quality in the Devops World: The Impact of Continuous Delivery on Te...
 
Linux Collaboration Summit Keynote: Transformation: It Takes a Platform
Linux Collaboration Summit Keynote: Transformation: It Takes a PlatformLinux Collaboration Summit Keynote: Transformation: It Takes a Platform
Linux Collaboration Summit Keynote: Transformation: It Takes a Platform
 
Velocity NY 2016 - Devops: Who Does What?
Velocity NY 2016 - Devops: Who Does What?Velocity NY 2016 - Devops: Who Does What?
Velocity NY 2016 - Devops: Who Does What?
 
Cloud Foundry Introduction (w Demo) at Silicon Valley Code Camp
Cloud Foundry Introduction (w Demo) at Silicon Valley Code CampCloud Foundry Introduction (w Demo) at Silicon Valley Code Camp
Cloud Foundry Introduction (w Demo) at Silicon Valley Code Camp
 
Evolving Devops: The Benefits of PaaS and Application Dial Tone
Evolving Devops: The Benefits of PaaS and Application Dial ToneEvolving Devops: The Benefits of PaaS and Application Dial Tone
Evolving Devops: The Benefits of PaaS and Application Dial Tone
 
Adopting Azure, Cloud Foundry and Microservice Architecture at Merrill Corpor...
Adopting Azure, Cloud Foundry and Microservice Architecture at Merrill Corpor...Adopting Azure, Cloud Foundry and Microservice Architecture at Merrill Corpor...
Adopting Azure, Cloud Foundry and Microservice Architecture at Merrill Corpor...
 
Devops: Enabled Through a Recasting of Operational Roles
Devops: Enabled Through a Recasting of Operational RolesDevops: Enabled Through a Recasting of Operational Roles
Devops: Enabled Through a Recasting of Operational Roles
 
From 0 to 1000 Apps: The First Year of Cloud Foundry at the Home Depot
From 0 to 1000 Apps: The First Year of Cloud Foundry at the Home DepotFrom 0 to 1000 Apps: The First Year of Cloud Foundry at the Home Depot
From 0 to 1000 Apps: The First Year of Cloud Foundry at the Home Depot
 
Cloud Foundry Diego, Lattice, Docker and more
Cloud Foundry Diego, Lattice, Docker and moreCloud Foundry Diego, Lattice, Docker and more
Cloud Foundry Diego, Lattice, Docker and more
 
Pivotal Cloud Foundry: A Technical Overview
Pivotal Cloud Foundry: A Technical OverviewPivotal Cloud Foundry: A Technical Overview
Pivotal Cloud Foundry: A Technical Overview
 
Cloud-native Data: Every Microservice Needs a Cache
Cloud-native Data: Every Microservice Needs a CacheCloud-native Data: Every Microservice Needs a Cache
Cloud-native Data: Every Microservice Needs a Cache
 

Semelhante a Running your Spring Apps in the Cloud Javaone 2014

OpenStack + Cloud Foundry for the OpenStack Boston Meetup
OpenStack + Cloud Foundry for the OpenStack Boston MeetupOpenStack + Cloud Foundry for the OpenStack Boston Meetup
OpenStack + Cloud Foundry for the OpenStack Boston Meetup
ragss
 

Semelhante a Running your Spring Apps in the Cloud Javaone 2014 (20)

Deploy your Multi-tier Application in Cloud Foundry
Deploy your Multi-tier Application in Cloud FoundryDeploy your Multi-tier Application in Cloud Foundry
Deploy your Multi-tier Application in Cloud Foundry
 
Sydney cloud foundry meetup - Service Brokers
Sydney cloud foundry meetup - Service  BrokersSydney cloud foundry meetup - Service  Brokers
Sydney cloud foundry meetup - Service Brokers
 
OpenStack + CloudFoundry Austin Meetup
OpenStack + CloudFoundry Austin MeetupOpenStack + CloudFoundry Austin Meetup
OpenStack + CloudFoundry Austin Meetup
 
OS + CF Austin meetup
OS + CF Austin meetupOS + CF Austin meetup
OS + CF Austin meetup
 
Node summit workshop
Node summit workshopNode summit workshop
Node summit workshop
 
Techdays Helsinki - Creating the distributed apps of the future using dapr - ...
Techdays Helsinki - Creating the distributed apps of the future using dapr - ...Techdays Helsinki - Creating the distributed apps of the future using dapr - ...
Techdays Helsinki - Creating the distributed apps of the future using dapr - ...
 
Sst hackathon express
Sst hackathon expressSst hackathon express
Sst hackathon express
 
VMworld 2013: Protecting Enterprise Workloads Within a vCloud Service Provide...
VMworld 2013: Protecting Enterprise Workloads Within a vCloud Service Provide...VMworld 2013: Protecting Enterprise Workloads Within a vCloud Service Provide...
VMworld 2013: Protecting Enterprise Workloads Within a vCloud Service Provide...
 
Easy integration of Bluemix services with your applications
Easy integration of Bluemix services with your applicationsEasy integration of Bluemix services with your applications
Easy integration of Bluemix services with your applications
 
Brocade Software Networking (SDN NFV Day ITB 2016)
Brocade Software Networking (SDN NFV Day ITB 2016)Brocade Software Networking (SDN NFV Day ITB 2016)
Brocade Software Networking (SDN NFV Day ITB 2016)
 
OpenStack + Cloud Foundry for the OpenStack Boston Meetup
OpenStack + Cloud Foundry for the OpenStack Boston MeetupOpenStack + Cloud Foundry for the OpenStack Boston Meetup
OpenStack + Cloud Foundry for the OpenStack Boston Meetup
 
Development on Cloud,PaaS and SDDC
Development on Cloud,PaaS and SDDCDevelopment on Cloud,PaaS and SDDC
Development on Cloud,PaaS and SDDC
 
Development on cloud_paa_s_sddc_mkim_20141216_final
Development on cloud_paa_s_sddc_mkim_20141216_finalDevelopment on cloud_paa_s_sddc_mkim_20141216_final
Development on cloud_paa_s_sddc_mkim_20141216_final
 
DevCon5 (July 2014) - Acision SDK
DevCon5 (July 2014) - Acision SDKDevCon5 (July 2014) - Acision SDK
DevCon5 (July 2014) - Acision SDK
 
Cloud Computing and the Promise of Everything as a Service
Cloud Computing and the Promise of Everything as a ServiceCloud Computing and the Promise of Everything as a Service
Cloud Computing and the Promise of Everything as a Service
 
Cloud Foundry - Second Generation Code (CCNG). Technical Overview
Cloud Foundry - Second Generation Code (CCNG). Technical Overview Cloud Foundry - Second Generation Code (CCNG). Technical Overview
Cloud Foundry - Second Generation Code (CCNG). Technical Overview
 
Introduction to CloudStack API
Introduction to CloudStack APIIntroduction to CloudStack API
Introduction to CloudStack API
 
Cloud Roundtable | Pivoltal: Agile platform
Cloud Roundtable | Pivoltal: Agile platformCloud Roundtable | Pivoltal: Agile platform
Cloud Roundtable | Pivoltal: Agile platform
 
The waf book intro v1.0 lior rotkovitch
The waf book intro v1.0 lior rotkovitchThe waf book intro v1.0 lior rotkovitch
The waf book intro v1.0 lior rotkovitch
 
Scala dayssrinivas v3
Scala dayssrinivas v3Scala dayssrinivas v3
Scala dayssrinivas v3
 

Mais de cornelia davis

Mais de cornelia davis (10)

You've Made Kubernetes Available to Your Developers, Now What?
You've Made Kubernetes Available to Your Developers, Now What?You've Made Kubernetes Available to Your Developers, Now What?
You've Made Kubernetes Available to Your Developers, Now What?
 
You Might Just be a Functional Programmer Now
You Might Just be a Functional Programmer NowYou Might Just be a Functional Programmer Now
You Might Just be a Functional Programmer Now
 
Kubernetes: one cluster or many
Kubernetes:  one cluster or many Kubernetes:  one cluster or many
Kubernetes: one cluster or many
 
Pivotal Container Service (PKS) at SF Cloud Foundry Meetup
Pivotal Container Service (PKS) at SF Cloud Foundry MeetupPivotal Container Service (PKS) at SF Cloud Foundry Meetup
Pivotal Container Service (PKS) at SF Cloud Foundry Meetup
 
It’s Not Just Request/Response: Understanding Event-driven Microservices
It’s Not Just Request/Response: Understanding Event-driven MicroservicesIt’s Not Just Request/Response: Understanding Event-driven Microservices
It’s Not Just Request/Response: Understanding Event-driven Microservices
 
Cloud Native Architectures for Devops
Cloud Native Architectures for DevopsCloud Native Architectures for Devops
Cloud Native Architectures for Devops
 
Cloud-native Data
Cloud-native DataCloud-native Data
Cloud-native Data
 
Kubo (Cloud Foundry Container Platform): Your Gateway Drug to Cloud-native
Kubo (Cloud Foundry Container Platform): Your Gateway Drug to Cloud-nativeKubo (Cloud Foundry Container Platform): Your Gateway Drug to Cloud-native
Kubo (Cloud Foundry Container Platform): Your Gateway Drug to Cloud-native
 
Cloud Native: Designing Change-tolerant Software
Cloud Native: Designing Change-tolerant SoftwareCloud Native: Designing Change-tolerant Software
Cloud Native: Designing Change-tolerant Software
 
Cloud Native: Designing Change-tolerant Software
Cloud Native: Designing Change-tolerant SoftwareCloud Native: Designing Change-tolerant Software
Cloud Native: Designing Change-tolerant Software
 

Último

Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
 

Último (20)

Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
Manulife - Insurer Innovation Award 2024
Manulife - Insurer Innovation Award 2024Manulife - Insurer Innovation Award 2024
Manulife - Insurer Innovation Award 2024
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsTop 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 
Top 10 Most Downloaded Games on Play Store in 2024
Top 10 Most Downloaded Games on Play Store in 2024Top 10 Most Downloaded Games on Play Store in 2024
Top 10 Most Downloaded Games on Play Store in 2024
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 

Running your Spring Apps in the Cloud Javaone 2014

  • 1. Running Your Spring Apps in the Cloud At JavaOne Cornelia Davis Director, Platform Engineering, Cloud Foundry, Pivotal cdavis@pivotal.io | @cdavisafc | October 2014 © Copyright 2013 Pivotal. All rights reserved. 1
  • 2. Let’s push an app © Copyright 2013 Pivotal. All rights reserved. 2
  • 3. Overview: Deploying App to Cloud Foundry Runtime ① Upload app bits and metadata push app Router + app MD ② Create and bind services ③ Stage application ④ Deploy application ⑤ Manage application health …which is a whole ‘nother topic Service credentials Service Broker Node(s) Cloud Foundry Runtime (PaaS) Blobstore DB Cloud Controller DEA DEA DEA DEA + = © Copyright 2013 Pivotal. All rights reserved. 3
  • 4. Software © Copyright 2013 Pivotal. All rights reserved. 4
  • 5. Software is Changing Industries $3.5B valuation –Financial Services $3.5B valuation – Travel & Hospitality $17B valuation – Transportation $1.1B acquisition by Monsanto – Agriculture $19B valuation – Entertainment $3.2B acquisition by Google– Digital Home © Copyright 2013 Pivotal. All rights reserved. 5
  • 6. Spring Trader Reference Application from VMWare to demonstrate the vFabric Suite https://github.com/cf-platform-eng/springtrader-cf © Copyright 2013 Pivotal. All rights reserved. 6
  • 7. From here … © Copyright 2013 Pivotal. All rights reserved. 7
  • 8. Agenda (1/2)  Auto reconfiguration  Services plans  Apps and Manifests  Cross-site scripting  JNDI  Service Catalog  Spring Cloud Connector © Copyright 2013 Pivotal. All rights reserved. 8
  • 9. Agenda (2/2)  Apps as Services  Define Service Type  XSS © Copyright 2013 Pivotal. All rights reserved. 9
  • 10. Cross-site Scripting hhtttptp:/://s/tpraridnegrtwraedbe.rc.cfaopmp/sw.ieob http://springtrader.com/services http://traderservices.cfapps.io © Copyright 2013 Pivotal. All rights reserved. 10
  • 11. Cross-site Scripting http://traderfront.cfapps.io One war file © Copyright 2013 Pivotal. All rights reserved. 11
  • 12. JNDI  Service Instances Old: <jee:jndi-lookup id="dataSource" jndi-name="jdbc/nanodb" /> © Copyright 2013 Pivotal. All rights reserved. 12
  • 13. Spring Cloud VCAP_SERVICES={"cleardb-n/ a":[{"name":"tradersql","label":"cleardb-n/ a","tags":["mysql","relational"],"plan":"spark","credentials":{"jdbcUrl":"jd bc: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_595d583f143a dee","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://kl rdpgoo:mLpx_XtpEY7eJg-rG489FRs_J-jArqP6@tiger.cloudamqp.com/klrdpgoo"}}]} New: <cloud:data-source id="dataSource" service-name="tradersql"> characterEncoding=UTF-8;defaultTransactionIsolation=2”/> VCAP_SERVICES locally cf bind-service traderfront tradersql <cloud:connection properties="sessionVariables=sql_mode='ANSI'; <cloud:pool pool-size="2" max-wait-time="200" /> </cloud:data-source> OR <cloud:data-source id="dataSource"> ... © Copyright 2013 Pivotal. All rights reserved. 13
  • 14. (Big-A) Applications and Manifests http://traderfront.cfapps.io One war file Another war file © Copyright 2013 Pivotal. All rights reserved. 14
  • 15. (Big-A) Applications and Manifests --- timeout: 180 memory: 1G domain: cfapps.io instances: 1 services: - tradersql - tradermessaging applications: - name: traderback Global properties apply to all applications 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 © Copyright 2013 Pivotal. All rights reserved. 15
  • 16. Services Marketplace and Plans <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> © Copyright 2013 Pivotal. All rights reserved. 16
  • 17. 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"/> USE AUTORECONFIGURATION WITH CARE!! (esp. in production) © Copyright 2013 Pivotal. All rights reserved. 17
  • 18. Deal with Cross-site Scripting <script> … accessing doc.something </script> … doc = XMLHTTPRequest http://example.com/foo … When one domain is responsible for both the HTML (with embedded scripts) and the content of the XMLHTTPRequest, all is fine. © Copyright 2013 Pivotal. All rights reserved. 18
  • 19. Deal with Cross-site Scripting EVIL <script> … accessing doc.something </script> … doc = XMLHTTPRequest http://example.com/foo … When different domains: • Request will be sent • Browser will not make response available To accommodate: • Service lists domains from which requests will be allowed © Copyright 2013 Pivotal. All rights reserved. 19
  • 20. Spring Cloud Connector Extension: HTTP Web Service public class BasicHttpWebServiceInfo extends UriBasedServiceInfo { public BasicHttpWebServiceInfo(String id, String host, int port, String username, String password, String virtualHost) { super(id, "http", host, port, username, password, virtualHost); } public BasicHttpWebServiceInfo(String id, String uri) throws CloudException { super(id, uri); } … } SpringCloud built in: • Amqp • Mongo • Monitoring • Mysql • Oracle • Postgresql • Redis • Smtp © Copyright 2013 Pivotal. All rights reserved. 20
  • 21. Spring Cloud Connector Extension: HTTP Web Service public class BasicHttpWebServiceInfoCreator extends CloudFoundryServiceInfoCreator<BasicHttpWebServiceInfo>{ public BasicHttpWebServiceInfoCreator() { super(new Tags(), "http"); } public BasicHttpWebServiceInfo createServiceInfo(Map<String,Object> serviceData) { @SuppressWarnings("unchecked") Map<String,Object> credentials = (Map<String, Object>) serviceData.get("credentials"); String id = (String) serviceData.get("name"); String uri = getStringFromCredentials(credentials, "uri", "url"); return new BasicHttpWebServiceInfo(id, uri); } } Here’s the tricky part: Put a file called org.springframework.cloud.cloudfoundry.CloudFoundryServiceInfoCreator on your classpath containing com.gopivotal.cloudfoundry.example.springcloud.BasicHttpWebServiceInfoCreator https://github.com/spring-cloud/spring-cloud-connectors/tree/master/spring-cloud-core © Copyright 2013 Pivotal. All rights reserved. 21
  • 22. Cross-site Scripting © Copyright 2013 Pivotal. All rights reserved. 22
  • 23. Apps as Services cf create-service … tradersql cf create-service … tradermessaging Message Broker Data Tier © Copyright 2013 Pivotal. All rights reserved. 23
  • 24. Apps as Services cf push traderback cf bind-service traderback stsql cf bind-service traderback stmessaging Message Broker Trader Back Data Tier © Copyright 2013 Pivotal. All rights reserved. 24
  • 25. Apps as Services cf push traderfront cf bind-service traderfront stsql cf bind-service traderfront stmessaging Trader Front Message Broker Trader Back Data Tier © Copyright 2013 Pivotal. All rights reserved. 25
  • 26. Apps as Services Trader Front cf cups traderfront -p '{"uri": "http://traderfront.cfapps.io/api/"}' Message Broker Trader Back Data Tier app is a service © Copyright 2013 Pivotal. All rights reserved. 26
  • 27. Apps as Services Trader Web cf push traderweb cf bind-service traderweb traderfront Trader Front Message Broker Trader Back Data Tier app is a service © Copyright 2013 Pivotal. All rights reserved. 27
  • 28. And that is the current state of the repo © Copyright 2013 Pivotal. All rights reserved. 28
  • 29. Login Session Replication Originally designed to use Gemfire peer to peer Trader Front Trader Front Trader Front © Copyright 2013 Pivotal. All rights reserved. 29
  • 30. Login Session Replication DEA Firewalled application containers restrict this! Trader Front Trader Front Trader Front © Copyright 2013 Pivotal. All rights reserved. 30
  • 31. Login Session Replication Redis for session state caching – Java buildpack v2.1 BUT, we aren’t using HTTP sessions for auth tokens! (but the idea is right) Pull Requests Welcome!! Trader Front Trader Front Trader Front https://github.com/cloudfoundry/java-buildpack/blob/master/docs/container-tomcat.md#session-replication © Copyright 2013 Pivotal. All rights reserved. 31
  • 32. … to here © Copyright 2013 Pivotal. All rights reserved. 32
  • 33. © Copyright 2013 Pivotal. All rights reserved. 33
  • 34. A NEW PLATFORM FOR A NEW ERA

Notas do Editor

  1. Cloud Foundry PaaS An application runs in a DEA, which is a droplet execution agent. The Cloud Controller orchestrates the routing and lifecycle of all DEAs in the pool. Routers manage application traffic. Health Manager reports mismatched application states to the CC. A service broker provides an interface for services (native or external). A messaging bus manages all system communication. Apps are accessed directly through the router while web and CLI clients (e.g., vmc, STS) access Cloud Controller via RESTful services.
  2. Software is eating the world - executives cite software as the top factor impacting their organizations. Companies effectively using software development to achieve competitive advantage are more profitable than their peers
  3. Organizations such as Square ($3.5B valuation, Financial Services), Uber ($3.5B valuation, Transportation), Netflix ($19B valuation, Media and Entertainment), Airbnb ($3.5B valuation, Hospitality), the Climate Corporation ($1.1B acquisition, Agriculture) and Etsy ($600M valuation, Boutique Retail) are using software to change industries and disrupt business models
  4. Push the app
  5. Push the app
  6. Push the app