cloud foundry bootcamp at contributingcode
DESCRIPTION
A brief introduction to Cloud Foundry, a modern, open-source PaaS.TRANSCRIPT
![Page 1: Cloud Foundry bootcamp at ContributingCode](https://reader033.vdocument.in/reader033/viewer/2022060107/554a0e76b4c9058c5d8b484a/html5/thumbnails/1.jpg)
© 2009 VMware Inc. All rights reserved
Cloud Foundry Boot Camp Chris Richardson - Senior Developer Advocate - @crichardson
![Page 2: Cloud Foundry bootcamp at ContributingCode](https://reader033.vdocument.in/reader033/viewer/2022060107/554a0e76b4c9058c5d8b484a/html5/thumbnails/2.jpg)
Agenda
Why PaaS matters to developers
Overview of Cloud Foundry
Getting started with Cloud Foundry
Consuming Cloud Foundry services
2
![Page 3: Cloud Foundry bootcamp at ContributingCode](https://reader033.vdocument.in/reader033/viewer/2022060107/554a0e76b4c9058c5d8b484a/html5/thumbnails/3.jpg)
Let’s imagine that you want to deploy an app...
Do you know how much hardware to buy?
Can you afford it?
How long does it take to approve, buy and install?
Who is going to set it up?
What happens if the traffic increases 10x?
Can we afford a test lab?
3
![Page 4: Cloud Foundry bootcamp at ContributingCode](https://reader033.vdocument.in/reader033/viewer/2022060107/554a0e76b4c9058c5d8b484a/html5/thumbnails/4.jpg)
Cloud computing empowers us to deal with these challenges...
4
![Page 5: Cloud Foundry bootcamp at ContributingCode](https://reader033.vdocument.in/reader033/viewer/2022060107/554a0e76b4c9058c5d8b484a/html5/thumbnails/5.jpg)
Cloud computing defined
IT delivered as a service
Over the internet
Self-service
Pay per use5
![Page 6: Cloud Foundry bootcamp at ContributingCode](https://reader033.vdocument.in/reader033/viewer/2022060107/554a0e76b4c9058c5d8b484a/html5/thumbnails/6.jpg)
SaaS
PaaS
IaaS
The three layers of cloud computing
6
![Page 7: Cloud Foundry bootcamp at ContributingCode](https://reader033.vdocument.in/reader033/viewer/2022060107/554a0e76b4c9058c5d8b484a/html5/thumbnails/7.jpg)
Benefits of IaaS
AgilityPay per useElasticity
But you need to configure and maintain the operating systems, the app servers and the databases etc.
7
![Page 8: Cloud Foundry bootcamp at ContributingCode](https://reader033.vdocument.in/reader033/viewer/2022060107/554a0e76b4c9058c5d8b484a/html5/thumbnails/8.jpg)
SaaS
PaaS
IaaS
Need to move up the stack
8
![Page 9: Cloud Foundry bootcamp at ContributingCode](https://reader033.vdocument.in/reader033/viewer/2022060107/554a0e76b4c9058c5d8b484a/html5/thumbnails/9.jpg)
PaaS =
Application deployment and management
Service provisioning
+
9
![Page 10: Cloud Foundry bootcamp at ContributingCode](https://reader033.vdocument.in/reader033/viewer/2022060107/554a0e76b4c9058c5d8b484a/html5/thumbnails/10.jpg)
Agenda
Why PaaS matters to developers
Overview of Cloud Foundry
Getting started with Cloud Foundry
Consuming Cloud Foundry services
10
![Page 11: Cloud Foundry bootcamp at ContributingCode](https://reader033.vdocument.in/reader033/viewer/2022060107/554a0e76b4c9058c5d8b484a/html5/thumbnails/11.jpg)
11
Deploy and scale applications in seconds, without locking yourself
Simple, Open,
Flexible, Scalable
The Open Platform as a Service
![Page 12: Cloud Foundry bootcamp at ContributingCode](https://reader033.vdocument.in/reader033/viewer/2022060107/554a0e76b4c9058c5d8b484a/html5/thumbnails/12.jpg)
Cloud Foundry open PaaS - Choice of frameworks
OSS community
![Page 13: Cloud Foundry bootcamp at ContributingCode](https://reader033.vdocument.in/reader033/viewer/2022060107/554a0e76b4c9058c5d8b484a/html5/thumbnails/13.jpg)
Applica'on Service Interface
Data Services
Other Services
Msg Services
Cloud Foundry open PaaS - Choice of application services
vFabric Postgres
vFabric RabbitMQTM
Additional partners services …
![Page 14: Cloud Foundry bootcamp at ContributingCode](https://reader033.vdocument.in/reader033/viewer/2022060107/554a0e76b4c9058c5d8b484a/html5/thumbnails/14.jpg)
Applica'on Service Interface
Data Services
Other Services
Msg Services
Cloud Foundry open PaaS - Choice of clouds
Private Clouds
PublicClouds
MicroClouds
Cloud Provider Interface
Avoid
Lock-in
![Page 15: Cloud Foundry bootcamp at ContributingCode](https://reader033.vdocument.in/reader033/viewer/2022060107/554a0e76b4c9058c5d8b484a/html5/thumbnails/15.jpg)
15
CloudFoundry.COM - Multi-tenant PaaS operated by VMware
Runtimes & Frameworks
Services
vCenter / vSphere
CloudFoundry.COM (beta)
Infrastructure
![Page 16: Cloud Foundry bootcamp at ContributingCode](https://reader033.vdocument.in/reader033/viewer/2022060107/554a0e76b4c9058c5d8b484a/html5/thumbnails/16.jpg)
16
Micro Cloud FoundryTM – Industry first downloadable PaaS
Runtimes & Frameworks
Services
Your Laptop/PC
Micro Cloud Foundry
Single VM instance of Cloud Foundry that runs on a developer’s MAC or PC
![Page 17: Cloud Foundry bootcamp at ContributingCode](https://reader033.vdocument.in/reader033/viewer/2022060107/554a0e76b4c9058c5d8b484a/html5/thumbnails/17.jpg)
17
CloudFoundry.ORG - Community open-source project
CloudFoundry.ORG
DownloadCode
Setup Environment
Deploy Behind FirewallBOSH
Apache2 license
Your Infrastructure
![Page 18: Cloud Foundry bootcamp at ContributingCode](https://reader033.vdocument.in/reader033/viewer/2022060107/554a0e76b4c9058c5d8b484a/html5/thumbnails/18.jpg)
Cloud Foundry: you can trade-off effort vs flexibility
18
Public PaaS
Private PaaS
Custom Private PaaS
Less
More
Less
More
.COM....
....
git clone git://github.com/cloudfoundry/
Effort Flexibility
![Page 19: Cloud Foundry bootcamp at ContributingCode](https://reader033.vdocument.in/reader033/viewer/2022060107/554a0e76b4c9058c5d8b484a/html5/thumbnails/19.jpg)
Cloud Foundry Resources
19
Primary Site : cloudfoundry.com
Open Source Site : cloudfoundry.org
Twitter : @cloudfoundry , hash tag #cfoundry
Blog : blog.cloudfoundry.com
FB : facebook.com/cloudfoundry
Support : support.cloudfoundry.com
• Documentation
• Knowledge Base
• Q & A / Forums
![Page 20: Cloud Foundry bootcamp at ContributingCode](https://reader033.vdocument.in/reader033/viewer/2022060107/554a0e76b4c9058c5d8b484a/html5/thumbnails/20.jpg)
Agenda
Why PaaS matters to developers
Overview of Cloud Foundry
Getting started with Cloud Foundry
Consuming Cloud Foundry services
20
![Page 21: Cloud Foundry bootcamp at ContributingCode](https://reader033.vdocument.in/reader033/viewer/2022060107/554a0e76b4c9058c5d8b484a/html5/thumbnails/21.jpg)
Register
21
http://cloudfoundry.com/signup
Use promo code
![Page 22: Cloud Foundry bootcamp at ContributingCode](https://reader033.vdocument.in/reader033/viewer/2022060107/554a0e76b4c9058c5d8b484a/html5/thumbnails/22.jpg)
Welcome email
22
![Page 23: Cloud Foundry bootcamp at ContributingCode](https://reader033.vdocument.in/reader033/viewer/2022060107/554a0e76b4c9058c5d8b484a/html5/thumbnails/23.jpg)
Ways to use Cloud Foundry
23
![Page 24: Cloud Foundry bootcamp at ContributingCode](https://reader033.vdocument.in/reader033/viewer/2022060107/554a0e76b4c9058c5d8b484a/html5/thumbnails/24.jpg)
Installing vmc on Windows
24
Install the vmc gem
![Page 25: Cloud Foundry bootcamp at ContributingCode](https://reader033.vdocument.in/reader033/viewer/2022060107/554a0e76b4c9058c5d8b484a/html5/thumbnails/25.jpg)
Installing vmc on Mac OSX
25
$ bash -s stable \ <<(curl -s https://raw.github.com/wayneeseguin/rvm/master/binscripts/rvm-installer)
Use Ruby Version Manager http://beginrescueend.com/
$ gem install vmc
$ rvm install 1.9.2$ rvm use 1.9.2
![Page 26: Cloud Foundry bootcamp at ContributingCode](https://reader033.vdocument.in/reader033/viewer/2022060107/554a0e76b4c9058c5d8b484a/html5/thumbnails/26.jpg)
Example vmc commands
26
$ vmc target <any cloud>
$ vmc login <credentials> $ vmc push <my-app>
! > bind services? Yes
$ vmc update <my-app>
$ vmc instances <my-app> +100
![Page 27: Cloud Foundry bootcamp at ContributingCode](https://reader033.vdocument.in/reader033/viewer/2022060107/554a0e76b4c9058c5d8b484a/html5/thumbnails/27.jpg)
Logging into CloudFoundry.com
27
$ vmc target api.cloudfoundry.comSuccessfully targeted to [http://api.cloudfoundry.com]
$ vmc loginAttempting login to [http://api.cloudfoundry.com]Email: [email protected]: ********Successfully logged into [http://api.cloudfoundry.com]
![Page 28: Cloud Foundry bootcamp at ContributingCode](https://reader033.vdocument.in/reader033/viewer/2022060107/554a0e76b4c9058c5d8b484a/html5/thumbnails/28.jpg)
VMC CLI DEMO
28
![Page 29: Cloud Foundry bootcamp at ContributingCode](https://reader033.vdocument.in/reader033/viewer/2022060107/554a0e76b4c9058c5d8b484a/html5/thumbnails/29.jpg)
![Page 30: Cloud Foundry bootcamp at ContributingCode](https://reader033.vdocument.in/reader033/viewer/2022060107/554a0e76b4c9058c5d8b484a/html5/thumbnails/30.jpg)
vmc push optionally creates manifest.yml
30
applications: target/: name: example1 url: cer-example1.cloudfoundry.com
framework: name: java_web info: mem: 512M description: Java Web Application
exec: mem: 256M instances: 1
Captures the information that vmc push gatheredvmc doesn’t have to ask you again
![Page 31: Cloud Foundry bootcamp at ContributingCode](https://reader033.vdocument.in/reader033/viewer/2022060107/554a0e76b4c9058c5d8b484a/html5/thumbnails/31.jpg)
Scale the application
$ vmc instances cf1 +2Scaling Application instances up to 3: OK
$ vmc stats cf1
+----------+-------------+----------------+--------------+--------------+| Instance | CPU (Cores) | Memory (limit) | Disk (limit) | Uptime |
+----------+-------------+----------------+--------------+--------------+| 0 | 1.2% (4) | 90.6M (512M) | 8.5M (2G) | 0d:0h:3m:3s || 1 | 9.5% (4) | 60.9M (512M) | 8.4M (2G) | 0d:0h:0m:17s |
| 2 | 9.4% (4) | 55.5M (512M) | 8.4M (2G) | 0d:0h:0m:17s |+----------+-------------+----------------+--------------+--------------+
![Page 32: Cloud Foundry bootcamp at ContributingCode](https://reader033.vdocument.in/reader033/viewer/2022060107/554a0e76b4c9058c5d8b484a/html5/thumbnails/32.jpg)
http://www.springsource.com/downloads/sts
![Page 33: Cloud Foundry bootcamp at ContributingCode](https://reader033.vdocument.in/reader033/viewer/2022060107/554a0e76b4c9058c5d8b484a/html5/thumbnails/33.jpg)
Install the Cloud Foundry plugin....
33
![Page 34: Cloud Foundry bootcamp at ContributingCode](https://reader033.vdocument.in/reader033/viewer/2022060107/554a0e76b4c9058c5d8b484a/html5/thumbnails/34.jpg)
...
34
![Page 35: Cloud Foundry bootcamp at ContributingCode](https://reader033.vdocument.in/reader033/viewer/2022060107/554a0e76b4c9058c5d8b484a/html5/thumbnails/35.jpg)
...
35
![Page 36: Cloud Foundry bootcamp at ContributingCode](https://reader033.vdocument.in/reader033/viewer/2022060107/554a0e76b4c9058c5d8b484a/html5/thumbnails/36.jpg)
STS DEMO
36
![Page 37: Cloud Foundry bootcamp at ContributingCode](https://reader033.vdocument.in/reader033/viewer/2022060107/554a0e76b4c9058c5d8b484a/html5/thumbnails/37.jpg)
![Page 38: Cloud Foundry bootcamp at ContributingCode](https://reader033.vdocument.in/reader033/viewer/2022060107/554a0e76b4c9058c5d8b484a/html5/thumbnails/38.jpg)
Recap so far…
38
Understand APaaS
Register for Cloud Foundry
Installed the Cloud Foundry Plugin
Logged In/Authenticated
Create a Spring MVC App
Deployed MVC App to Cloud Foundry
Hit URL from STS and Viewed MVC App
Learned about vmc
![Page 39: Cloud Foundry bootcamp at ContributingCode](https://reader033.vdocument.in/reader033/viewer/2022060107/554a0e76b4c9058c5d8b484a/html5/thumbnails/39.jpg)
Agenda
Why PaaS matters to developers
Overview of Cloud Foundry
Getting started with Cloud Foundry
Consuming Cloud Foundry services
39
![Page 40: Cloud Foundry bootcamp at ContributingCode](https://reader033.vdocument.in/reader033/viewer/2022060107/554a0e76b4c9058c5d8b484a/html5/thumbnails/40.jpg)
Current Services Available on Cloud Foundry
40
![Page 41: Cloud Foundry bootcamp at ContributingCode](https://reader033.vdocument.in/reader033/viewer/2022060107/554a0e76b4c9058c5d8b484a/html5/thumbnails/41.jpg)
Creating a service instance$ vmc create-service mysql --name mysql1
Creating Service: OK
$ vmc services
============== System Services ==============+------------+---------+---------------------------------------+| Service | Version | Description |+------------+---------+---------------------------------------+| mongodb | 1.8 | MongoDB NoSQL store || mysql | 5.1 | MySQL database service || postgresql | 9.0 | PostgreSQL database service (vFabric) || rabbitmq | 2.4 | RabbitMQ messaging service || redis | 2.2 | Redis key-value store service |+------------+---------+---------------------------------------+
=========== Provisioned Services ============
+-------------+---------+| Name | Service |+-------------+---------+| mysql1 | mysql |+-------------+---------+
![Page 42: Cloud Foundry bootcamp at ContributingCode](https://reader033.vdocument.in/reader033/viewer/2022060107/554a0e76b4c9058c5d8b484a/html5/thumbnails/42.jpg)
$ vmc push cer-spring --path web/target/Application Deployed URL [cer-spring.cloudfoundry.com]: Detected a Java SpringSource Spring Application, is this correct? [Yn]:
Memory Reservation (64M, 128M, 256M, 512M, 1G) [512M]:
Creating Application: OKWould you like to bind any services to 'cer-spring'? [yN]: y
Would you like to use an existing provisioned service? [yN]: yThe following provisioned services are available
1: mysql1
2: mysql-135e0Please select one you wish to use: 1
Binding Service [mysql1]: OKUploading Application:
Checking for available resources: OK
Processing resources: OK Packing application: OK
Uploading (12K): OK
Binding a service to an application
Would you like to bind any services to 'cer-spring'? [yN]: yWould you like to use an existing provisioned service? [yN]: yThe following provisioned services are available1: mysql12: mysql-135e0Please select one you wish to use: 1Binding Service [mysql1]: OK
![Page 43: Cloud Foundry bootcamp at ContributingCode](https://reader033.vdocument.in/reader033/viewer/2022060107/554a0e76b4c9058c5d8b484a/html5/thumbnails/43.jpg)
Binding a service to an application
$ vmc bind-service mysql1 myappBinding Service [mysql1]: OKStopping Application 'myapp': OKStaging Application 'myapp': OK Starting Application 'myapp': OK$
![Page 44: Cloud Foundry bootcamp at ContributingCode](https://reader033.vdocument.in/reader033/viewer/2022060107/554a0e76b4c9058c5d8b484a/html5/thumbnails/44.jpg)
Binding in STS
44
![Page 45: Cloud Foundry bootcamp at ContributingCode](https://reader033.vdocument.in/reader033/viewer/2022060107/554a0e76b4c9058c5d8b484a/html5/thumbnails/45.jpg)
Survey application demo
45
![Page 46: Cloud Foundry bootcamp at ContributingCode](https://reader033.vdocument.in/reader033/viewer/2022060107/554a0e76b4c9058c5d8b484a/html5/thumbnails/46.jpg)
Uses MySQL and MongoDB
46
@Entitypublic class Customer {
@Id @GeneratedValue(strategy = GenerationType.IDENTITY) private Long id;
private String firstName;
private String lastName;
@RelatedDocument private SurveyInfo surveyInfo;
public class Survey {
String question;
String answer;
public class SurveyInfo {
private List<Survey> questionsAndAnswers = new ArrayList<Survey>();
public List<Survey> getQuestionsAndAnswers() { return questionsAndAnswers; }
Stored in MySQL
Stored in Mongo
![Page 47: Cloud Foundry bootcamp at ContributingCode](https://reader033.vdocument.in/reader033/viewer/2022060107/554a0e76b4c9058c5d8b484a/html5/thumbnails/47.jpg)
![Page 48: Cloud Foundry bootcamp at ContributingCode](https://reader033.vdocument.in/reader033/viewer/2022060107/554a0e76b4c9058c5d8b484a/html5/thumbnails/48.jpg)
Bindings exposed through VCAP_SERVICES environment variable
48
{ "mysql-5.1": [{
"name": "mysql1", "label": "mysql-5.1",
"plan": "free", "tags": ["mysql", "mysql-5.1", "relational"],
"credentials": {
"name": "da81b57c25cca4c65929a223f0ed068a0",
"host": "172.99.99.99",
"port": 3306,
"username": "secretusername",
"password": "secretuserpassword"
....
}
}] }
![Page 49: Cloud Foundry bootcamp at ContributingCode](https://reader033.vdocument.in/reader033/viewer/2022060107/554a0e76b4c9058c5d8b484a/html5/thumbnails/49.jpg)
Accessing bound services - low-level
49
var services = JSON.parse(process.env.VCAP_SERVICES);var creds = services['mysql-5.1'][0].credentials
configure do services = JSON.parse(ENV['VCAP_SERVICES']) mysql_key = services.keys.select { |svc| svc =~ /mysql/i }.first mysql = services[mysql_key].first['credentials'] mysql_conf = {:host => mysql['hostname'], :port => mysql['port'], :username => mysql['user'], :password => mysql['password']} @@client = Mysql2::Client.new mysql_confend
![Page 50: Cloud Foundry bootcamp at ContributingCode](https://reader033.vdocument.in/reader033/viewer/2022060107/554a0e76b4c9058c5d8b484a/html5/thumbnails/50.jpg)
Accessing bound services - high-level, Spring/Java
50
<bean id="dataSource" class="…"> … DataSource for MySQL instance … </bean>
reconfigured automatically
CloudEnvironment environment = new CloudEnvironment();RdbmsServiceInfo mysqlSvc = environment.getServiceInfo("mysqlService", RdbmsServiceInfo.class);RdbmsServiceCreator dataSourceCreator = new RdbmsServiceCreator();DataSource dataSource = dataSourceCreator.createService(mysqlSvc);
<cloud:data-source id="dataSource" service-name="mysql1"> <cloud:pool pool-size="1-5"/> <cloud:connection properties="charset=utf-8"/></cloud:data-source>...
![Page 51: Cloud Foundry bootcamp at ContributingCode](https://reader033.vdocument.in/reader033/viewer/2022060107/554a0e76b4c9058c5d8b484a/html5/thumbnails/51.jpg)
Accessing bound services - high-level, Ruby
51
RedisHost = "127.0.0.1"
RedisPort = 10000
$r = Redis.new(:host => RedisHost, :port => RedisPort) if !$r
reconfigured automatically
production:
adapter: sqlite3
database: db/production.sqlite3
rewritten automatically
![Page 52: Cloud Foundry bootcamp at ContributingCode](https://reader033.vdocument.in/reader033/viewer/2022060107/554a0e76b4c9058c5d8b484a/html5/thumbnails/52.jpg)
Recap…
52
Services :
• SQL and NoSQL databases
• Message broker
• ...
Service Bindings
• VCAP_SERVICES environment variable
• JSON Format
Framework-dependent ways of accessing the bindings:
• Parse JSON
• ...
• Spring, Sinatra and Rails have auto-reconfiguration
![Page 53: Cloud Foundry bootcamp at ContributingCode](https://reader033.vdocument.in/reader033/viewer/2022060107/554a0e76b4c9058c5d8b484a/html5/thumbnails/53.jpg)
Services are great but what if we want to
Use database tools?
Use the services from JUnit integration tests?
53
![Page 54: Cloud Foundry bootcamp at ContributingCode](https://reader033.vdocument.in/reader033/viewer/2022060107/554a0e76b4c9058c5d8b484a/html5/thumbnails/54.jpg)
Using Caldecott to tunnel into your services
54
![Page 55: Cloud Foundry bootcamp at ContributingCode](https://reader033.vdocument.in/reader033/viewer/2022060107/554a0e76b4c9058c5d8b484a/html5/thumbnails/55.jpg)
gem install caldecott
55
![Page 56: Cloud Foundry bootcamp at ContributingCode](https://reader033.vdocument.in/reader033/viewer/2022060107/554a0e76b4c9058c5d8b484a/html5/thumbnails/56.jpg)
Caldecott Demo
56
![Page 57: Cloud Foundry bootcamp at ContributingCode](https://reader033.vdocument.in/reader033/viewer/2022060107/554a0e76b4c9058c5d8b484a/html5/thumbnails/57.jpg)
![Page 58: Cloud Foundry bootcamp at ContributingCode](https://reader033.vdocument.in/reader033/viewer/2022060107/554a0e76b4c9058c5d8b484a/html5/thumbnails/58.jpg)
Running JUnit test with Caldecott
58
Configure your test code to use port + connection info
![Page 59: Cloud Foundry bootcamp at ContributingCode](https://reader033.vdocument.in/reader033/viewer/2022060107/554a0e76b4c9058c5d8b484a/html5/thumbnails/59.jpg)
Summary
59
![Page 60: Cloud Foundry bootcamp at ContributingCode](https://reader033.vdocument.in/reader033/viewer/2022060107/554a0e76b4c9058c5d8b484a/html5/thumbnails/60.jpg)
Cloud Foundry is a remarkably easy way to deploy your applications
60
![Page 61: Cloud Foundry bootcamp at ContributingCode](https://reader033.vdocument.in/reader033/viewer/2022060107/554a0e76b4c9058c5d8b484a/html5/thumbnails/61.jpg)
Cloud Foundry =
Choice
61
![Page 62: Cloud Foundry bootcamp at ContributingCode](https://reader033.vdocument.in/reader033/viewer/2022060107/554a0e76b4c9058c5d8b484a/html5/thumbnails/62.jpg)
Cloud Provider Interface
Applica'on Service Interface
Private Clouds
PublicClouds
MicroClouds
Data Services
Other Services
Msg Services
.js
![Page 63: Cloud Foundry bootcamp at ContributingCode](https://reader033.vdocument.in/reader033/viewer/2022060107/554a0e76b4c9058c5d8b484a/html5/thumbnails/63.jpg)
Questions?
Signup @ www.cloudfoundry.com
![Page 64: Cloud Foundry bootcamp at ContributingCode](https://reader033.vdocument.in/reader033/viewer/2022060107/554a0e76b4c9058c5d8b484a/html5/thumbnails/64.jpg)
Thank You!@CloudFoundry
@crichardson
Website : www.cloudfoundry.comBlog : Blog.CloudFoundry.com
t
t