SlideShare a Scribd company logo
1 of 22
Download to read offline
Quick and Dirty Python
Deployments with Heroku
Guest starring Flask, CoffeeScript, Fabric, and
                  SeatGeek

                         Daniel Pritchett for MEMpy,
                                      March 19, 2012
Painless Heroku Startup
Requirements
•   Python 2.7
•   virtualenv
•   pip
•   Rubygems
•   Procfile / foreman
Get started
• Install git, foreman, pip, virtualenv
• Clone/create a repo with a Procfile that
  starts a HTTP service
• foreman start to test it locally
• heroku create app_name –
  stack=cedar && git push heroku
  master
Setup log
$ virtualenv --no-site-packages heroku_demo
   New python executable in heroku_demo/bin/python
   Installing pip...............cdone.
$ cd heroku_demo/
$ . bin/activate
$ git clone git://github.com/dpritchett/wwebsite-python.git app
$ cd app
$ pip install -r ./requirements.txt
   Successfully installed Flask Jinja2 Pygments Werkzeug chardet gunicorn
$ foreman start
   13:20:18 web.1     | started with pid 17810
   13:20:18 web.1     | 2012-03-19 13:20:18 [17810] [INFO] Starting gunicorn 0.14.1
   13:20:18 web.1     | 2012-03-19 13:20:18 [17810] [INFO] Listening at: http://0.0.0.0:5000
$ heroku create mempy-demo --stack=cedar
   Creating mempy-demo... done, stack is cedar
   http://mempy-demo.herokuapp.com/ | git@heroku.com:mempy-demo.git
   Git remote heroku added
$ git push heroku master
   Procfile declares types -> web
   http://mempy-demo.herokuapp.com deployed to Heroku
$ curl mempy-demo.herokuapp.com
   Hello World!
Foreman’s Procfile defines the service


web: gunicorn app:APP -b 0.0.0.0:$PORT -w 3

You can run the same thing at the console to test:
  $ gunicorn app:APP -b 0.0.0.0:$PORT -w 3
Heroku logging
• Captures stdout, stderr
• You’ll need it since you have no persistent disk
• Simplest case you can just use a print statement
• Free plan has limitations
• Consider an offsite log manager
Remote console
$ heroku run bash
    Running bash attached to terminal... up, run.2
~ $ find templates
    templates
    templates/index.html
~ $ find static
    static
    static/js
    static/js/memphis_tickets.js
    static/coffee
    static/coffee/memphis_tickets.coffee
    static/bootstrap
    static/bootstrap/js
    static/bootstrap/js/bootstrap.js
     ...
    static/bootstrap/css/bootstrap.css
    static/css
    static/css/tickets.css
~ $
Sample Flask application:
 TicketsOfMemphis.com
