Introduction to Cloud Foundryfor Spring & Java DevelopersEric BOTTARDDeveloper Advocate@ebottard / ebottard@vmware.com
The Open          Platform as a Service   Deploy and scale applications inseconds, without locking yourself into a        ...
Eric BOTTARD§ Developer Advocate at VMware§   @ebottard§   ebottard@vmware.com                              CONFIDENTIAL
Agenda§   What is Platform as a Service§   Introducing Cloud Foundry§   The benefits of being Open§   Avoiding Vendor ...
Platform as a Service
“I just want to deploy my code…”
What if… 	     target	  <any	  cloud> 	   	     push	  <my	  app> 	     bind	  <my	  services> 	     instances	  <my	  app...
What’s Happening with Applications Today?§ Frameworks are what really matter • Developer productivity and innovation • Re...
Do your current apps look like this?                         Tomcat                          .war Browser    Apache       ...
Chances are they will soon look like this..                                       Tomcat                                  ...
Cloud Stack - Classic Pyramid                   Software                  as a Service             Platform as a Service  ...
Cloud Stack - By Value                   Software                  as a Service             Platform as a Service         ...
Introducing...
Cloud Foundry – The Open Platform as a Service                      Target a choice of                      deployment clo...
Why Cloud Foundry?Developer Agility  • Friction-free way to develop, test and deploy applications  • Focus on writing appl...
CloudFoundry.COM – Multi-Tenant PaaS Operated byVMware                     CloudFoundry.COM (beta)    Frameworks    Servic...
Micro Cloud FoundryTM – Cloud on a Stick                         Micro Cloud Foundry    Frameworks    Services            ...
The Benefits of Being
CloudFoundry.ORG – Community Open Source Project               github.com/cloudfoundry§ .NET x 2                         ...
CloudFoundry.ORG – Community Open Source Project                      CloudFoundry.ORG           Community Frameworks Cont...
Cloud Foundry Open Source Workflow                               cloudfoundry.com                                         ...
Open Source Advantage: more features                    CONFIDENTIAL
Open Source Advantage: more features                    CONFIDENTIAL
Open Source Advantage: more innovation                   CONFIDENTIAL
Open Source Advantage: more innovation                   CONFIDENTIAL
Avoiding Vendor Lock-In
Multi-Cloud Flexibility is Critical§ Make use of both public and private clouds without rewriting your  applications§ Pr...
Main Risk: Lock In                        Welcome to the hotel california                        Such a lovely place      ...
Broad Industry Investment                     CONFIDENTIAL
Cloud Foundry - Making Multi-Cloud a Reality  Private Cloud   Management and     Public Cloud  Distributions     Deploymen...
Cloud Foundry: Clouds         § AppFog.com           • community lead for PHP           • PaaS for PHP         § Joyent ...
Demos
Under the Hood
Cloud Foundry Logical View     Developers                               Users              vmc                         Rou...
“   Environment Variables [...] unlike custom config    files, or other config mechanisms such as Java    System Propertie...
VCAP_*VCAP_APP_HOST = 192.168.1.13VCAP_APP_PORT = 58121VCAP_SERVICES ={  "redis-2.2": [     {       "name": "my-redis-serv...
So, you could...Use System.getEnv(“VCAP_SERVICES”)but it’s better to:<dependency>   <groupId>org.cloudfoundry</groupId>   ...
CloudEnvironment & Friends// Gives access to the VCAP_* variablesCloudEnvironment env = new CloudEnvironment();if (env.isC...
Spring Makes it Easy
Spring: your local config<bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close">    ...
Spring: Cloud Foundry config                               41
Spring: Cloud Foundry config<bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close"> ...
Auto-reconfiguration§ Works for Spring, Node, Ruby§ Spring: Uses a BeanFactoryPostProcessor   under the hood   • adds a ...
Introducing the <cloud:x> namespace§ For the remaining 20% of apps • if your app uses e.g. 2 DataSources • or if you want...
<cloud:service-scan />§ Scans all bound services and creates a bean for each§ Use @Qualifier to disambiguate:	   @Inject...
Explicit service listing<cloud:data-source id="beanId" service-name="mysql-db">	   <cloud:connection properties="..."/>	  ...
Using Profiles§ Spring 3.1 introduced the concept of profiles   • A set of beans that can be activated as required   • Us...
Using Profiles<beans xmlns="http://www.springframework.org/schema/beans"	   xmlns:xsi="http://www.w3.org/2001/XMLSchema-in...
Cloud Foundry BOSH
Production Grade Cloud Foundry Clusters§   500 – 5,000 VMs                                      cloudfoundry.com§   40+ ...
Cloud Foundry BOSH§ Cloud Foundry BOSH is an open source tool-chain for release  engineering, deployment, and lifecycle m...
BOSH: under the hood          BOSH User                      “BOSH is deployed by BOSH” bosh cli              director    ...
IaaS neutral by designvSphere: battle tested implementation,thousands of deployments                                      ...
BOSH Resources               @DrNic              http://drnicwilliams.com/2012/04/16/creating-a-bosh-from-scratch-on-aws/ ...
Key Takeaways§ PaaS is the application platform for the Cloud era§ Cloud Foundry is the Industry’s Open PaaS  • Develope...
Thank You!Eric BOTTARDDeveloper Advocate@ebottard / ebottard@vmware.com               CONFIDENTIAL
Credits§ With slides and ideas from • Josh Long (@starbuxman) • Patrick Chanezon (@chanezon)§ Images • http://www.sxc.hu...
Upcoming SlideShare
Loading in...5
×

Cf intro for spring devs

776

Published on

0 Comments
1 Like
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total Views
776
On Slideshare
0
From Embeds
0
Number of Embeds
1
Actions
Shares
0
Downloads
19
Comments
0
Likes
1
Embeds 0
No embeds

No notes for slide

Transcript of "Cf intro for spring devs"

  1. 1. Introduction to Cloud Foundryfor Spring & Java DevelopersEric BOTTARDDeveloper Advocate@ebottard / ebottard@vmware.com
  2. 2. The Open Platform as a Service Deploy and scale applications inseconds, without locking yourself into a single cloud CONFIDENTIAL
  3. 3. Eric BOTTARD§ Developer Advocate at VMware§ @ebottard§ ebottard@vmware.com CONFIDENTIAL
  4. 4. Agenda§ What is Platform as a Service§ Introducing Cloud Foundry§ The benefits of being Open§ Avoiding Vendor Lock-in§ Demos§ Under the Hood§ Spring makes it Easy§ Cloud Foundry BOSH CONFIDENTIAL
  5. 5. Platform as a Service
  6. 6. “I just want to deploy my code…”
  7. 7. What if…   target  <any  cloud>     push  <my  app>   bind  <my  services>   instances  <my  app>  +100  
  8. 8. What’s Happening with Applications Today?§ Frameworks are what really matter • Developer productivity and innovation • Reduce time to market§ New application types • Mobile, Social, SaaS • Apps released early and often§ Data intensive • Emerging requirements: elasticity, multi-cloud • Web orientation drives exponential data volumes§ Deployed on virtual and cloud infrastructures • Virtualization, Cloud, PaaS CONFIDENTIAL
  9. 9. Do your current apps look like this? Tomcat .war Browser Apache MySQL 9
  10. 10. Chances are they will soon look like this.. Tomcat search. war Desktop Browser Tomcat Native users. Node.js Message Bus war Mongo Mobile Front End e.g. RabbitMQ App HTML5 Mobile App Tomcat orders. war MySQL 10
  11. 11. Cloud Stack - Classic Pyramid Software as a Service Platform as a Service Infrastructure as a Service
  12. 12. Cloud Stack - By Value Software as a Service Platform as a Service Infrastructure as a Service
  13. 13. Introducing...
  14. 14. Cloud Foundry – The Open Platform as a Service Target a choice of deployment cloudsProvide a choice of Bind a choice of development application frameworks services github.com/cloudfoundry CONFIDENTIAL
  15. 15. Why Cloud Foundry?Developer Agility • Friction-free way to develop, test and deploy applications • Focus on writing applications, not meddling with middleware and infrastructurePortability without changes • Write once, test-scale-deploy to private/public clouds without code changes • Quickly build and test on a laptop and scale to the cloudOpen - The freedom to choose • Choice of clouds for deployment, industry frameworks, and application services • Extensible architecture to “future proof” for rapid cloud innovation • Community open-source project - access, evaluate and contribute CONFIDENTIAL
  16. 16. CloudFoundry.COM – Multi-Tenant PaaS Operated byVMware CloudFoundry.COM (beta) Frameworks Services vCenter / vSphere Infrastructure
  17. 17. Micro Cloud FoundryTM – Cloud on a Stick Micro Cloud Foundry Frameworks Services Your Laptop/PC Single VM instance of Cloud Foundry that runs on a developer’s MAC or PC CONFIDENTIAL
  18. 18. The Benefits of Being
  19. 19. CloudFoundry.ORG – Community Open Source Project github.com/cloudfoundry§ .NET x 2 § Memcached§ PHP § SQL Server§ JRuby § Neo4j§ Python § CouchDB§ Rails 2.x § VirtualBox§ Clojure § Mono§ Erlang § Rack§ Haskell CONFIDENTIAL
  20. 20. CloudFoundry.ORG – Community Open Source Project CloudFoundry.ORG Community Frameworks Contributions Community Services Contributions Your Infrastructure Download Setup Tool Chain & Deploy Behind Code Environment Scripts Firewall Cloud Foundry BOSH Apache2 license CONFIDENTIAL
  21. 21. Cloud Foundry Open Source Workflow cloudfoundry.com production updated ~2x/week github github.com/cloudfoundry on +2 and ✓ change pushed to github Reviewers +1/-1 Gerrit Code Review +2/-2 Committers reviews.cloudfoundry.org test verification score ✓ ✗ git push triggers test execution Jenkins CI ci.cloudfoundry.org21 CONFIDENTIAL
  22. 22. Open Source Advantage: more features CONFIDENTIAL
  23. 23. Open Source Advantage: more features CONFIDENTIAL
  24. 24. Open Source Advantage: more innovation CONFIDENTIAL
  25. 25. Open Source Advantage: more innovation CONFIDENTIAL
  26. 26. Avoiding Vendor Lock-In
  27. 27. Multi-Cloud Flexibility is Critical§ Make use of both public and private clouds without rewriting your applications§ Protect against vendor lock-in§ Meet different compliance and geographical needs§ Manage your growth, accommodate peak loads & optimize costs Public Private Micro Clouds Clouds Clouds CONFIDENTIAL
  28. 28. Main Risk: Lock In Welcome to the hotel california Such a lovely place Such a lovely face Plenty of room at the hotel california Any time of year, you can find it here Last thing I remember, I was Running for the door I had to find the passage back To the place I was before ’relax,’ said the night man, We are programmed to receive. You can checkout any time you like, But you can never leave! -the Eagles CONFIDENTIAL
  29. 29. Broad Industry Investment CONFIDENTIAL
  30. 30. Cloud Foundry - Making Multi-Cloud a Reality Private Cloud Management and Public Cloud Distributions Deployment Operators .COM Bare metal CONFIDENTIAL
  31. 31. Cloud Foundry: Clouds § AppFog.com • community lead for PHP • PaaS for PHP § Joyent • community lead for Node.js § ActiveState • community lead for Python, Perl • Providers of Stackato private PaaS CONFIDENTIAL
  32. 32. Demos
  33. 33. Under the Hood
  34. 34. Cloud Foundry Logical View Developers Users vmc Routers CloudControllers App App HealthManager Execution Agents Services (DEA) Pool Messaging CONFIDENTIAL
  35. 35. “ Environment Variables [...] unlike custom config files, or other config mechanisms such as Java System Properties, are a language- and OS- agnostic standard The Twelve Factor App, http://www.12factor.net 35
  36. 36. VCAP_*VCAP_APP_HOST = 192.168.1.13VCAP_APP_PORT = 58121VCAP_SERVICES ={ "redis-2.2": [ { "name": "my-redis-service", "label": "redis-2.2", "plan": "free", "tags": [ "key-value", "nosql", "redis-2.2", "redis" ], "credentials": { "hostname": "127.0.0.1", "host": "127.0.0.1", "port": 5000, "password": "ce7b483f-66d1-436d-8aa7-7c33a9ee31ac", "name": "e740add8-24ce-40f5-94ed-8a2623e0be57" } } ], "postgresql-9.0": [...]} 36
  37. 37. So, you could...Use System.getEnv(“VCAP_SERVICES”)but it’s better to:<dependency> <groupId>org.cloudfoundry</groupId> <artifactId>cloudfoundry-runtime</artifactId> <version>0.8.2</version></dependency> 37
  38. 38. CloudEnvironment & Friends// Gives access to the VCAP_* variablesCloudEnvironment env = new CloudEnvironment();if (env.isCloudFoundry()) { // Parses and retrieves info about the service named "mydb" RdbmsServiceInfo info = env.getServiceInfo("mydb", RdbmsServiceInfo.class); // From there, you can either... info.getHost(); info.getPort(); // ...or create a DataSource with the given info RdbmsServiceCreator creator = new RdbmsServiceCreator(); DataSource ds = creator.createService(info);} 38
  39. 39. Spring Makes it Easy
  40. 40. Spring: your local config<bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close"> <property name="driverClassName" value="com.mysql.jdbc.Driver" /> <property name="url" value="jdbc:mysql://localhost:3306/mydb" /> <property name="username" value="myuser" /> <property name="password" value="s3cr3t" /></bean><bean id="entityManagerFactory" class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean"> <property name="dataSource" ref="dataSource" /> <property name="persistenceUnitName" value="myPersistenceUnit" /> <property name="jpaVendorAdapter"> <bean class="org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter"> <property name="databasePlatform" value="org.hibernate.dialect.MySQLDialect" /> </bean> </property></bean> 40
  41. 41. Spring: Cloud Foundry config 41
  42. 42. Spring: Cloud Foundry config<bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close"> <property name="driverClassName" value="com.mysql.jdbc.Driver" /> <property name="url" value="jdbc:mysql://localhost:3306/mydb" /> <property name="username" value="myuser" /> <property name="password" value="s3cr3t" /></bean><bean id="entityManagerFactory" class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean"> <property name="dataSource" ref="dataSource" /> <property name="persistenceUnitName" value="myPersistenceUnit" /> <property name="jpaVendorAdapter"> <bean class="org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter"> <property name="databasePlatform" value="org.hibernate.dialect.MySQLDialect" /> </bean> </property></bean> 41
  43. 43. Auto-reconfiguration§ Works for Spring, Node, Ruby§ Spring: Uses a BeanFactoryPostProcessor under the hood • adds a jar to your app • modifies web.xml to load the BFPP • also adds correct jdbc driver jar§ Only works if no ambiguity (80% of apps) • One service of a kind CONFIDENTIAL
  44. 44. Introducing the <cloud:x> namespace§ For the remaining 20% of apps • if your app uses e.g. 2 DataSources • or if you want more control<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:cloud="http://schema.cloudfoundry.org/spring" xsi:schemaLocation="http://www.springframework.org/schema/beanshttp://www.springframework.org/schema/beans/spring-beans.xsdhttp://schema.cloudfoundry.org/springhttp://schema.cloudfoundry.org/spring/cloudfoundry-spring-0.8.xsd"> CONFIDENTIAL
  45. 45. <cloud:service-scan />§ Scans all bound services and creates a bean for each§ Use @Qualifier to disambiguate: @Inject @Qualifier("mysql-source") private DataSource sourceDS; @Inject @Qualifier("mysql-destination") private DataSource destDS; CONFIDENTIAL
  46. 46. Explicit service listing<cloud:data-source id="beanId" service-name="mysql-db"> <cloud:connection properties="..."/> <cloud:pool pool-size="..." max-wait-time="..."/></cloud:data-source><cloud:mongo-db-factory id="..." service-name="..." write-concern="NONE"> <cloud:mongo-options connections-per-host="..." max-wait-time="..."/></cloud:mongo-db-factory><cloud:rabbit-connection-factory id="..." service-name="..."> <cloud:rabbit-options channel-cache-size="..."/></cloud:rabbit-connection-factory><cloud:redis-connection-factory id="..." service-name="..."> <cloud:pool pool-size="..." max-wait-time="..."/></cloud:redis-connection-factory> CONFIDENTIAL
  47. 47. Using Profiles§ Spring 3.1 introduced the concept of profiles • A set of beans that can be activated as required • Usually controlled by spring.profiles.active system property • Cloud Foundry activates “cloud” profile for you<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd"> <beans profile="profileA"> <bean id="someId" /> <bean id="onlyInProfileA"/> </beans> <beans profile="profileB"> <bean id="someId" /> </beans> <bean id="always-present" /></beans> CONFIDENTIAL
  48. 48. Using Profiles<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:cloud="http://schema.cloudfoundry.org/spring" xsi:schemaLocation="http://www.springframework.org/schema/beanshttp://www.springframework.org/schema/beans/spring-beans.xsdhttp://schema.cloudfoundry.org/springhttp://schema.cloudfoundry.org/spring/cloudfoundry-spring-0.8.xsd"> <beans profile="default"> <bean id="dataSource" class="BasicDataSource"> ... </bean> </beans> <beans profile="cloud"> <cloud:data-source id="dataSource" service-name="mysql-db"/> </beans> </beans> CONFIDENTIAL
  49. 49. Cloud Foundry BOSH
  50. 50. Production Grade Cloud Foundry Clusters§ 500 – 5,000 VMs cloudfoundry.com§ 40+ unique node types§ 75+ unique software packages§ 75+ unique environments§ 2x/week cf.com updates§ 24x7x365 non-stop operation§ No-downtime deployments§ Reliable, robust, repeatable deployments, updates, capacity adjustments§ Small teams manage many production, staging, stress, qa, dev instancesGoogle style problem è Google style solution CONFIDENTIAL
  51. 51. Cloud Foundry BOSH§ Cloud Foundry BOSH is an open source tool-chain for release engineering, deployment, and lifecycle management of large scale distributed services • Prescriptive way of creating releases and managing systems and services • It is not a collection of shell scripts, not a pile of Perl§ Built to deploy and manage production-class, large scale clusters • Production grade Cloud Foundry clusters: 500+ VMs, 40+ jobs, 75+ packages • Multi-node, multi-tier, complex clusters: e.g., our Gerrit/Jenkins Cluster§ Built for devops usage and scale by a crack team of veterans • A project, not a product: command line interface, YAML, etc. • Continuous improvement, iterative development, rough edgesgithub.com/cloudfoundry/bosh CONFIDENTIAL
  52. 52. BOSH: under the hood BOSH User “BOSH is deployed by BOSH” bosh cli director healthmon cloudfoundry.com db redis nats workers blobs active jobs agent IaaS CPI stemcell disk51 CONFIDENTIAL
  53. 53. IaaS neutral by designvSphere: battle tested implementation,thousands of deployments CPI: code completevCloud Director: “work in progress”, 2H 2012 functional status: “work in progress” Cloud Foundry BOSH Cloud Provider Interface (CPI) github.com/piston/openstack-bosh- cpi contribute: github.com/cloudfoundry/bosh52 CONFIDENTIAL
  54. 54. BOSH Resources @DrNic http://drnicwilliams.com/2012/04/16/creating-a-bosh-from-scratch-on-aws/ @BrianMMcClain http://www.brianmmcclain.com/2012/05/08/using-bosh-with-vsphere-part-2/ @VadimSpivak http://www.youtube.com/watch?v=pASQT5mGc_ghttps://github.com/cloudfoundry/boshhttps://groups.google.com/a/cloudfoundry.org/group/bosh-users/topicshttps://github.com/piston/openstack-bosh-cpi CONFIDENTIAL
  55. 55. Key Takeaways§ PaaS is the application platform for the Cloud era§ Cloud Foundry is the Industry’s Open PaaS • Developer agility • Portability without changes • Open system§ What’s next? • Free Signup: www.cloudfoundry.com (use “cloudtoday” as a promocode) • Get started: docs.cloudfoundry.com/getting-started.html • Learn more on the blog: blog.cloudfoundry.com • Download your Micro Cloud Foundry: my.cloudfoundry.com/micro • Get the source code: www.cloudfoundry.org • Follow us: @cloudfoundry • Watch us: www.youtube.com/cloudfoundry CONFIDENTIAL
  56. 56. Thank You!Eric BOTTARDDeveloper Advocate@ebottard / ebottard@vmware.com CONFIDENTIAL
  57. 57. Credits§ With slides and ideas from • Josh Long (@starbuxman) • Patrick Chanezon (@chanezon)§ Images • http://www.sxc.hu/photo/651837 • http://www.sxc.hu/photo/525580 • http://www.sxc.hu/photo/1234314 • http://www.sxc.hu/photo/1080691 • http://www.sxc.hu/photo/1409317 • http://www.sxc.hu/photo/830331 CONFIDENTIAL
  1. A particular slide catching your eye?

    Clipping is a handy way to collect important slides you want to go back to later.

×