Heroku Tour

Marco Alabruzzo

http://marcoala.com

 London Django Meetup Group

Web Developer - Growth Street

marco.alabruzzo@gmail.com

19 January 2016

What is Heroku?

Heroku is a cheap and convenient way to host your web application, is easy to start and is scalable.

The hosting problem

Money

Time

 

The hosting problem

A cheaper and easier solution to host application mean a smaller initial investment approaching django.

 

Platform vs Infrastructure

Platform-as-a-service

Infrastructure-as-a-service

vs

software-as-a-service

It’s a delivery model where instead of delivering a software we deliver the service that the software offer.

The advantage for the user is that he doesn't need to do any kind of maintenance or specific hardware.

Infrastructure-as-a-service

Computing resources over the internet.

Choose OS, manage users, manage SSH key, configure a firewall, install a database etc.

Platform-as-a-service

Computing resources over the internet.

Everything is already installed and ready for deploy your application, and is also kept up-to-date.

Infrastructure and operations are handled for you.

SAAS

PAAS

IAAS

Hotel

Furnished

Unfurnished

When I should not use heroku

When you need a particular control over your machine

hardware requirment

other software

storage on the same machine 

When you have already have system administrators and/or dev ops

Dynos

A lightweight Linux container that runs a single user-specified command

Dynos

Procfile

web: gunicorn myproject.wsgi --log-file -

Dynos

Web

Worker

One-off

Dynos

heroku ps:scale web=2
heroku ps:scale web+1
heroku ps:scale web=3 worker=1

Web

Worker

Add-ons

They add services functionalities to your application with no or minimal configuration.

They can be internal heroku services or integration with third party application.

Add-ons

Heroku Postgre

Amazon S3

New Relic

RabbitMQ

Mandrill

Scheduler

SSL

Gemfury

150+ add-ons

BUILDPACK

Buildpacks are collection of OS level dependencies

BUILDPACK

The default of the heroku’s dynos, the Cedar stack, does not support any kind of programming languages. Languages are added through a buildpack.

Heroku maintain a set of language specific buildpacks: Ruby, Node.js, Clojure, Python, Java, Grandle, Grails, Scala, Play, PHP, Go.

BUILDPACK

If some specific dependencies are needed is possible to try to find a third party managed buildpack or build our own.

BUILDPACK

A buildpack can be just a combination of other buildpacks.

Deploy process and Releases

Deploy process and Releases

The buildpack create the environment (a build version of the buildpack).

Buildpack

Environment

Deploy process and Releases

The application slug is added to the environment (compressed and pre-packaged copy of your application).

Slug

Environment

Deploy process and Releases

Addons are added.

Slug

Database (addon)

Environment

Deploy process and Releases

Addons are added.

Slug

Database (addon)

Addons

Environment

Deploy process and Releases

Configuration is added

Slug

Database (addon)

Addons

Configuration

Environment

Deploy process and Releases

A new release object has been created!

Deploy process and Releases

Releases are immutable so is always possible to rollback and forward between releases.

release 1

release 2

release 3

release 4

release 5

caveats of the Paas

Where do I put my static files?

Bucketeer

caveats of the Paas

How can I upload and store files?

Direct to S3 File Uploads in Python

https://devcenter.heroku.com/articles/s3-upload-python

The twelve-factor application 

The twelve-factor methodology can be applied to apps written in any programming language, and which use any combination of backing services (database, queue, memory cache, etc).

The twelve-factor application 

Advantage of a 12 factor application:

Maximum portability 

cloud platforms

development/production

scale up 

The twelve-factor application 

I. Codebase
II. Dependencies
III. Config
IV. Backing Services
V. Build, release, run
VI. Processes

VII. Port binding
VIII. Concurrency
IX. Disposability
X. Dev/prod parity
XI. Logs
XII. Admin processes

The twelve-factor application 

Thank you

Question and feedback

marco.alabruzzo@gmail.com

Made with Slides.com