Cloud Foundry for Spring Developers
-
Upload
gunnar-hillert -
Category
Technology
-
view
3.409 -
download
5
description
Transcript of Cloud Foundry for Spring Developers
![Page 1: Cloud Foundry for Spring Developers](https://reader034.fdocuments.net/reader034/viewer/2022052618/554a0f72b4c905825d8b4921/html5/thumbnails/1.jpg)
© 2011 SpringSource, A division of VMware. All rights reserved
Cloud Foundry for Spring Developers
Gunnar Hillert, Member of Technical Staff, Spring Integration
![Page 2: Cloud Foundry for Spring Developers](https://reader034.fdocuments.net/reader034/viewer/2022052618/554a0f72b4c905825d8b4921/html5/thumbnails/2.jpg)
2 2
Agenda
§ Overview § Deployment § Debugging § Profiling § Agnostic War Files § Modular Cloud Apps
![Page 3: Cloud Foundry for Spring Developers](https://reader034.fdocuments.net/reader034/viewer/2022052618/554a0f72b4c905825d8b4921/html5/thumbnails/3.jpg)
3 3
What is Cloud Foundry?
![Page 4: Cloud Foundry for Spring Developers](https://reader034.fdocuments.net/reader034/viewer/2022052618/554a0f72b4c905825d8b4921/html5/thumbnails/4.jpg)
4 4
![Page 5: Cloud Foundry for Spring Developers](https://reader034.fdocuments.net/reader034/viewer/2022052618/554a0f72b4c905825d8b4921/html5/thumbnails/5.jpg)
5 5
Three Layers of Cloud Computing
§ SaaS • Software as a Service
§ PaaS • Platform as a Service
§ IaaS • Infrastructure as a Service
![Page 6: Cloud Foundry for Spring Developers](https://reader034.fdocuments.net/reader034/viewer/2022052618/554a0f72b4c905825d8b4921/html5/thumbnails/6.jpg)
6 6
Private Clouds
Public Clouds
Micro Clouds
Choice of clouds
.js
Data Services
Other Services
Msg Services
.COM
…
![Page 7: Cloud Foundry for Spring Developers](https://reader034.fdocuments.net/reader034/viewer/2022052618/554a0f72b4c905825d8b4921/html5/thumbnails/7.jpg)
7 7
Broad Support for Languages/Application Frameworks
§ JVM • Spring, Grails, Roo, Lift, plain Java
§ Ruby • Rails, Sinatra
§ Node.js § Community contributions • Erlang, Python, PHP
![Page 8: Cloud Foundry for Spring Developers](https://reader034.fdocuments.net/reader034/viewer/2022052618/554a0f72b4c905825d8b4921/html5/thumbnails/8.jpg)
8 8
JVM Frameworks
§ Unit of deployment: Java WAR files • Can run any standard War file • Servlet 2.5
• Don’t assume particular container
§ Spring, Grails, Lift framework • Auto-reconfiguration goodies
![Page 9: Cloud Foundry for Spring Developers](https://reader034.fdocuments.net/reader034/viewer/2022052618/554a0f72b4c905825d8b4921/html5/thumbnails/9.jpg)
9 9
Services
§ Relational database • Postgres • MySQL
§ Key-value store • Redis
§ Document store • MongoDB
§ Messaging • RabbitMQ
![Page 10: Cloud Foundry for Spring Developers](https://reader034.fdocuments.net/reader034/viewer/2022052618/554a0f72b4c905825d8b4921/html5/thumbnails/10.jpg)
10 10
Open Source
§ Source code available under Apache License v2.0 • https://github.com/cloudfoundry/
• VCAP • https://github.com/cloudfoundry/vcap
• Project Website • http://cloudfoundry.org/
![Page 11: Cloud Foundry for Spring Developers](https://reader034.fdocuments.net/reader034/viewer/2022052618/554a0f72b4c905825d8b4921/html5/thumbnails/11.jpg)
11 11
Logical View
![Page 12: Cloud Foundry for Spring Developers](https://reader034.fdocuments.net/reader034/viewer/2022052618/554a0f72b4c905825d8b4921/html5/thumbnails/12.jpg)
12 12
Architecture
25
Architecture
Thursday, October 27, 11
![Page 13: Cloud Foundry for Spring Developers](https://reader034.fdocuments.net/reader034/viewer/2022052618/554a0f72b4c905825d8b4921/html5/thumbnails/13.jpg)
13 13
Deployment Options
![Page 14: Cloud Foundry for Spring Developers](https://reader034.fdocuments.net/reader034/viewer/2022052618/554a0f72b4c905825d8b4921/html5/thumbnails/14.jpg)
14 14
Deployment Options
§ VMC • Ruby based command line tool
§ SpringSource Tool Suite (STS) § Grails § Spring Roo Cloud Foundry Addon § Cloud Foundry Maven Plugin § vcap-java-client
• Used by STS and Cloud Foundry Maven Plugin
![Page 15: Cloud Foundry for Spring Developers](https://reader034.fdocuments.net/reader034/viewer/2022052618/554a0f72b4c905825d8b4921/html5/thumbnails/15.jpg)
15 15
DEMO Deployment Options
![Page 16: Cloud Foundry for Spring Developers](https://reader034.fdocuments.net/reader034/viewer/2022052618/554a0f72b4c905825d8b4921/html5/thumbnails/16.jpg)
16 16
Debugging
![Page 17: Cloud Foundry for Spring Developers](https://reader034.fdocuments.net/reader034/viewer/2022052618/554a0f72b4c905825d8b4921/html5/thumbnails/17.jpg)
17 17
Debugging
§ Start Cloud Foundry applications in debug mode § Set Break Points for Micro Cloud Foundry § STS 2.8.1 supports it § Coming with Micro Cloud Foundry 1.1.1 (Currently RC)
![Page 18: Cloud Foundry for Spring Developers](https://reader034.fdocuments.net/reader034/viewer/2022052618/554a0f72b4c905825d8b4921/html5/thumbnails/18.jpg)
18 18
Caldecott
§ TCP over HTTP tunnel § Local client § Remote server
![Page 19: Cloud Foundry for Spring Developers](https://reader034.fdocuments.net/reader034/viewer/2022052618/554a0f72b4c905825d8b4921/html5/thumbnails/19.jpg)
19 19
Caldecott - Multiple Services and Sessions
§ One vcc server instance • Manages multiple tunnels
§ One vcc client instance per service • Multiple local apps may share a
client if they connect to the same remote server:port
• Each listens on different local port
![Page 20: Cloud Foundry for Spring Developers](https://reader034.fdocuments.net/reader034/viewer/2022052618/554a0f72b4c905825d8b4921/html5/thumbnails/20.jpg)
20 20
DEMO Debugging
![Page 21: Cloud Foundry for Spring Developers](https://reader034.fdocuments.net/reader034/viewer/2022052618/554a0f72b4c905825d8b4921/html5/thumbnails/21.jpg)
21 21
Profiling
![Page 22: Cloud Foundry for Spring Developers](https://reader034.fdocuments.net/reader034/viewer/2022052618/554a0f72b4c905825d8b4921/html5/thumbnails/22.jpg)
22 22
Profiling – Spring Insight
§ Providing real-time application runtime performance and behavior information for Java Spring applications
§ Beta available for CloudFoundry.com § Signup at: insight.cloudfoundry.com § Write your own plugins
• https://github.com/SpringSource/spring-insight-plugins
![Page 23: Cloud Foundry for Spring Developers](https://reader034.fdocuments.net/reader034/viewer/2022052618/554a0f72b4c905825d8b4921/html5/thumbnails/23.jpg)
23 23
DEMO Spring Insight for Cloud Foundry
![Page 24: Cloud Foundry for Spring Developers](https://reader034.fdocuments.net/reader034/viewer/2022052618/554a0f72b4c905825d8b4921/html5/thumbnails/24.jpg)
24 24
Agnostic War Files
![Page 25: Cloud Foundry for Spring Developers](https://reader034.fdocuments.net/reader034/viewer/2022052618/554a0f72b4c905825d8b4921/html5/thumbnails/25.jpg)
25 25
Agnostic War Files – Toolbox
§ Auto Reconfiguration § Cloud Namespace § Spring 3.1 Profiles
![Page 26: Cloud Foundry for Spring Developers](https://reader034.fdocuments.net/reader034/viewer/2022052618/554a0f72b4c905825d8b4921/html5/thumbnails/26.jpg)
26 26
Agnostic War Files – Auto Reconfiguration
§ Move existing Applications easily to Cloud Foundry § Makes 2 modifications at deploy time:
• Adds additional Jar • Updates web.xml
§ BeanFactoryPostProcessor examines the application context before creating beans
§ Swaps existing beans of matching types
![Page 27: Cloud Foundry for Spring Developers](https://reader034.fdocuments.net/reader034/viewer/2022052618/554a0f72b4c905825d8b4921/html5/thumbnails/27.jpg)
27 27
Agnostic War Files – Auto Reconfiguration
Service Type Replaced Bean Type
MySQL javax.sql.DataSource
Postgres javax.sql.DataSource
Redis org.sf.data.redis.connection.RedisConnectionFactory
MongoDB org.sf.data.document.mongodb.MongoDbFactory
RabbitMQ org.sf.amqp.rabbit.connection.ConnectionFactory
![Page 28: Cloud Foundry for Spring Developers](https://reader034.fdocuments.net/reader034/viewer/2022052618/554a0f72b4c905825d8b4921/html5/thumbnails/28.jpg)
28 28
Agnostic War Files – Auto Reconfiguration
§ Limitations • one service of a given service type • one bean of the matching type
• If application does not follow limits, auto-reconfiguration mechanism will not take place
![Page 29: Cloud Foundry for Spring Developers](https://reader034.fdocuments.net/reader034/viewer/2022052618/554a0f72b4c905825d8b4921/html5/thumbnails/29.jpg)
29 29
Agnostic War Files – Cloud Namespace
§ Explicit configuration of Cloud Foundry Services § Finer grained control of configuration parameters § Necessary when configuring multiple services of same type
![Page 30: Cloud Foundry for Spring Developers](https://reader034.fdocuments.net/reader034/viewer/2022052618/554a0f72b4c905825d8b4921/html5/thumbnails/30.jpg)
30 30
Agnostic War Files – Cloud Namespace
§ Setup – Maven
§ Setup – Spring Application Context
<dependency> <groupId>org.cloudfoundry</groupId> <artifactId>cloudfoundry-runtime</artifactId> <version>0.8.1</version> </dependency>
<?xml version="1.0" encoding="UTF-8"?> <beans … xmlns:cloud="http://schema.cloudfoundry.org/spring" xsi:schemaLocation=“http://schema.cloudfoundry.org/spring http://schema.cloudfoundry.org/spring/cloudfoundry-spring-0.8.xsd">
![Page 31: Cloud Foundry for Spring Developers](https://reader034.fdocuments.net/reader034/viewer/2022052618/554a0f72b4c905825d8b4921/html5/thumbnails/31.jpg)
31 31
Available Namespace Elements
§ Define and use a DataSource
§ Optional Subelements • <cloud:connection> • <cloud:pool>
<cloud:data-source id="dataSource" /> <bean id="jdbcTemplate” class="org.springframework.jdbc.core.JdbcTemplate"> <property name="dataSource" ref="dataSource" /> </bean>
![Page 32: Cloud Foundry for Spring Developers](https://reader034.fdocuments.net/reader034/viewer/2022052618/554a0f72b4c905825d8b4921/html5/thumbnails/32.jpg)
32 32
Available Namespace Elements
§ MongoDB Support • <cloud:mongo-db-factory>
§ Redis Support • <cloud:redis-connection-factory>
§ RabbitMQ • <cloud:rabbit-connection-factory>
§ Autocreate Services • <cloud:service-scan>
![Page 33: Cloud Foundry for Spring Developers](https://reader034.fdocuments.net/reader034/viewer/2022052618/554a0f72b4c905825d8b4921/html5/thumbnails/33.jpg)
33 33
Agnostic War Files – Spring Profiles
§ Spring 3.1 adds new support for environments § Deploy to Cloud Foundry and Stand-alone Containers
<bean id="mongoTemplate" class="org.springframework.data.mongodb.core.MongoTemplate"> <constructor-arg ref="mongoDbFactory" /> </bean> <beans profile="default"> <mongo:db-factory id="mongoDbFactory" dbname="pwdtest" host="127.0.0.1" port="27017" username="test_user" password=”s3cr3t" /> </beans> <beans profile="cloud"> <cloud:mongo-db-factory id="mongoDbFactory" /> </beans>
![Page 34: Cloud Foundry for Spring Developers](https://reader034.fdocuments.net/reader034/viewer/2022052618/554a0f72b4c905825d8b4921/html5/thumbnails/34.jpg)
34 34
Modular Cloud Apps
![Page 35: Cloud Foundry for Spring Developers](https://reader034.fdocuments.net/reader034/viewer/2022052618/554a0f72b4c905825d8b4921/html5/thumbnails/35.jpg)
35 35
Monolithic Enterprise Application
![Page 36: Cloud Foundry for Spring Developers](https://reader034.fdocuments.net/reader034/viewer/2022052618/554a0f72b4c905825d8b4921/html5/thumbnails/36.jpg)
36 36
Benefits of App-level Modularity
§ Efficient Elasticity § Fault Isolation § Dynamic Configuration § “always-on”/Rolling Upgrades
![Page 37: Cloud Foundry for Spring Developers](https://reader034.fdocuments.net/reader034/viewer/2022052618/554a0f72b4c905825d8b4921/html5/thumbnails/37.jpg)
37 37
Modularized Enterprise Application
![Page 38: Cloud Foundry for Spring Developers](https://reader034.fdocuments.net/reader034/viewer/2022052618/554a0f72b4c905825d8b4921/html5/thumbnails/38.jpg)
38 38
DEMO Spring Integration
![Page 39: Cloud Foundry for Spring Developers](https://reader034.fdocuments.net/reader034/viewer/2022052618/554a0f72b4c905825d8b4921/html5/thumbnails/39.jpg)
39 39
Resources
![Page 40: Cloud Foundry for Spring Developers](https://reader034.fdocuments.net/reader034/viewer/2022052618/554a0f72b4c905825d8b4921/html5/thumbnails/40.jpg)
40 40
Resources
§ Cloud Foundry on Ubuntu http://blog.dustinkirkland.com/2011/08/howto-install-cloudfoundry-server-paas.html
§ VMC http://support.cloudfoundry.com/entries/20012337-getting-started-guide-command-line-vmc-users http://cloudfoundry.zendesk.com/entries/20012462-getting-started-guide-sts-users http://blog.dustinkirkland.com/2011/07/getting-started-with-cloudfoundry.html
http://blog.cloudfoundry.com/post/9037486110/vmc-everywhere
![Page 41: Cloud Foundry for Spring Developers](https://reader034.fdocuments.net/reader034/viewer/2022052618/554a0f72b4c905825d8b4921/html5/thumbnails/41.jpg)
41 41
Resources
§ Cloud Foundry Maven Plugin http://blog.springsource.com/2011/09/22/rapid-cloud-foundry-deployments-with-maven/
https://github.com/cloudfoundry/vcap-java-client/tree/master/cloudfoundry-maven-plugin (Sources + Reference Documentation)
§ Caldecott http://blog.cloudfoundry.com/post/12928974099/now-you-can-tunnel-into-any-cloud-foundry-data-service
§ Cloud Foundry Samples https://github.com/SpringSource/cloudfoundry-samples
![Page 42: Cloud Foundry for Spring Developers](https://reader034.fdocuments.net/reader034/viewer/2022052618/554a0f72b4c905825d8b4921/html5/thumbnails/42.jpg)
42 42
Resources
§ Spring Auto Reconfiguration http://blog.springsource.org/2011/11/04/using-cloud-foundry-services-with-spring-part-2-auto-reconfiguration/
§ Spring Insight for Cloud Foundry http://insight.cloudfoundry.com/
§ Cloud Foundry Namespace
http://blog.springsource.org/2011/11/09/using-cloud-foundry-services-with-spring-applications-part-3-the-cloud-namespace/
§ Spring Profiles http://blog.springsource.org/2011/11/10/using-cloud-foundry-services-with-spring-part-4-%E2%80%93-spring-profiles/
![Page 43: Cloud Foundry for Spring Developers](https://reader034.fdocuments.net/reader034/viewer/2022052618/554a0f72b4c905825d8b4921/html5/thumbnails/43.jpg)
43 43
Resources
§ Spring Integration http://www.springsource.org/spring-integration https://github.com/SpringSource/spring-integration
§ Samples
https://github.com/SpringSource/cloudfoundry-samples https://github.com/markfisher/springone-wgrus
![Page 44: Cloud Foundry for Spring Developers](https://reader034.fdocuments.net/reader034/viewer/2022052618/554a0f72b4c905825d8b4921/html5/thumbnails/44.jpg)
44 44
THANK YOU!
Email: [email protected] Twitter: https://twitter.com/ghillert Blog: http://blog.hillert.com
Sign up for a free account at: http://www.cloudfoundry.com/