Deploy Python apps in 5 min with a PaaS
-
Upload
appsembler -
Category
Technology
-
view
4.521 -
download
0
description
Transcript of Deploy Python apps in 5 min with a PaaS
![Page 1: Deploy Python apps in 5 min with a PaaS](https://reader033.fdocuments.net/reader033/viewer/2022051312/545c131aaf7959be0e8b4638/html5/thumbnails/1.jpg)
Deploy Python apps in 5 minuteswith a PaaS
Nate AunePyCon on the Charles, part 1
Feb. 25, 2013
![Page 2: Deploy Python apps in 5 min with a PaaS](https://reader033.fdocuments.net/reader033/viewer/2022051312/545c131aaf7959be0e8b4638/html5/thumbnails/2.jpg)
Jazkarta (2004-‐current)
![Page 3: Deploy Python apps in 5 min with a PaaS](https://reader033.fdocuments.net/reader033/viewer/2022051312/545c131aaf7959be0e8b4638/html5/thumbnails/3.jpg)
2010-‐2011
• Nothing equivalent to Heroku for Django developers
• Built my own PaaS (“How hard can it be?”)
• Shut down last year. Increased compeTTon from big corps meant a race to the boUom
![Page 4: Deploy Python apps in 5 min with a PaaS](https://reader033.fdocuments.net/reader033/viewer/2022051312/545c131aaf7959be0e8b4638/html5/thumbnails/4.jpg)
Appsembler (2012-‐current)
![Page 5: Deploy Python apps in 5 min with a PaaS](https://reader033.fdocuments.net/reader033/viewer/2022051312/545c131aaf7959be0e8b4638/html5/thumbnails/5.jpg)
Agenda
•Why should I care?
•What is a PaaS? What are the advantages?
•Which PaaS should I use?
•When might I not want to use a PaaS?
![Page 6: Deploy Python apps in 5 min with a PaaS](https://reader033.fdocuments.net/reader033/viewer/2022051312/545c131aaf7959be0e8b4638/html5/thumbnails/6.jpg)
Where are you deploying/hosTng today?
• Shared hosTng (i.e. WebfacTon)
• Running your own servers (co-‐located)?
• Using an IaaS provider (i.e. AWS or Rackspace)
• Already using a plaZorm-‐as-‐a-‐service (PaaS)
![Page 7: Deploy Python apps in 5 min with a PaaS](https://reader033.fdocuments.net/reader033/viewer/2022051312/545c131aaf7959be0e8b4638/html5/thumbnails/7.jpg)
Meet Dave
![Page 8: Deploy Python apps in 5 min with a PaaS](https://reader033.fdocuments.net/reader033/viewer/2022051312/545c131aaf7959be0e8b4638/html5/thumbnails/8.jpg)
![Page 9: Deploy Python apps in 5 min with a PaaS](https://reader033.fdocuments.net/reader033/viewer/2022051312/545c131aaf7959be0e8b4638/html5/thumbnails/9.jpg)
Configuring a server
• deciding what size to get (memory, disk)
• ge]ng all the dependencies installed on it
• SSHing into the machine to deploy stuff (feels dirty, but he’s under Tme pressure)
1 day1 day
![Page 10: Deploy Python apps in 5 min with a PaaS](https://reader033.fdocuments.net/reader033/viewer/2022051312/545c131aaf7959be0e8b4638/html5/thumbnails/10.jpg)
Maintaining the server
1 day1 day 1 day
![Page 11: Deploy Python apps in 5 min with a PaaS](https://reader033.fdocuments.net/reader033/viewer/2022051312/545c131aaf7959be0e8b4638/html5/thumbnails/11.jpg)
Security
1 day1 day 1 day 1 day
![Page 12: Deploy Python apps in 5 min with a PaaS](https://reader033.fdocuments.net/reader033/viewer/2022051312/545c131aaf7959be0e8b4638/html5/thumbnails/12.jpg)
Scaling
1 day1 day 1 day 1 day 1 day
![Page 13: Deploy Python apps in 5 min with a PaaS](https://reader033.fdocuments.net/reader033/viewer/2022051312/545c131aaf7959be0e8b4638/html5/thumbnails/13.jpg)
Oh sh*t moment.
![Page 14: Deploy Python apps in 5 min with a PaaS](https://reader033.fdocuments.net/reader033/viewer/2022051312/545c131aaf7959be0e8b4638/html5/thumbnails/14.jpg)
How many people focus on your platform?
Could you innovate faster if they focused on your apps?
Where do you invest?!
6
Example Headcount Costs
Sysadmin $80k
DBA $90kTrain new guy
![Page 15: Deploy Python apps in 5 min with a PaaS](https://reader033.fdocuments.net/reader033/viewer/2022051312/545c131aaf7959be0e8b4638/html5/thumbnails/15.jpg)
Why touch servers if you don’t have to?
![Page 16: Deploy Python apps in 5 min with a PaaS](https://reader033.fdocuments.net/reader033/viewer/2022051312/545c131aaf7959be0e8b4638/html5/thumbnails/16.jpg)
PaaSIs it the promised land?
![Page 17: Deploy Python apps in 5 min with a PaaS](https://reader033.fdocuments.net/reader033/viewer/2022051312/545c131aaf7959be0e8b4638/html5/thumbnails/17.jpg)
What is a PaaS?Platform-as-a-service enables developers to create
innovative applications without operational overhead around configuration, deployment and management.
![Page 18: Deploy Python apps in 5 min with a PaaS](https://reader033.fdocuments.net/reader033/viewer/2022051312/545c131aaf7959be0e8b4638/html5/thumbnails/18.jpg)
Layers of infrastructure
Source: EngineYard “PaaS - State of the Market Survey” May 2012 - http://venturebeat.com/2012/07/05/engine-yard-paas-infographic/
![Page 19: Deploy Python apps in 5 min with a PaaS](https://reader033.fdocuments.net/reader033/viewer/2022051312/545c131aaf7959be0e8b4638/html5/thumbnails/19.jpg)
Source: EngineYard “PaaS - State of the Market Survey” May 2012 - http://venturebeat.com/2012/07/05/engine-yard-paas-infographic/
![Page 20: Deploy Python apps in 5 min with a PaaS](https://reader033.fdocuments.net/reader033/viewer/2022051312/545c131aaf7959be0e8b4638/html5/thumbnails/20.jpg)
Source: EngineYard “PaaS - State of the Market Survey” May 2012 - http://venturebeat.com/2012/07/05/engine-yard-paas-infographic/
![Page 21: Deploy Python apps in 5 min with a PaaS](https://reader033.fdocuments.net/reader033/viewer/2022051312/545c131aaf7959be0e8b4638/html5/thumbnails/21.jpg)
Source: EngineYard “PaaS - State of the Market Survey” May 2012 - http://venturebeat.com/2012/07/05/engine-yard-paas-infographic/
![Page 22: Deploy Python apps in 5 min with a PaaS](https://reader033.fdocuments.net/reader033/viewer/2022051312/545c131aaf7959be0e8b4638/html5/thumbnails/22.jpg)
Source: AppFog “Evolution of the Cloud: Toward a NoOps World” Jan 2012http://gigaom.com/cloud/why-2013-is-the-year-of-noops-for-programmers-infographic/
![Page 23: Deploy Python apps in 5 min with a PaaS](https://reader033.fdocuments.net/reader033/viewer/2022051312/545c131aaf7959be0e8b4638/html5/thumbnails/23.jpg)
Efficient, Elastic, Secure
• Lots of applications co-located on a few servers
• Drastically reduces resources
• Add/remove servers depending on load
• All secured using SELinux or LXC
![Page 24: Deploy Python apps in 5 min with a PaaS](https://reader033.fdocuments.net/reader033/viewer/2022051312/545c131aaf7959be0e8b4638/html5/thumbnails/24.jpg)
Let them do the boring stuff
• Patches and updates
• Migrating applications
• Backups / snapshots
• Configuring everything (web servers, load balancers, modules, databases)
![Page 25: Deploy Python apps in 5 min with a PaaS](https://reader033.fdocuments.net/reader033/viewer/2022051312/545c131aaf7959be0e8b4638/html5/thumbnails/25.jpg)
Define OS dependencies
www: type: python systempackages: - openoffice.org - mysql-client-5.1
5 min
![Page 26: Deploy Python apps in 5 min with a PaaS](https://reader033.fdocuments.net/reader033/viewer/2022051312/545c131aaf7959be0e8b4638/html5/thumbnails/26.jpg)
Backups
5m 5m
https://devcenter.heroku.com/articles/heroku-postgres-fork
![Page 27: Deploy Python apps in 5 min with a PaaS](https://reader033.fdocuments.net/reader033/viewer/2022051312/545c131aaf7959be0e8b4638/html5/thumbnails/27.jpg)
SSL
5m 5m 5m
![Page 28: Deploy Python apps in 5 min with a PaaS](https://reader033.fdocuments.net/reader033/viewer/2022051312/545c131aaf7959be0e8b4638/html5/thumbnails/28.jpg)
Scaling
5m 5m 5m 5m
https://openshift.redhat.com/community/developers/scaling
![Page 29: Deploy Python apps in 5 min with a PaaS](https://reader033.fdocuments.net/reader033/viewer/2022051312/545c131aaf7959be0e8b4638/html5/thumbnails/29.jpg)
Caching
5m 5m 5m 5m 5m
![Page 30: Deploy Python apps in 5 min with a PaaS](https://reader033.fdocuments.net/reader033/viewer/2022051312/545c131aaf7959be0e8b4638/html5/thumbnails/30.jpg)
IaaS vs. PaaS
IaaS -‐ days
PaaS -‐ minutes
![Page 31: Deploy Python apps in 5 min with a PaaS](https://reader033.fdocuments.net/reader033/viewer/2022051312/545c131aaf7959be0e8b4638/html5/thumbnails/31.jpg)
Which PaaS?
• Hosted
• DIY
• Hybrid (public with opTon to go private)
![Page 32: Deploy Python apps in 5 min with a PaaS](https://reader033.fdocuments.net/reader033/viewer/2022051312/545c131aaf7959be0e8b4638/html5/thumbnails/32.jpg)
Who are the players?
• CloudFoundry (open source by VMWare)
• AppFog
• Stackato(ActiveState)
• Heroku(now Salesforce)
• Dotcloud
• Gondor(Python only)
• OpenShift(Redhat’s open source PaaS)
• App Engine(Google)
• Elastic Beanstalk(Amazon)
• Azure(Microsoft)
![Page 33: Deploy Python apps in 5 min with a PaaS](https://reader033.fdocuments.net/reader033/viewer/2022051312/545c131aaf7959be0e8b4638/html5/thumbnails/33.jpg)
Who are the players?
• CloudFoundry (open source by VMWare)
• AppFog
• Stackato(ActiveState)
• Heroku(now Salesforce)
•Dotcloud
• Gondor(Python only)
• OpenShift(Redhat’s open source PaaS)
• App Engine(Google)
• Elastic Beanstalk(Amazon)
• Azure(Microsoft)
We’ll look at these ones tonight.
![Page 34: Deploy Python apps in 5 min with a PaaS](https://reader033.fdocuments.net/reader033/viewer/2022051312/545c131aaf7959be0e8b4638/html5/thumbnails/34.jpg)
Dotcloudpolyglot from the start, very flexible, most Python centric
![Page 35: Deploy Python apps in 5 min with a PaaS](https://reader033.fdocuments.net/reader033/viewer/2022051312/545c131aaf7959be0e8b4638/html5/thumbnails/35.jpg)
![Page 36: Deploy Python apps in 5 min with a PaaS](https://reader033.fdocuments.net/reader033/viewer/2022051312/545c131aaf7959be0e8b4638/html5/thumbnails/36.jpg)
![Page 37: Deploy Python apps in 5 min with a PaaS](https://reader033.fdocuments.net/reader033/viewer/2022051312/545c131aaf7959be0e8b4638/html5/thumbnails/37.jpg)
Anatomy of a Django app
on Dotcloud
dotcloud.yml to store config info
nginx.conf to config URL rewriting
wsgi.py to serve using uWSGI
createdb.py to create the database
mkadmin.py to make the admin user
postinstall to run syncdb, collectstatic
customized settings.py for Dotcloud
![Page 38: Deploy Python apps in 5 min with a PaaS](https://reader033.fdocuments.net/reader033/viewer/2022051312/545c131aaf7959be0e8b4638/html5/thumbnails/38.jpg)
Heroku
![Page 39: Deploy Python apps in 5 min with a PaaS](https://reader033.fdocuments.net/reader033/viewer/2022051312/545c131aaf7959be0e8b4638/html5/thumbnails/39.jpg)
![Page 40: Deploy Python apps in 5 min with a PaaS](https://reader033.fdocuments.net/reader033/viewer/2022051312/545c131aaf7959be0e8b4638/html5/thumbnails/40.jpg)
![Page 41: Deploy Python apps in 5 min with a PaaS](https://reader033.fdocuments.net/reader033/viewer/2022051312/545c131aaf7959be0e8b4638/html5/thumbnails/41.jpg)
Anatomy of a Django app on Heroku
Procfile to configure process
requirements.txt to define dependencies
customized settings.py for Heroku
![Page 42: Deploy Python apps in 5 min with a PaaS](https://reader033.fdocuments.net/reader033/viewer/2022051312/545c131aaf7959be0e8b4638/html5/thumbnails/42.jpg)
Stackatoby ActiveState
Python 3, Run anywhere, New Relic integration
http://appsembler.com/blog/django-deployment-using-stackato/
![Page 43: Deploy Python apps in 5 min with a PaaS](https://reader033.fdocuments.net/reader033/viewer/2022051312/545c131aaf7959be0e8b4638/html5/thumbnails/43.jpg)
![Page 44: Deploy Python apps in 5 min with a PaaS](https://reader033.fdocuments.net/reader033/viewer/2022051312/545c131aaf7959be0e8b4638/html5/thumbnails/44.jpg)
![Page 45: Deploy Python apps in 5 min with a PaaS](https://reader033.fdocuments.net/reader033/viewer/2022051312/545c131aaf7959be0e8b4638/html5/thumbnails/45.jpg)
Anatomy of Django app on
Stackato
stackato.yml to define services
customized settings file
wsgi.py to serve using uWSGI
![Page 46: Deploy Python apps in 5 min with a PaaS](https://reader033.fdocuments.net/reader033/viewer/2022051312/545c131aaf7959be0e8b4638/html5/thumbnails/46.jpg)
OpenShiftby Redhat
Open source, Auto-scaling, Jenkins builds
http://appsembler.com/blog/django-deployment-using-openshift/
![Page 47: Deploy Python apps in 5 min with a PaaS](https://reader033.fdocuments.net/reader033/viewer/2022051312/545c131aaf7959be0e8b4638/html5/thumbnails/47.jpg)
![Page 48: Deploy Python apps in 5 min with a PaaS](https://reader033.fdocuments.net/reader033/viewer/2022051312/545c131aaf7959be0e8b4638/html5/thumbnails/48.jpg)
setup.py instead of requirements.txt
application inside of wsgi dir.htaccess to serve up static files
/data/ dir to store uploaded media files
Action hooks for running commands during build, deploy, post-deploy, etc.
Anatomy of an OpenShift repo
![Page 49: Deploy Python apps in 5 min with a PaaS](https://reader033.fdocuments.net/reader033/viewer/2022051312/545c131aaf7959be0e8b4638/html5/thumbnails/49.jpg)
Stackato OpenShift Dotcloud HerokuPython 2.7, 3.2
stackato runtimes2.6 (2.7) 2.6.5, 2.7.2,
3.1.2, 3.2.22.7.2
PostgreSQL 9.1 8.4 9.0 9.1.6MySQL 5.5 5.1 5.1 (Yes, via RDS)
Persisted FS Yes Yes Yes (Yes, via S3)
Redis Yes, 2.4 No Yes, 2.4.11 (Yes, via addon)
MongoDB Yes, 2.0 Yes, 2.2 Yes, 2.2.1 (Yes, via addon)
Memcached Yes, 1.4 No Yes (Yes, via addon)
RabbitMQ Yes, 2.4 No Yes, 2.8.5 (Yes, via addon)
Solr No No Yes, 3.4.0 (Yes, via Websolr)
Cron Yes Yes Yes Yes
Extensible Yes, apt-get install Yes, DIY cartridge Yes, custom service Yes, buildpacks
WebSockets Yes Yes Yes Yes, via Pusher add-on
![Page 50: Deploy Python apps in 5 min with a PaaS](https://reader033.fdocuments.net/reader033/viewer/2022051312/545c131aaf7959be0e8b4638/html5/thumbnails/50.jpg)
Stackato OpenShift Dotcloud Heroku
Memory Configurable 1.5GB RAM
Unlimited sandbox
Apps Configurable No Yes, 2.8.5 (Yes, via addon)
Solr No No Yes, 3.4.0 (Yes, via Websolr)
Cron Yes Yes Yes Yes
Extensible Yes, apt-get install Yes, DIY cartridge Yes, custom service Yes, buildpacks
WebSockets Yes ? Yes Yes, via Pusher add-on
![Page 51: Deploy Python apps in 5 min with a PaaS](https://reader033.fdocuments.net/reader033/viewer/2022051312/545c131aaf7959be0e8b4638/html5/thumbnails/51.jpg)
Why not PaaS?
• Already invested in your own infrastructure.
• Need to run on servers outside U.S.
• Special requirements not met by PaaS services
![Page 52: Deploy Python apps in 5 min with a PaaS](https://reader033.fdocuments.net/reader033/viewer/2022051312/545c131aaf7959be0e8b4638/html5/thumbnails/52.jpg)
OpenShid Pricing
![Page 53: Deploy Python apps in 5 min with a PaaS](https://reader033.fdocuments.net/reader033/viewer/2022051312/545c131aaf7959be0e8b4638/html5/thumbnails/53.jpg)
Dotcloud pricing
![Page 54: Deploy Python apps in 5 min with a PaaS](https://reader033.fdocuments.net/reader033/viewer/2022051312/545c131aaf7959be0e8b4638/html5/thumbnails/54.jpg)
Heroku pricing
![Page 55: Deploy Python apps in 5 min with a PaaS](https://reader033.fdocuments.net/reader033/viewer/2022051312/545c131aaf7959be0e8b4638/html5/thumbnails/55.jpg)
Other resources
• Wrap-up from PaaS bake-offhttp://appsembler.com/blog/wrap-up-from-paas-bake-off/
• Django deployment using PaaShttp://appsembler.com/blog/django-deployment-using-paas/
• django-deployerhttps://github.com/natea/django-deployer
• paasbakeoff - code exampleshttps://github.com/appsembler/paasbakeoff/