Python on Cloud Foundry
-
Upload
ian-huston -
Category
Technology
-
view
1.040 -
download
8
description
Transcript of Python on Cloud Foundry
![Page 1: Python on Cloud Foundry](https://reader033.fdocuments.net/reader033/viewer/2022052907/559445891a28abfa2f8b4844/html5/thumbnails/1.jpg)
@ianhuston 1 © Copyright 2014 Pivotal. All rights reserved. 1 © Copyright 2014 Pivotal. All rights reserved.
Python on Cloud Foundry
Ian Huston, Data Scientist
![Page 2: Python on Cloud Foundry](https://reader033.fdocuments.net/reader033/viewer/2022052907/559445891a28abfa2f8b4844/html5/thumbnails/2.jpg)
@ianhuston 2 © Copyright 2014 Pivotal. All rights reserved.
Who am I?
� Ian Huston
� @ianhuston
� github.com/ihuston
� www.ianhuston.net
� Talk resources: http://tinyurl.com/pythonCF
� Data Scientist
� Use PyData stack for predictive analytics and machine learning
� Previously a theoretical physicist using Python for numerical simulations & HPC
![Page 3: Python on Cloud Foundry](https://reader033.fdocuments.net/reader033/viewer/2022052907/559445891a28abfa2f8b4844/html5/thumbnails/3.jpg)
@ianhuston 3 © Copyright 2014 Pivotal. All rights reserved.
What is Cloud Foundry?
http://cloudfoundry.org
Open Source Cloud Platform
Simple App Deployment, Scaling & Availability
![Page 4: Python on Cloud Foundry](https://reader033.fdocuments.net/reader033/viewer/2022052907/559445891a28abfa2f8b4844/html5/thumbnails/4.jpg)
@ianhuston 4 © Copyright 2014 Pivotal. All rights reserved.
Cloud Foundry Foundation: Industry Standard
Gold
Silver
![Page 5: Python on Cloud Foundry](https://reader033.fdocuments.net/reader033/viewer/2022052907/559445891a28abfa2f8b4844/html5/thumbnails/5.jpg)
@ianhuston 5 © Copyright 2014 Pivotal. All rights reserved.
CF for data scientists & developers Easily deploy your web app
cf push Scale up and out quickly
cf scale myapp –i 5 –m 1G Create and bind services
cf bind-‐service myapp redis
![Page 6: Python on Cloud Foundry](https://reader033.fdocuments.net/reader033/viewer/2022052907/559445891a28abfa2f8b4844/html5/thumbnails/6.jpg)
@ianhuston 6 © Copyright 2014 Pivotal. All rights reserved.
mod proxy
1. The platform takes care of all the steps on the left automatically
50 Configuration Touches
1. Register Hostname with DNS (1) 2. Configure F5 Load Balancing Group (2) 3. Configure Apache HTTPd Worker Pool (4) 4. Configure mod_proxy Connector Routing (4) 5. Configure Tomcat Connector Pool (40)
1 Configuration Touch
1 2 4 4 40 1
Cloud Foundry: From 50 touch points to 1
![Page 7: Python on Cloud Foundry](https://reader033.fdocuments.net/reader033/viewer/2022052907/559445891a28abfa2f8b4844/html5/thumbnails/7.jpg)
@ianhuston 7 © Copyright 2014 Pivotal. All rights reserved. 7 © Copyright 2014 Pivotal. All rights reserved.
Python & CF
![Page 8: Python on Cloud Foundry](https://reader033.fdocuments.net/reader033/viewer/2022052907/559445891a28abfa2f8b4844/html5/thumbnails/8.jpg)
@ianhuston 8 © Copyright 2014 Pivotal. All rights reserved.
Python on Cloud Foundry
� First class language (with Go, Java, Ruby, Node.js, PHP)
� Automatic app type detection
� Buildpack takes care of – Installing Python interpreter – Installing packages in requirements.txt using pip – Starting web app as requested (e.g. python myapp.py)
![Page 9: Python on Cloud Foundry](https://reader033.fdocuments.net/reader033/viewer/2022052907/559445891a28abfa2f8b4844/html5/thumbnails/9.jpg)
@ianhuston 9 © Copyright 2014 Pivotal. All rights reserved.
Simple Flask App Demo � Simple one page “Hello World” web app
� Video: https://www.youtube.com/watch?v=QOfD6tnoAB8
� Demonstrates: – Installation of requirements – Scaling properties
� Need to Provide: – App files – Dependencies listed in requirements.txt file – Optional manifest.yml file with configuration for deployment
![Page 10: Python on Cloud Foundry](https://reader033.fdocuments.net/reader033/viewer/2022052907/559445891a28abfa2f8b4844/html5/thumbnails/10.jpg)
@ianhuston 10 © Copyright 2014 Pivotal. All rights reserved.
Data Services
� Easy to bind and scale services – Databases, NoSQL, message queues etc. $ cf create-‐service rediscloud PLAN_NAME INSTANCE_NAME $ cf bind-‐service APP_NAME INSTANCE_NAME
� Details provided in VCAP_APP_SERVICES env variable: { "rediscloud": [ { "name": "rediscloud-‐42", "label": "rediscloud", "plan": "20mb", "credentials": { "port"": "6379",
"hostname": "pub-‐redis-‐6379.us-‐east-‐1-‐2.3.ec2.redislabs.com", "password": "your_redis_password” } } ] }
![Page 11: Python on Cloud Foundry](https://reader033.fdocuments.net/reader033/viewer/2022052907/559445891a28abfa2f8b4844/html5/thumbnails/11.jpg)
@ianhuston 11 © Copyright 2014 Pivotal. All rights reserved.
Services now available These are available on Pivotal CF (Pivotal’s packaged Cloud Foundry offering).
See http://run.pivotal.io for the services available on Pivotal Web Services.
![Page 12: Python on Cloud Foundry](https://reader033.fdocuments.net/reader033/viewer/2022052907/559445891a28abfa2f8b4844/html5/thumbnails/12.jpg)
@ianhuston 12 © Copyright 2014 Pivotal. All rights reserved.
PyData stack on CF: conda +
• Use (mini)conda to provide Python & package installation
• Quickly install needed PyData packages • Can even provision your own IPython notebook
server [at your own risk!]
CF Buildpack: https://github.com/ihuston/python-conda-buildpack
![Page 13: Python on Cloud Foundry](https://reader033.fdocuments.net/reader033/viewer/2022052907/559445891a28abfa2f8b4844/html5/thumbnails/13.jpg)
@ianhuston 13 © Copyright 2014 Pivotal. All rights reserved. 13 © Copyright 2014 Pivotal. All rights reserved.
Why?
![Page 14: Python on Cloud Foundry](https://reader033.fdocuments.net/reader033/viewer/2022052907/559445891a28abfa2f8b4844/html5/thumbnails/14.jpg)
@ianhuston 14 © Copyright 2014 Pivotal. All rights reserved.
Benefits for Data Scientists
� Easy to get web apps up and running
� Create and bind to your favourite data services
� Don’t get locked in to one cloud provider
� Python is officially supported
![Page 15: Python on Cloud Foundry](https://reader033.fdocuments.net/reader033/viewer/2022052907/559445891a28abfa2f8b4844/html5/thumbnails/15.jpg)
@ianhuston 15 © Copyright 2014 Pivotal. All rights reserved.
Try Cloud Foundry today!
Pivotal Web Services: http://run.pivotal.io IBM Bluemix: http://bluemix.net Anynines: http://anynines.com
HP Helion: http://horizon.hpcloud.com
![Page 16: Python on Cloud Foundry](https://reader033.fdocuments.net/reader033/viewer/2022052907/559445891a28abfa2f8b4844/html5/thumbnails/16.jpg)
@ianhuston 16 © Copyright 2014 Pivotal. All rights reserved.
More info and resources
� Material for this talk: http://tinyurl.com/pythonCF
� Cloud Foundry: http://cloudfoundry.org
� Flask Mega Meta Tutorial for DS: http://tinyurl.com/flaskDS
� Twelve Factor Apps: http://12factor.net/
� Meetups: http://cloud-foundry.meetup.com/
![Page 17: Python on Cloud Foundry](https://reader033.fdocuments.net/reader033/viewer/2022052907/559445891a28abfa2f8b4844/html5/thumbnails/17.jpg)
@ianhuston 17 © Copyright 2014 Pivotal. All rights reserved. 17 © Copyright 2014 Pivotal. All rights reserved.
Appendix Docker & Cloud Foundry
![Page 18: Python on Cloud Foundry](https://reader033.fdocuments.net/reader033/viewer/2022052907/559445891a28abfa2f8b4844/html5/thumbnails/18.jpg)
@ianhuston 18 © Copyright 2014 Pivotal. All rights reserved.
Docker joins the Cloud Foundry Foundation in May 2014 to support Cloud Foundry open governance and advance the state of containers in Platform as a Service
CF and Docker
![Page 19: Python on Cloud Foundry](https://reader033.fdocuments.net/reader033/viewer/2022052907/559445891a28abfa2f8b4844/html5/thumbnails/19.jpg)
@ianhuston 19 © Copyright 2014 Pivotal. All rights reserved.
Docker Benefit: Customize More Layers of the App
runtime layer
OS image
application layer
Docker
system brings fixed host OS Kernel
* Devs may bring a custom buildpack
runtime layer*
OS image
application layer
Buildpack
system brings fixed host OS Kernel
App container
System Provides
Dev Provides
![Page 20: Python on Cloud Foundry](https://reader033.fdocuments.net/reader033/viewer/2022052907/559445891a28abfa2f8b4844/html5/thumbnails/20.jpg)
@ianhuston 20 © Copyright 2014 Pivotal. All rights reserved.
Coming soon to Cloud Foundry � Planned to support Cloud Foundry apps from: – Linux Buildpacks – Windows .NET Buildpacks powered by Iron Foundry – Docker images
� Docker applications will work similar to apps from buildpacks – Same scaling & services bindings, same CLI commands push etc