Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.
Python on 
Cloud Foundry 
Ian Huston, Data Scientist 
@ianhuston 
© Copyright 2014 Pivotal. All rights reserved. 1
Who am I? 
Ÿ Ian Huston 
Ÿ @ianhuston 
Ÿ github.com/ihuston 
Ÿ www.ianhuston.net 
Ÿ Talk resources: 
http://tinyurl.c...
What is Cloud Foundry? 
@ianhuston 
http://cloudfoundry.org 
Open Source Cloud Platform 
Simple App Deployment, 
Scaling &...
Cloud Foundry Foundation: Industry Standard 
@ianhuston 
Gold 
Silver 
© Copyright 2014 Pivotal. All rights reserved. 4
CF for data scientists & developers 
Easily deploy your web app 
Scale up and out quickly 
Create and bind services 
cf 
b...
Cloud Foundry: From 50 touch points to 1 
1 2 4 4 40 1 
50 Configuration Touches 
1. Register Hostname with DNS (1) 
2. Co...
Python & CF 
@ianhuston 
© Copyright 2014 Pivotal. All rights reserved. 7
Python on Cloud Foundry 
Ÿ First class language (with Go, Java, Ruby, Node.js, PHP) 
Ÿ Automatic app type detection 
Ÿ ...
Simple Flask App Demo 
Ÿ Simple one page “Hello World” web app 
Ÿ Video: https://www.youtube.com/watch?v=QOfD6tnoAB8 
Ÿ...
Data Services 
Ÿ Easy to bind and scale services 
– Databases, NoSQL, message queues etc. 
$ 
cf 
create-­‐service 
redis...
Services now available 
These are available on Pivotal CF (Pivotal’s packaged Cloud Foundry offering). 
See http://run.piv...
PyData stack on CF: conda 
• Use (mini)conda to provide Python & package 
installation 
• Quickly install needed PyData pa...
Why? 
@ianhuston 
© Copyright 2014 Pivotal. All rights reserved. 13
Benefits for Data Scientists 
Ÿ Easy to get web apps up and running 
Ÿ Create and bind to your favourite data services 
...
Try Cloud Foundry today! 
Pivotal Web Services: http://run.pivotal.io 
HP Helion: http://horizon.hpcloud.com 
@ianhuston 
...
More info and resources 
Ÿ Material for this talk: http://tinyurl.com/pythonCF 
Ÿ Cloud Foundry: http://cloudfoundry.org...
Appendix 
Docker & Cloud Foundry 
@ianhuston 
© Copyright 2014 Pivotal. All rights reserved. 17
CF and Docker 
Docker joins the Cloud 
Foundry Foundation in 
May 2014 to support 
Cloud Foundry open 
governance and adva...
Docker Benefit: Customize More Layers of the App 
Dev Provides 
System Provides 
App container 
@ianhuston 
Docker 
applic...
Coming soon to Cloud Foundry 
Ÿ Planned to support Cloud Foundry apps from: 
– Linux Buildpacks 
– Windows .NET Buildpack...
Upcoming SlideShare
Loading in …5
×

Python on Cloud Foundry

2,778 views

Published on

Presented at PyData NY 2014

Resources: http://www.ianhuston.net/2014/11/python-on-cloud-foundry/

As a data scientist I frequently need to create web apps to provide interactive functionality, deliver data APIs or simply publish results. It is now easier than ever to deploy your data driven web app by using cloud based application platforms to do the heavy lifting. Cloud Foundry is an open source public and private cloud platform that supports Python based applications (along with other languages) and enables simple app deployment, scaling and connectivity to data services like PostgreSQL, Redis and Cassandra. To make use of the full PyData stack I have created a Heroku-style buildpack which uses conda for package management. This means for example that you can get a private IPython Notebook server up and running in seconds. In this talk I want to show you how to deploy your first app using Cloud Foundry,
connect to databases and other data services,
use PyData packages with a Heroku-style buildpack,
find public and private Cloud Foundry installation options.

Published in: Technology
  • Be the first to comment

Python on Cloud Foundry

  1. 1. Python on Cloud Foundry Ian Huston, Data Scientist @ianhuston © Copyright 2014 Pivotal. All rights reserved. 1
  2. 2. Who am I? Ÿ Ian Huston Ÿ @ianhuston Ÿ github.com/ihuston Ÿ www.ianhuston.net Ÿ Talk resources: http://tinyurl.com/pythonCF @ianhuston Ÿ Data Scientist Ÿ Use PyData stack for predictive analytics and machine learning Ÿ Previously a theoretical physicist using Python for numerical simulations & HPC © Copyright 2014 Pivotal. All rights reserved. 2
  3. 3. What is Cloud Foundry? @ianhuston http://cloudfoundry.org Open Source Cloud Platform Simple App Deployment, Scaling & Availability © Copyright 2014 Pivotal. All rights reserved. 3
  4. 4. Cloud Foundry Foundation: Industry Standard @ianhuston Gold Silver © Copyright 2014 Pivotal. All rights reserved. 4
  5. 5. CF for data scientists & developers Easily deploy your web app Scale up and out quickly Create and bind services cf bind-­‐service myapp redis @ianhuston cf push cf scale myapp –i 5 –m 1G © Copyright 2014 Pivotal. All rights reserved. 5
  6. 6. Cloud Foundry: From 50 touch points to 1 1 2 4 4 40 1 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) @ianhuston mod proxy 1 Configuration Touch 1. The platform takes care of all the steps on the left automatically © Copyright 2014 Pivotal. All rights reserved. 6
  7. 7. Python & CF @ianhuston © Copyright 2014 Pivotal. All rights reserved. 7
  8. 8. 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) @ianhuston © Copyright 2014 Pivotal. All rights reserved. 8
  9. 9. 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 @ianhuston © Copyright 2014 Pivotal. All rights reserved. 9
  10. 10. 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", } @ianhuston "password": "your_redis_password” } } ] © Copyright 2014 Pivotal. All rights reserved. 10
  11. 11. 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. @ianhuston © Copyright 2014 Pivotal. All rights reserved. 11
  12. 12. 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 @ianhuston + © Copyright 2014 Pivotal. All rights reserved. 12
  13. 13. Why? @ianhuston © Copyright 2014 Pivotal. All rights reserved. 13
  14. 14. 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 @ianhuston © Copyright 2014 Pivotal. All rights reserved. 14
  15. 15. Try Cloud Foundry today! Pivotal Web Services: http://run.pivotal.io HP Helion: http://horizon.hpcloud.com @ianhuston IBM Bluemix: http://bluemix.net Anynines: http://anynines.com © Copyright 2014 Pivotal. All rights reserved. 15
  16. 16. 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/ @ianhuston © Copyright 2014 Pivotal. All rights reserved. 16
  17. 17. Appendix Docker & Cloud Foundry @ianhuston © Copyright 2014 Pivotal. All rights reserved. 17
  18. 18. CF and Docker 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 @ianhuston © Copyright 2014 Pivotal. All rights reserved. 18
  19. 19. Docker Benefit: Customize More Layers of the App Dev Provides System Provides App container @ianhuston Docker application layer runtime layer OS image system brings fixed host OS Kernel Buildpack application layer runtime layer* OS image system brings fixed host OS Kernel * Devs may bring a custom buildpack © Copyright 2014 Pivotal. All rights reserved. 19
  20. 20. 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 @ianhuston © Copyright 2014 Pivotal. All rights reserved. 20

×