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

Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Patryk Bandurski
 
costume and set research powerpoint presentation
costume and set research powerpoint presentationcostume and set research powerpoint presentation
costume and set research powerpoint presentationphoebematthew05
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Mark Simos
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 3652toLead Limited
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Mattias Andersson
 
Bluetooth Controlled Car with Arduino.pdf
Bluetooth Controlled Car with Arduino.pdfBluetooth Controlled Car with Arduino.pdf
Bluetooth Controlled Car with Arduino.pdfngoud9212
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitecturePixlogix Infotech
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesSinan KOZAK
 
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Wonjun Hwang
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsRizwan Syed
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024Lorenzo Miniero
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfAlex Barbosa Coqueiro
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebUiPathCommunity
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...Fwdays
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Commit University
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...shyamraj55
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii SoldatenkoFwdays
 

Recently uploaded (20)

Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
 
costume and set research powerpoint presentation
costume and set research powerpoint presentationcostume and set research powerpoint presentation
costume and set research powerpoint presentation
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?
 
Bluetooth Controlled Car with Arduino.pdf
Bluetooth Controlled Car with Arduino.pdfBluetooth Controlled Car with Arduino.pdf
Bluetooth Controlled Car with Arduino.pdf
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC Architecture
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen Frames
 
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL Certs
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdf
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio Web
 
DMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special EditionDMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special Edition
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
 
Hot Sexy call girls in Panjabi Bagh 🔝 9953056974 🔝 Delhi escort Service
Hot Sexy call girls in Panjabi Bagh 🔝 9953056974 🔝 Delhi escort ServiceHot Sexy call girls in Panjabi Bagh 🔝 9953056974 🔝 Delhi escort Service
Hot Sexy call girls in Panjabi Bagh 🔝 9953056974 🔝 Delhi escort Service
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko
 
Vulnerability_Management_GRC_by Sohang Sengupta.pptx
Vulnerability_Management_GRC_by Sohang Sengupta.pptxVulnerability_Management_GRC_by Sohang Sengupta.pptx
Vulnerability_Management_GRC_by Sohang Sengupta.pptx
 

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