Cloud Foundry Open Tour Keynote

1,377 views

Published on

Published in: Technology, Business
0 Comments
1 Like
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
1,377
On SlideShare
0
From Embeds
0
Number of Embeds
3
Actions
Shares
0
Downloads
29
Comments
0
Likes
1
Embeds 0
No embeds

No notes for slide

Cloud Foundry Open Tour Keynote

  1. 1. Framework Integration inCloud FoundryRamnivas Laddad@ramnivas© 2012 VMware, Inc. All rights reserved
  2. 2. @ramnivas  Spring framework committer  Cloud Foundry committer  Main interests • Cloud computing • Aspect-oriented programming • Scala and functional programming  Author of books and articles • AspectJ in Action (1st and 2nd edition)  Speaker at many professional conferences • JavaOne, JavaPolis, SpringOne, Software Development, No Fluff Just Stuff, EclipseCon, O’Reilly OSCON etc.  Active involvement in AspectJ, Spring, and Cloud Foundry since their early form CONFIDENTIAL 2
  3. 3. Technologies “Я” Us Closure Java AMQP HTML5 Akka Mongo Spring ScalaRedis JSF Grails Hibernate node.jsRabbitMQ JDBC Lift Rails JMS Ruby Hadoop Sinatra Batch Job Django JTA Python MySQL Web Services JPA Caching LDAP Postgres Scripting Testing Security Neo4j REST CONFIDENTIAL 3
  4. 4. Technologies “Я” Us Access logs Network Routing Hardware failures DNS Storage Load balancing Auditing Rolling UpdatesUser management Security DoS Backups DBA OS Monitoring Patches CONFIDENTIAL 4
  5. 5. Facets of complexity: Product More functionality Time to market pressure Complex integration Higher stake in quality CONFIDENTIAL 5
  6. 6. Facets of complexity: Development Sound architecture: future proofing without overdoing Unit and integration tests Responding to changing business needs Confusing technology landscape CONFIDENTIAL 6
  7. 7. Facets of complexity: Deployment andoperation Choosing the right hardware, operating system, web server Monitoring applications Responding to scalability needs Dealing with hardware- and system-level failures Upgrading without substantial down time CONFIDENTIAL 7
  8. 8. Inherent vs. Apparent Complexity What can we do about this? Implementation overhead Apparent Implementation complexity Inherent Functional logic complexity CONFIDENTIAL 8
  9. 9. What can we do? ? CONFIDENTIAL 9
  10. 10. Three layers of Cloud Computing SaaS Software as a Service PaaS Platform as a Service IaaS Infrastructure as a Service CONFIDENTIAL 10
  11. 11. Cloud Foundry open PaaS - Choice of clouds Data Services Private Clouds Msg Public Services Clouds Other Micro Services Clouds CONFIDENTIAL 11
  12. 12. Cloud Foundry open PaaS - Choice of clouds Data Services Private Clouds Partners Msg Public Services Clouds Other Micro Services CloudsApache2 license CONFIDENTIAL 12
  13. 13. Frameworks in Cloud Foundry CONFIDENTIAL 13
  14. 14. The Cloud Foundry Universe Core Frameworks Community and Partner contributions CONFIDENTIAL 14
  15. 15. Core Runtimes and Frameworks Java • Spring • Grails • Lift Ruby • Rails • Sinatra • Rack Node.js (Community lead: Joyent) CONFIDENTIAL 15
  16. 16. Community and partners contributions Python • Django • WSGI Erlang OTP/Rebar PHP Perl .Net • On Iron Foundry CONFIDENTIAL 16
  17. 17. The Platinum Rule Treat each frameworkthe way it will like to be treated! CONFIDENTIAL 17
  18. 18. Common Framework Support CONFIDENTIAL 18
  19. 19. Command-line access Create apps and services Update bindings, memory etc. Scale instances $ vmc push conference $ vmc create-service mysql conf-db $ vmc bind-service conf-db conference $ vmc instances conference +2 CONFIDENTIAL 19
  20. 20. Access to services and app info Access to services and app info through environment variables • Service host, port, credentials • App ip and port VCAP_SERVICES: { "postgresql-9.0": [{ "name": "env-postgresql", "label": "postgresql-9.0", "plan": "free", "credentials": { "name": "de24667f9344b4eeaad6b5a2326d52faa", "host": "172.30.48.122", "port": 5432, "user": "u50ce600bba434bacbc99e034bb415644", "password": "pf4dca5bd449d4732841f0c4ae3f299d0" } }] CONFIDENTIAL } 20
  21. 21. Simplified app configration A runtime library to access service and app info Auto-reconfiguration for typical apps • Node.js coming soon CONFIDENTIAL 21
  22. 22. Access to service through Caldecott $ vmc tunnel conf-db Binding Service [conf-db]: OK Stopping Application caldecott: OK Staging Application caldecott: OK Starting Application caldecott: OK Getting tunnel connection info: OK Service connection info: username : uG5jVXaBPmjl6 password : pE3HOwIwGgkbv name : d76e62447a4c04f2b8e7b79f41c450aa0 Starting tunnel to conf-db on port 10000. 1: none 2: mysql 3: mysqldump Which client would you like to start?: 2 CONFIDENTIAL 22
  23. 23. Access to service through Caldecott Launching mysql --protocol=TCP --host=localhost --port=10000 --user=uG5jVXaBPmjl6 --password=pE3HOwIwGgkbv d76e62447a4c04f2b8e7b79f41c450aa0 ... mysql> select * from users; CONFIDENTIAL 23
  24. 24. Manifest Support --- applications: .: name: conference url: ${name}.${target-base} framework: name: rails3 info: mem: 256M description: Rails Application exec: mem: 256M instances: 1 services: conf-db: type: mysql CONFIDENTIAL 24
  25. 25. Spring CONFIDENTIAL 25
  26. 26. The Platinum Rule: Spring and Grails IDE integration • SpringSource Tools Suite and Eclipse • Open source Auto-reconfiguration by hooking into Spring application context <cloud:> namespace Spring 3.1 profile support Maven plugin CONFIDENTIAL 26
  27. 27. IDE Integration CONFIDENTIAL 27
  28. 28. Auto-Reconfiguration: Relational DB Detects beans of type javax.sql.DataSource Connects to MySQL or PostgreSQL services • Specifies driver, url, username, password, validation query Creates Commons DBCP or Tomcat DataSource<bean class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close" id="dataSource"> <property name="driverClassName" value="org.h2.Driver" /> <property name="url" value="jdbc:h2:mem:" /> <property name="username" value="sa" /> <property name="password" value="" /></bean> CONFIDENTIAL 28
  29. 29. <cloud:service-scan> Scans all services bound to the application and creates a bean of an appropriate type for each • Same bean types as auto-reconfiguration Useful during early development phases <beans …> <cloud:service-scan/> </beans> CONFIDENTIAL 29
  30. 30. <cloud:service-scan> Autowire Dependencies Created beans can be autowired as dependencies Use @Qualifier with service name if multiple services of same type bound to app@Autowired(required=false) private ConnectionFactory rabbitConnectionFactory;@Autowired private RedisConnectionFactory redisConnectionFactory;@Autowired @Qualifier("test_mysql_database")private DataSource mysqlDataSource;@Autowired(required=false) @Qualifier("test_postgres_database")private DataSource postgresDataSource; CONFIDENTIAL 30
  31. 31. <cloud:data-source> Configures a DataSource bean • Commons DBCP or Tomcat DataSource Basic attributes: • id: defaults to service name • service-name: only needed if you have multiple relational database services bound to the app <cloud:data-source id="dataSource"/> CONFIDENTIAL 31
  32. 32. Isolating Cloud Foundry Configuration<bean class="org.sf.orm.jpa.LocalContainerEntityManagerFactoryBean" id="entityManagerFactory"> <property name="dataSource" ref="dataSource"/></bean><beans profile="cloud"> <cloud:data-source id="dataSource" /></beans><beans profile="default"> <bean class=”o.a.commons.dbcp.BasicDataSource" id="dataSource"> <property name="url" value="jdbc:mysql://localhost/inventory" /> </bean></beans> CONFIDENTIAL 32
  33. 33. Scala/Lift  Auto-reconfiguration for Scala Lift apps  PostgreSQL support coming soon CONFIDENTIAL 33
  34. 34. RubyCONFIDENTIAL 34
  35. 35. The Platinum Rule: Rails, Sinatra, Rack Bundle support • Just include a Gemfile.lock Rails console • Debugging Auto-reconfiguration through meta-programming cf-runtime gem CONFIDENTIAL 35
  36. 36. Rails Console$ vmc rails-console confConnecting to conf console: OKirb():001:0> u = User.find_by_email(ramnivas@ramnivas.com)=> #<User id: 1, email: "ramnivas@ramnivas.com", reason: "It is cool!",created_at: "2012-03-29 23:10:34", updated_at: "2012-03-29 23:10:34">irb():002:0> u.email = "rladdad@vmware.com"=> "rladdad@vmware.com"irb():003:0> u.save=> trueirb():004:0> u = User.find_by_email(rladdad@vmware.com)=> #<User id: 1, email: "rladdad@vmware.com", reason: "It is cool!",created_at: "2012-03-29 23:10:34", updated_at: "2012-03-29 23:14:17"> CONFIDENTIAL 36
  37. 37. Ruby auto-reconfigurationrequire mongomodule Demo class App < Sinatra::Base configure do mongo = Mongo::Connection.new(:host => 127.0.0.1, :port => 27017) db = mongo[db] end ... endend CONFIDENTIAL 37
  38. 38. cf-runtime: Ruby Runtime Gemrequire cfruntime/mongodbconnection = CFRuntime::MongoClient.create_from_svc(docs)db = connection.db... CONFIDENTIAL 38
  39. 39. Running locally and in Cloud Foundryrequire cfruntime/mongodb...db = CFRuntime::MongoClient.create.db rescue Mongo::Connection.new("localhost", 27017) .db("db”)... CONFIDENTIAL 39
  40. 40. Taking full control if CFRuntime::CloudApp.running_in_cloud? @service_props = CFRuntime::CloudApp.service_props(docs’) else @service_props = {} @service_props[:host] = localhost @service_props[:port] = 27017 @service_props[:db] = testdb end db = Mongo::Connection.new(@service_props[:host], @service_props[:port]) .db(@service_props[:db]) if CFRuntime::CloudApp.running_in_cloud? db.authenticate(@service_props[:username], @service_props[:password]) end CONFIDENTIAL 40
  41. 41. Node.js CONFIDENTIAL 41
  42. 42. The Platinum Rule: Node.js NPM support • Coming soon! Debugging using node-inspector Auto-reconfiguration and runtime package • Coming soon! CONFIDENTIAL 42
  43. 43. Debugging node.js apps CONFIDENTIAL 43
  44. 44. Auto-reconfiguration in node.jsvar host = localhost, port = 3000, url = require(url);var client = require("redis").createClient();require(http).createServer(function (req, res) { ... CONFIDENTIAL 44
  45. 45. Accessing apps and services infovar cfruntime = require(cfruntime), host = cfruntime.CloudApp.host || localhost, port = cfruntime.CloudApp.port || 3000, url = require(url);if (cfruntime.CloudApp.runningInCloud) { var client = cfruntime.RedisClient.create();} else { var client = require("redis").createClient();}require(http).createServer(function (req, res) { ... CONFIDENTIAL 45
  46. 46. Peeking into future CONFIDENTIAL 46
  47. 47. Standalone apps Bring your own container • Jetty • Netty •… Non-web apps • Resque workers • Spring Batch • Spring Integration Still to come • Short-running apps • Scheduled tasks CONFIDENTIAL 47
  48. 48. Enhanced Scala Support Lift updated support Play! Akka CONFIDENTIAL 48
  49. 49. Improved Tools Revamped vmc • Embeddable core • Scripting friendly • Even more intuitive user interaction Eclipse plugin • Enhanced wizard with service requirement detection • Manifest support • Caldecott integration CONFIDENTIAL 49
  50. 50. Questions?Ramnivas Laddad@ramnivas© 2012 VMware, Inc. All rights reserved

×