The entire backend
HTML templating (Jinja2)
CoffeeScript excerpts
Data provided by SeatGeek API
Honorable mention: Fabric
             $ fab s
               [localhost] local: coffee -o ../js/ --compile
             ./*coffee

               [localhost] local: foreman start
               14:11:29 web.1     | started with pid 24218
               14:11:29 web.1     | 2012-03-19 14:11:29
             [24218] [INFO] Starting gunicorn 0.14.1
               14:11:29 web.1     | 2012-03-19 14:11:29
             [24218] [INFO] Listening at: http://0.0.0.0:5000
             (24218)
               14:11:29 web.1     | 2012-03-19 14:11:29
             [24218] [INFO] Using worker: sync
                        14:11:29 web.1     | 2012-03-19
             14:11:29 [24225] [INFO] Booting worker with pid:
             24225
               14:11:29 web.1     | 2012-03-19 14:11:29
             [24226] [INFO] Booting worker with pid: 24226
               14:11:29 web.1     | 2012-03-19 14:11:29
             [24227] [INFO] Booting worker with pid: 24227
Heroku Ecosystem

Pain points and add-ons
addons.heroku.com
•   Databases
•   Worker hours
•   Email services
•   DNS
•   HTTPS and certificates
•   Billing
•   Message/Task Queues
LogEntries
LogEntries Alerts
Zerigo DNS
MongoHQ
Thank you!
Try a copy of the code at
  github.com/dpritchett/wwebsite-python

Heroku and Flask have great docs.



Find me @dpritchett

More Related Content

What's hot

Install apache on centos
Install apache on centosInstall apache on centos
Install apache on centoshengko
 
Capifony. Minsk PHP MeetUp #11
Capifony. Minsk PHP MeetUp #11Capifony. Minsk PHP MeetUp #11
Capifony. Minsk PHP MeetUp #11Yury Pliashkou
 
Ansible lightning talk at Scale 12
Ansible lightning talk at Scale 12Ansible lightning talk at Scale 12
Ansible lightning talk at Scale 12Justin Garrison
 
Config managament for development environments ii
Config managament for development environments iiConfig managament for development environments ii
Config managament for development environments iiGareth Rushgrove
 
Building with Firebase
Building with FirebaseBuilding with Firebase
Building with FirebaseMike Fowler
 
How we used ruby to build locaweb's cloud (http://presentations.pothix.com/ru...
How we used ruby to build locaweb's cloud (http://presentations.pothix.com/ru...How we used ruby to build locaweb's cloud (http://presentations.pothix.com/ru...
How we used ruby to build locaweb's cloud (http://presentations.pothix.com/ru...Willian Molinari
 
Convox introduction by Matt Manning
Convox introduction by Matt ManningConvox introduction by Matt Manning
Convox introduction by Matt Manningjasnow
 
Deployment with Fabric
Deployment with FabricDeployment with Fabric
Deployment with Fabricandymccurdy
 
Puppet camp Portland 2015: -windows (1)
Puppet camp Portland 2015: -windows (1)Puppet camp Portland 2015: -windows (1)
Puppet camp Portland 2015: -windows (1)Puppet
 
Building Docker images with Puppet
Building Docker images with PuppetBuilding Docker images with Puppet
Building Docker images with PuppetNick Jones
 
以 Laravel 經驗開發 Hyperf 應用
以 Laravel 經驗開發 Hyperf 應用以 Laravel 經驗開發 Hyperf 應用
以 Laravel 經驗開發 Hyperf 應用Shengyou Fan
 
What's Special About Elixir
What's Special About ElixirWhat's Special About Elixir
What's Special About ElixirNeven Rakonić
 
fog or: How I Learned to Stop Worrying and Love the Cloud
fog or: How I Learned to Stop Worrying and Love the Cloudfog or: How I Learned to Stop Worrying and Love the Cloud
fog or: How I Learned to Stop Worrying and Love the CloudWesley Beary
 
NLIT 2011: Chef & Capistrano
NLIT 2011: Chef & CapistranoNLIT 2011: Chef & Capistrano
NLIT 2011: Chef & Capistranonickblah
 
[PHP 也有 Day] 垃圾留言守城記 - 用 Laravel 阻擋 SPAM 留言的奮鬥史
[PHP 也有 Day] 垃圾留言守城記 - 用 Laravel 阻擋 SPAM 留言的奮鬥史[PHP 也有 Day] 垃圾留言守城記 - 用 Laravel 阻擋 SPAM 留言的奮鬥史
[PHP 也有 Day] 垃圾留言守城記 - 用 Laravel 阻擋 SPAM 留言的奮鬥史Shengyou Fan
 
Cloud meets Fog & Puppet A Story of Version Controlled Infrastructure
Cloud meets Fog & Puppet A Story of Version Controlled InfrastructureCloud meets Fog & Puppet A Story of Version Controlled Infrastructure
Cloud meets Fog & Puppet A Story of Version Controlled InfrastructureHabeeb Rahman
 
Weird things we've seen with OpenStack Neutron
Weird things we've seen with OpenStack NeutronWeird things we've seen with OpenStack Neutron
Weird things we've seen with OpenStack NeutronNick Jones
 

What's hot (20)

Install apache on centos
Install apache on centosInstall apache on centos
Install apache on centos
 
Capifony. Minsk PHP MeetUp #11
Capifony. Minsk PHP MeetUp #11Capifony. Minsk PHP MeetUp #11
Capifony. Minsk PHP MeetUp #11
 
Ansible lightning talk at Scale 12
Ansible lightning talk at Scale 12Ansible lightning talk at Scale 12
Ansible lightning talk at Scale 12
 
Usb fix report
Usb fix reportUsb fix report
Usb fix report
 
Config managament for development environments ii
Config managament for development environments iiConfig managament for development environments ii
Config managament for development environments ii
 
Building with Firebase
Building with FirebaseBuilding with Firebase
Building with Firebase
 
How we used ruby to build locaweb's cloud (http://presentations.pothix.com/ru...
How we used ruby to build locaweb's cloud (http://presentations.pothix.com/ru...How we used ruby to build locaweb's cloud (http://presentations.pothix.com/ru...
How we used ruby to build locaweb's cloud (http://presentations.pothix.com/ru...
 
Convox introduction by Matt Manning
Convox introduction by Matt ManningConvox introduction by Matt Manning
Convox introduction by Matt Manning
 
Deployment with Fabric
Deployment with FabricDeployment with Fabric
Deployment with Fabric
 
Puppet camp Portland 2015: -windows (1)
Puppet camp Portland 2015: -windows (1)Puppet camp Portland 2015: -windows (1)
Puppet camp Portland 2015: -windows (1)
 
Building Docker images with Puppet
Building Docker images with PuppetBuilding Docker images with Puppet
Building Docker images with Puppet
 
以 Laravel 經驗開發 Hyperf 應用
以 Laravel 經驗開發 Hyperf 應用以 Laravel 經驗開發 Hyperf 應用
以 Laravel 經驗開發 Hyperf 應用
 
Modern Perl Toolchain
Modern Perl ToolchainModern Perl Toolchain
Modern Perl Toolchain
 
What's Special About Elixir
What's Special About ElixirWhat's Special About Elixir
What's Special About Elixir
 
fog or: How I Learned to Stop Worrying and Love the Cloud
fog or: How I Learned to Stop Worrying and Love the Cloudfog or: How I Learned to Stop Worrying and Love the Cloud
fog or: How I Learned to Stop Worrying and Love the Cloud
 
NLIT 2011: Chef & Capistrano
NLIT 2011: Chef & CapistranoNLIT 2011: Chef & Capistrano
NLIT 2011: Chef & Capistrano
 
[PHP 也有 Day] 垃圾留言守城記 - 用 Laravel 阻擋 SPAM 留言的奮鬥史
[PHP 也有 Day] 垃圾留言守城記 - 用 Laravel 阻擋 SPAM 留言的奮鬥史[PHP 也有 Day] 垃圾留言守城記 - 用 Laravel 阻擋 SPAM 留言的奮鬥史
[PHP 也有 Day] 垃圾留言守城記 - 用 Laravel 阻擋 SPAM 留言的奮鬥史
 
Cloud meets Fog & Puppet A Story of Version Controlled Infrastructure
Cloud meets Fog & Puppet A Story of Version Controlled InfrastructureCloud meets Fog & Puppet A Story of Version Controlled Infrastructure
Cloud meets Fog & Puppet A Story of Version Controlled Infrastructure
 
Weird things we've seen with OpenStack Neutron
Weird things we've seen with OpenStack NeutronWeird things we've seen with OpenStack Neutron
Weird things we've seen with OpenStack Neutron
 
Designing net-aws-glacier
Designing net-aws-glacierDesigning net-aws-glacier
Designing net-aws-glacier
 

Viewers also liked

Afrika Sunrise Jantjebeton
Afrika Sunrise  JantjebetonAfrika Sunrise  Jantjebeton
Afrika Sunrise JantjebetonHeena Modi
 
Logs as Data: Using Logs to track Web Application Performance
Logs as Data: Using Logs to track Web Application PerformanceLogs as Data: Using Logs to track Web Application Performance
Logs as Data: Using Logs to track Web Application PerformanceTrevor Parsons
 
Millennium - they have a gorgeous range of vegan food. So good that we went b...
Millennium - they have a gorgeous range of vegan food. So good that we went b...Millennium - they have a gorgeous range of vegan food. So good that we went b...
Millennium - they have a gorgeous range of vegan food. So good that we went b...Heena Modi
 
July 10th 2014 - to use with members from multiple Unions
July 10th 2014 - to use with members from multiple UnionsJuly 10th 2014 - to use with members from multiple Unions
July 10th 2014 - to use with members from multiple UnionsHeena Modi
 
Jean Fares Pret-A-Porter, 2013 collection: Behind the scenes.
Jean Fares Pret-A-Porter, 2013 collection: Behind the scenes.Jean Fares Pret-A-Porter, 2013 collection: Behind the scenes.
Jean Fares Pret-A-Porter, 2013 collection: Behind the scenes.Norma HAYEK
 
What is Computer-Aided Summarisation and does it really work?
What is Computer-Aided Summarisation and does it really work?What is Computer-Aided Summarisation and does it really work?
What is Computer-Aided Summarisation and does it really work?Constantin Orasan
 
Facebook Marketing Success Summit Presentation 2011 - Success with Facebook Ads
Facebook Marketing Success Summit Presentation 2011 - Success with Facebook AdsFacebook Marketing Success Summit Presentation 2011 - Success with Facebook Ads
Facebook Marketing Success Summit Presentation 2011 - Success with Facebook AdsChris Treadaway
 
The making of handbags
The making of handbagsThe making of handbags
The making of handbagsHeena Modi
 
Fond memories of Zanzibar
Fond memories of ZanzibarFond memories of Zanzibar
Fond memories of ZanzibarHeena Modi
 
Social Media for Local Businesses
Social Media for Local BusinessesSocial Media for Local Businesses
Social Media for Local BusinessesChris Treadaway
 
The broiler hen
The broiler hen The broiler hen
The broiler hen Heena Modi
 
Harsh stock market
Harsh stock marketHarsh stock market
Harsh stock marketHarsh Jain
 
Tom tom go 510
Tom tom go 510Tom tom go 510
Tom tom go 510Heena Modi
 
2013 Jean Fares Couture collection look book
2013 Jean Fares Couture collection look book2013 Jean Fares Couture collection look book
2013 Jean Fares Couture collection look bookNorma HAYEK
 
MSS Business Integration Practice Ibm Web Sphere
MSS Business Integration Practice   Ibm Web SphereMSS Business Integration Practice   Ibm Web Sphere
MSS Business Integration Practice Ibm Web SphereDavid White
 
Before and after decorating our new home
Before and after decorating our new homeBefore and after decorating our new home
Before and after decorating our new homeHeena Modi
 

Viewers also liked (20)

Afrika Sunrise Jantjebeton
Afrika Sunrise  JantjebetonAfrika Sunrise  Jantjebeton
Afrika Sunrise Jantjebeton
 
Physion.PDF
Physion.PDFPhysion.PDF
Physion.PDF
 
Logs as Data: Using Logs to track Web Application Performance
Logs as Data: Using Logs to track Web Application PerformanceLogs as Data: Using Logs to track Web Application Performance
Logs as Data: Using Logs to track Web Application Performance
 
Father
FatherFather
Father
 
Millennium - they have a gorgeous range of vegan food. So good that we went b...
Millennium - they have a gorgeous range of vegan food. So good that we went b...Millennium - they have a gorgeous range of vegan food. So good that we went b...
Millennium - they have a gorgeous range of vegan food. So good that we went b...
 
July 10th 2014 - to use with members from multiple Unions
July 10th 2014 - to use with members from multiple UnionsJuly 10th 2014 - to use with members from multiple Unions
July 10th 2014 - to use with members from multiple Unions
 
Jean Fares Pret-A-Porter, 2013 collection: Behind the scenes.
Jean Fares Pret-A-Porter, 2013 collection: Behind the scenes.Jean Fares Pret-A-Porter, 2013 collection: Behind the scenes.
Jean Fares Pret-A-Porter, 2013 collection: Behind the scenes.
 
What is Computer-Aided Summarisation and does it really work?
What is Computer-Aided Summarisation and does it really work?What is Computer-Aided Summarisation and does it really work?
What is Computer-Aided Summarisation and does it really work?
 
Facebook Marketing Success Summit Presentation 2011 - Success with Facebook Ads
Facebook Marketing Success Summit Presentation 2011 - Success with Facebook AdsFacebook Marketing Success Summit Presentation 2011 - Success with Facebook Ads
Facebook Marketing Success Summit Presentation 2011 - Success with Facebook Ads
 
The making of handbags
The making of handbagsThe making of handbags
The making of handbags
 
Dairy farms
Dairy farmsDairy farms
Dairy farms
 
Fond memories of Zanzibar
Fond memories of ZanzibarFond memories of Zanzibar
Fond memories of Zanzibar
 
Social Media for Local Businesses
Social Media for Local BusinessesSocial Media for Local Businesses
Social Media for Local Businesses
 
The broiler hen
The broiler hen The broiler hen
The broiler hen
 
Harsh stock market
Harsh stock marketHarsh stock market
Harsh stock market
 
Tom tom go 510
Tom tom go 510Tom tom go 510
Tom tom go 510
 
2013 Jean Fares Couture collection look book
2013 Jean Fares Couture collection look book2013 Jean Fares Couture collection look book
2013 Jean Fares Couture collection look book
 
MSS Business Integration Practice Ibm Web Sphere
MSS Business Integration Practice   Ibm Web SphereMSS Business Integration Practice   Ibm Web Sphere
MSS Business Integration Practice Ibm Web Sphere
 
Before and after decorating our new home
Before and after decorating our new homeBefore and after decorating our new home
Before and after decorating our new home
 
Iso dinkes
Iso dinkesIso dinkes
Iso dinkes
 

Similar to Quick and Dirty Python Deployments with Heroku

Heroku 101 py con 2015 - David Gouldin
Heroku 101   py con 2015 - David GouldinHeroku 101   py con 2015 - David Gouldin
Heroku 101 py con 2015 - David GouldinHeroku
 
Ruby and Rails Packaging to Production
Ruby and Rails Packaging to ProductionRuby and Rails Packaging to Production
Ruby and Rails Packaging to ProductionFabio Kung
 
Using Nix and Docker as automated deployment solutions
Using Nix and Docker as automated deployment solutionsUsing Nix and Docker as automated deployment solutions
Using Nix and Docker as automated deployment solutionsSander van der Burg
 
Puppet Camp Berlin 2014 Closing Keynote: Next steps for doing more awesome th...
Puppet Camp Berlin 2014 Closing Keynote: Next steps for doing more awesome th...Puppet Camp Berlin 2014 Closing Keynote: Next steps for doing more awesome th...
Puppet Camp Berlin 2014 Closing Keynote: Next steps for doing more awesome th...Puppet
 
Docker in Production: Reality, Not Hype
Docker in Production: Reality, Not HypeDocker in Production: Reality, Not Hype
Docker in Production: Reality, Not Hypebridgetkromhout
 
Prototyping in the cloud
Prototyping in the cloudPrototyping in the cloud
Prototyping in the cloudKirsten Hunter
 
Deploying Symfony | symfony.cat
Deploying Symfony | symfony.catDeploying Symfony | symfony.cat
Deploying Symfony | symfony.catPablo Godel
 
Package a PyApp as a Flatpak Package: An HTTP Server for Example @ PyCon APAC...
Package a PyApp as a Flatpak Package: An HTTP Server for Example @ PyCon APAC...Package a PyApp as a Flatpak Package: An HTTP Server for Example @ PyCon APAC...
Package a PyApp as a Flatpak Package: An HTTP Server for Example @ PyCon APAC...Jian-Hong Pan
 
Deis, a PaaS built with Docker, Docker Meetup Sao Paulo #3 @Wayra
Deis, a PaaS built with Docker,  Docker Meetup Sao Paulo #3 @WayraDeis, a PaaS built with Docker,  Docker Meetup Sao Paulo #3 @Wayra
Deis, a PaaS built with Docker, Docker Meetup Sao Paulo #3 @WayraLeo Lorieri
 
DeveloperWeek 2015: A Practical Introduction to Docker
DeveloperWeek 2015: A Practical Introduction to DockerDeveloperWeek 2015: A Practical Introduction to Docker
DeveloperWeek 2015: A Practical Introduction to DockerSteve Smith
 
AtlasCamp 2015 Docker continuous integration training
AtlasCamp 2015 Docker continuous integration trainingAtlasCamp 2015 Docker continuous integration training
AtlasCamp 2015 Docker continuous integration trainingSteve Smith
 
Scaling Development Environments with Docker
Scaling Development Environments with DockerScaling Development Environments with Docker
Scaling Development Environments with DockerDocker, Inc.
 
OSCONF - April 2021 - Run GitHub Actions Locally with nektos/act and Docker
OSCONF - April 2021 - Run GitHub Actions Locally with nektos/act and DockerOSCONF - April 2021 - Run GitHub Actions Locally with nektos/act and Docker
OSCONF - April 2021 - Run GitHub Actions Locally with nektos/act and DockerGaurav Gahlot
 
How to stay sane during your Vagrant journey
How to stay sane during your Vagrant journeyHow to stay sane during your Vagrant journey
How to stay sane during your Vagrant journeyJakub Wadolowski
 
Puppet Performance Profiling
Puppet Performance ProfilingPuppet Performance Profiling
Puppet Performance Profilingripienaar
 
HipHop VM: overclocking Symfony
HipHop VM: overclocking SymfonyHipHop VM: overclocking Symfony
HipHop VM: overclocking SymfonyVadim Borodavko
 
A Continuous Packaging Pipeline
A Continuous Packaging PipelineA Continuous Packaging Pipeline
A Continuous Packaging PipelineMaciej Pasternacki
 
Optimizing Spring Boot apps for Docker
Optimizing Spring Boot apps for DockerOptimizing Spring Boot apps for Docker
Optimizing Spring Boot apps for DockerGraham Charters
 

Similar to Quick and Dirty Python Deployments with Heroku (20)

Heroku 101 py con 2015 - David Gouldin
Heroku 101   py con 2015 - David GouldinHeroku 101   py con 2015 - David Gouldin
Heroku 101 py con 2015 - David Gouldin
 
Ruby and Rails Packaging to Production
Ruby and Rails Packaging to ProductionRuby and Rails Packaging to Production
Ruby and Rails Packaging to Production
 
Using Nix and Docker as automated deployment solutions
Using Nix and Docker as automated deployment solutionsUsing Nix and Docker as automated deployment solutions
Using Nix and Docker as automated deployment solutions
 
Puppet Camp Berlin 2014 Closing Keynote: Next steps for doing more awesome th...
Puppet Camp Berlin 2014 Closing Keynote: Next steps for doing more awesome th...Puppet Camp Berlin 2014 Closing Keynote: Next steps for doing more awesome th...
Puppet Camp Berlin 2014 Closing Keynote: Next steps for doing more awesome th...
 
Docker in Production: Reality, Not Hype
Docker in Production: Reality, Not HypeDocker in Production: Reality, Not Hype
Docker in Production: Reality, Not Hype
 
Prototyping in the cloud
Prototyping in the cloudPrototyping in the cloud
Prototyping in the cloud
 
Deploying Symfony | symfony.cat
Deploying Symfony | symfony.catDeploying Symfony | symfony.cat
Deploying Symfony | symfony.cat
 
Mojolicious lite
Mojolicious liteMojolicious lite
Mojolicious lite
 
Package a PyApp as a Flatpak Package: An HTTP Server for Example @ PyCon APAC...
Package a PyApp as a Flatpak Package: An HTTP Server for Example @ PyCon APAC...Package a PyApp as a Flatpak Package: An HTTP Server for Example @ PyCon APAC...
Package a PyApp as a Flatpak Package: An HTTP Server for Example @ PyCon APAC...
 
Deis, a PaaS built with Docker, Docker Meetup Sao Paulo #3 @Wayra
Deis, a PaaS built with Docker,  Docker Meetup Sao Paulo #3 @WayraDeis, a PaaS built with Docker,  Docker Meetup Sao Paulo #3 @Wayra
Deis, a PaaS built with Docker, Docker Meetup Sao Paulo #3 @Wayra
 
DeveloperWeek 2015: A Practical Introduction to Docker
DeveloperWeek 2015: A Practical Introduction to DockerDeveloperWeek 2015: A Practical Introduction to Docker
DeveloperWeek 2015: A Practical Introduction to Docker
 
AtlasCamp 2015 Docker continuous integration training
AtlasCamp 2015 Docker continuous integration trainingAtlasCamp 2015 Docker continuous integration training
AtlasCamp 2015 Docker continuous integration training
 
Scaling Development Environments with Docker
Scaling Development Environments with DockerScaling Development Environments with Docker
Scaling Development Environments with Docker
 
OSCONF - April 2021 - Run GitHub Actions Locally with nektos/act and Docker
OSCONF - April 2021 - Run GitHub Actions Locally with nektos/act and DockerOSCONF - April 2021 - Run GitHub Actions Locally with nektos/act and Docker
OSCONF - April 2021 - Run GitHub Actions Locally with nektos/act and Docker
 
How to stay sane during your Vagrant journey
How to stay sane during your Vagrant journeyHow to stay sane during your Vagrant journey
How to stay sane during your Vagrant journey
 
Cloud RPI4 tomcat ARM64
Cloud RPI4 tomcat ARM64Cloud RPI4 tomcat ARM64
Cloud RPI4 tomcat ARM64
 
Puppet Performance Profiling
Puppet Performance ProfilingPuppet Performance Profiling
Puppet Performance Profiling
 
HipHop VM: overclocking Symfony
HipHop VM: overclocking SymfonyHipHop VM: overclocking Symfony
HipHop VM: overclocking Symfony
 
A Continuous Packaging Pipeline
A Continuous Packaging PipelineA Continuous Packaging Pipeline
A Continuous Packaging Pipeline
 
Optimizing Spring Boot apps for Docker
Optimizing Spring Boot apps for DockerOptimizing Spring Boot apps for Docker
Optimizing Spring Boot apps for Docker
 

Recently uploaded

TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024Lonnie McRorey
 
Potential of AI (Generative AI) in Business: Learnings and Insights
Potential of AI (Generative AI) in Business: Learnings and InsightsPotential of AI (Generative AI) in Business: Learnings and Insights
Potential of AI (Generative AI) in Business: Learnings and InsightsRavi Sanghani
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsPixlogix Infotech
 
Emixa Mendix Meetup 11 April 2024 about Mendix Native development
Emixa Mendix Meetup 11 April 2024 about Mendix Native developmentEmixa Mendix Meetup 11 April 2024 about Mendix Native development
Emixa Mendix Meetup 11 April 2024 about Mendix Native developmentPim van der Noll
 
Enhancing User Experience - Exploring the Latest Features of Tallyman Axis Lo...
Enhancing User Experience - Exploring the Latest Features of Tallyman Axis Lo...Enhancing User Experience - Exploring the Latest Features of Tallyman Axis Lo...
Enhancing User Experience - Exploring the Latest Features of Tallyman Axis Lo...Scott Andery
 
Sample pptx for embedding into website for demo
Sample pptx for embedding into website for demoSample pptx for embedding into website for demo
Sample pptx for embedding into website for demoHarshalMandlekar2
 
Assure Ecommerce and Retail Operations Uptime with ThousandEyes
Assure Ecommerce and Retail Operations Uptime with ThousandEyesAssure Ecommerce and Retail Operations Uptime with ThousandEyes
Assure Ecommerce and Retail Operations Uptime with ThousandEyesThousandEyes
 
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024BookNet Canada
 
Connecting the Dots for Information Discovery.pdf
Connecting the Dots for Information Discovery.pdfConnecting the Dots for Information Discovery.pdf
Connecting the Dots for Information Discovery.pdfNeo4j
 
[Webinar] SpiraTest - Setting New Standards in Quality Assurance
[Webinar] SpiraTest - Setting New Standards in Quality Assurance[Webinar] SpiraTest - Setting New Standards in Quality Assurance
[Webinar] SpiraTest - Setting New Standards in Quality AssuranceInflectra
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxLoriGlavin3
 
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24Mark Goldstein
 
Time Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directionsTime Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directionsNathaniel Shimoni
 
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxDigital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxLoriGlavin3
 
A Framework for Development in the AI Age
A Framework for Development in the AI AgeA Framework for Development in the AI Age
A Framework for Development in the AI AgeCprime
 
Generative Artificial Intelligence: How generative AI works.pdf
Generative Artificial Intelligence: How generative AI works.pdfGenerative Artificial Intelligence: How generative AI works.pdf
Generative Artificial Intelligence: How generative AI works.pdfIngrid Airi González
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsSergiu Bodiu
 
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...Wes McKinney
 
Data governance with Unity Catalog Presentation
Data governance with Unity Catalog PresentationData governance with Unity Catalog Presentation
Data governance with Unity Catalog PresentationKnoldus Inc.
 
Testing tools and AI - ideas what to try with some tool examples
Testing tools and AI - ideas what to try with some tool examplesTesting tools and AI - ideas what to try with some tool examples
Testing tools and AI - ideas what to try with some tool examplesKari Kakkonen
 

Recently uploaded (20)

TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024
 
Potential of AI (Generative AI) in Business: Learnings and Insights
Potential of AI (Generative AI) in Business: Learnings and InsightsPotential of AI (Generative AI) in Business: Learnings and Insights
Potential of AI (Generative AI) in Business: Learnings and Insights
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and Cons
 
Emixa Mendix Meetup 11 April 2024 about Mendix Native development
Emixa Mendix Meetup 11 April 2024 about Mendix Native developmentEmixa Mendix Meetup 11 April 2024 about Mendix Native development
Emixa Mendix Meetup 11 April 2024 about Mendix Native development
 
Enhancing User Experience - Exploring the Latest Features of Tallyman Axis Lo...
Enhancing User Experience - Exploring the Latest Features of Tallyman Axis Lo...Enhancing User Experience - Exploring the Latest Features of Tallyman Axis Lo...
Enhancing User Experience - Exploring the Latest Features of Tallyman Axis Lo...
 
Sample pptx for embedding into website for demo
Sample pptx for embedding into website for demoSample pptx for embedding into website for demo
Sample pptx for embedding into website for demo
 
Assure Ecommerce and Retail Operations Uptime with ThousandEyes
Assure Ecommerce and Retail Operations Uptime with ThousandEyesAssure Ecommerce and Retail Operations Uptime with ThousandEyes
Assure Ecommerce and Retail Operations Uptime with ThousandEyes
 
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
 
Connecting the Dots for Information Discovery.pdf
Connecting the Dots for Information Discovery.pdfConnecting the Dots for Information Discovery.pdf
Connecting the Dots for Information Discovery.pdf
 
[Webinar] SpiraTest - Setting New Standards in Quality Assurance
[Webinar] SpiraTest - Setting New Standards in Quality Assurance[Webinar] SpiraTest - Setting New Standards in Quality Assurance
[Webinar] SpiraTest - Setting New Standards in Quality Assurance
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
 
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
 
Time Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directionsTime Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directions
 
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxDigital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
 
A Framework for Development in the AI Age
A Framework for Development in the AI AgeA Framework for Development in the AI Age
A Framework for Development in the AI Age
 
Generative Artificial Intelligence: How generative AI works.pdf
Generative Artificial Intelligence: How generative AI works.pdfGenerative Artificial Intelligence: How generative AI works.pdf
Generative Artificial Intelligence: How generative AI works.pdf
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platforms
 
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
 
Data governance with Unity Catalog Presentation
Data governance with Unity Catalog PresentationData governance with Unity Catalog Presentation
Data governance with Unity Catalog Presentation
 
Testing tools and AI - ideas what to try with some tool examples
Testing tools and AI - ideas what to try with some tool examplesTesting tools and AI - ideas what to try with some tool examples
Testing tools and AI - ideas what to try with some tool examples
 

Quick and Dirty Python Deployments with Heroku

  • 1. Quick and Dirty Python Deployments with Heroku Guest starring Flask, CoffeeScript, Fabric, and SeatGeek Daniel Pritchett for MEMpy, March 19, 2012
  • 3. Requirements • Python 2.7 • virtualenv • pip • Rubygems • Procfile / foreman
  • 4. Get started • Install git, foreman, pip, virtualenv • Clone/create a repo with a Procfile that starts a HTTP service • foreman start to test it locally • heroku create app_name – stack=cedar && git push heroku master
  • 5. Setup log $ virtualenv --no-site-packages heroku_demo New python executable in heroku_demo/bin/python Installing pip...............cdone. $ cd heroku_demo/ $ . bin/activate $ git clone git://github.com/dpritchett/wwebsite-python.git app $ cd app $ pip install -r ./requirements.txt Successfully installed Flask Jinja2 Pygments Werkzeug chardet gunicorn $ foreman start 13:20:18 web.1 | started with pid 17810 13:20:18 web.1 | 2012-03-19 13:20:18 [17810] [INFO] Starting gunicorn 0.14.1 13:20:18 web.1 | 2012-03-19 13:20:18 [17810] [INFO] Listening at: http://0.0.0.0:5000 $ heroku create mempy-demo --stack=cedar Creating mempy-demo... done, stack is cedar http://mempy-demo.herokuapp.com/ | git@heroku.com:mempy-demo.git Git remote heroku added $ git push heroku master Procfile declares types -> web http://mempy-demo.herokuapp.com deployed to Heroku $ curl mempy-demo.herokuapp.com Hello World!
  • 6. Foreman’s Procfile defines the service web: gunicorn app:APP -b 0.0.0.0:$PORT -w 3 You can run the same thing at the console to test: $ gunicorn app:APP -b 0.0.0.0:$PORT -w 3
  • 7. Heroku logging • Captures stdout, stderr • You’ll need it since you have no persistent disk • Simplest case you can just use a print statement • Free plan has limitations • Consider an offsite log manager
  • 8. Remote console $ heroku run bash Running bash attached to terminal... up, run.2 ~ $ find templates templates templates/index.html ~ $ find static static static/js static/js/memphis_tickets.js static/coffee static/coffee/memphis_tickets.coffee static/bootstrap static/bootstrap/js static/bootstrap/js/bootstrap.js ... static/bootstrap/css/bootstrap.css static/css static/css/tickets.css ~ $
  • 9. Sample Flask application: TicketsOfMemphis.com
  • 10.
  • 14. Data provided by SeatGeek API
  • 15. Honorable mention: Fabric $ fab s [localhost] local: coffee -o ../js/ --compile ./*coffee [localhost] local: foreman start 14:11:29 web.1 | started with pid 24218 14:11:29 web.1 | 2012-03-19 14:11:29 [24218] [INFO] Starting gunicorn 0.14.1 14:11:29 web.1 | 2012-03-19 14:11:29 [24218] [INFO] Listening at: http://0.0.0.0:5000 (24218) 14:11:29 web.1 | 2012-03-19 14:11:29 [24218] [INFO] Using worker: sync 14:11:29 web.1 | 2012-03-19 14:11:29 [24225] [INFO] Booting worker with pid: 24225 14:11:29 web.1 | 2012-03-19 14:11:29 [24226] [INFO] Booting worker with pid: 24226 14:11:29 web.1 | 2012-03-19 14:11:29 [24227] [INFO] Booting worker with pid: 24227
  • 17. addons.heroku.com • Databases • Worker hours • Email services • DNS • HTTPS and certificates • Billing • Message/Task Queues
  • 22. Thank you! Try a copy of the code at github.com/dpritchett/wwebsite-python Heroku and Flask have great docs. Find me @dpritchett