This session provides an overview of how to build and deploy Spring-based applications to the Cloud Foundry platform.
The session will cover application configuration parameters, binding services to your application, deployment options using using STS, the vmc command tool, as well as the new Apache Maven plugin for Cloud Foundry. Gunnar will demonstrate how to deploy applications to both micro and public Cloud Foundry and will also show how debugging works with Cloud Foundry and how you can inspect services remotely using Caldecott.
Gunnar will also show various options to keep your War-files deployable to both Cloud Foundry and stand-alone Servlet Containers using auto-reconfiguration, the cloud namespace, and Spring 3.1 profiles.
Lastly, he will give a high-level overview how you can use Cloud Foundry together with Spring Integration in order to create scalable Spring applications.
5. Three Layers of Cloud Computing
§ SaaS
• Software as a Service
§ PaaS
• Platform as a Service
§ IaaS
• Infrastructure as a Service
5
6. Choice of clouds
.js
Data
Services
Private
Clouds
…
Msg
Services
Public
Clouds
.COM
Other Micro
Services
Clouds
6
7. Broad Support for Languages/Application Frameworks
§ JVM
• Spring, Grails, Roo, Lift, plain Java
§ Ruby
• Rails, Sinatra
§ Node.js
§ Community contributions
• Erlang, Python, PHP
7
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
8
9. Services
§ Relational database
• Postgres
• MySQL
§ Key-value store
• Redis
§ Document store
• MongoDB
§ Messaging
• RabbitMQ
9
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/
10
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
19
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
22
25. Agnostic War Files – Toolbox
§ Auto Reconfiguration
§ Cloud Namespace
§ Spring 3.1 Profiles
25
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
26
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
27
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
28
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
29