Slide 1

Slide 1 text

HEROKU IN FIVE MINUTES BattleHack Venice 2015

Slide 2

Slide 2 text

No content

Slide 3

Slide 3 text

Platform-as-a-Service

Slide 4

Slide 4 text

No content

Slide 5

Slide 5 text

Sign up for free at heroku.com!

Slide 6

Slide 6 text

FAST AND EASY DEPLOYS Sync from Dropbox, GitHub, or the code on your computer.

Slide 7

Slide 7 text

Demo

Slide 8

Slide 8 text

No content

Slide 9

Slide 9 text

No content

Slide 10

Slide 10 text

FORKING APPS $  heroku  fork  -­‐-­‐from  sourceapp  -­‐-­‐to  targetapp   Creating  fork  targetapp...  done   Copying  slug...  done   Adding  heroku-­‐postgresql:dev...  done   Creating  database  backup  from  sourcapp...  ..  done   Restoring  database  backup  to  targetapp...  ..  done   Copying  config  vars...  done   Fork  complete,  view  it  at  http://targetapp.herokuapp.com/

Slide 11

Slide 11 text

“The Twelve-Factor App”

Slide 12

Slide 12 text

12factor.net

Slide 13

Slide 13 text

II. DEPENDENCIES Applications have explicitly declared dependencies.

Slide 14

Slide 14 text

II. DEPENDENCIES Applications have explicitly declared dependencies. $  cat  composer.json   {      "require":  {          "php":  ">=5.3.3",          "ext-­‐mcrypt":  "*",          "symfony/symfony":  "~2.4.6",          "twig/extensions":  "~1.0",          "symfony/monolog-­‐bundle":  "~2.4"      }   } $  cat  package.json   {      "dependencies":  {          "express":  "~4.9.x",          "cool-­‐ascii-­‐faces":  "~1.3.x"      },      "engines":  {          "node":  "0.10.x"      }   }

Slide 15

Slide 15 text

do not check your dependencies into Git

Slide 16

Slide 16 text

III. CONFIGURATION Store config in the environment.

Slide 17

Slide 17 text

III. CONFIGURATION Store config in the environment. Assumption: same code but different configuration per deployment target

Slide 18

Slide 18 text

III. CONFIGURATION Store config in the environment. $smtp  =  parse_url(getenv('SMTP_GATEWAY_URL'));   $transport  =  Swift_SmtpTransport::newInstance(
        $smtp['host'],  $smtp['port']
 )
        -­‐>setUsername($smtp['user'])
        -­‐>setPassword($smtp['pass'])
 ; Assumption: same code but different configuration per deployment target $  heroku  config:set  SMTP_GATEWAY_URL=\   smtp://joecool:itwasadarkandstormynight@smtp.blah.com:827

Slide 19

Slide 19 text

do not hardcode config vars, they might change suddenly!

Slide 20

Slide 20 text

VI. PROCESSES heroku-­‐python-­‐app  $  cat  Procfile   worker:  python  worker.py   web:  gunicorn  hello:app heroku-­‐node-­‐app  $  cat  Procfile   worker:  node  worker.js   web:  node  index.js heroku-­‐ruby-­‐app  $  cat  Procfile   worker:  env  TERM_CHILD=1  bundle  exec  rake  resque:work   web:  bundle  exec  unicorn  -­‐p  $PORT  -­‐c  ./config/unicorn.rb heroku-­‐php-­‐app  $  cat  Procfile   worker:  php  background.php   web:  vendor/bin/heroku-­‐php-­‐apache2  #  or  heroku-­‐php-­‐nginx

Slide 21

Slide 21 text

SCALING

Slide 22

Slide 22 text

SCALING $  heroku  ps:scale  web=5   Scaling  dynos...  done,  now  running  web  at  5:1X.   $  heroku  ps   ===  web  (1X):  `bundle  exec  unicorn  -­‐p  $PORT`   web.1:  starting  2014/11/05  20:36:39  (~  4s  ago)   web.2:  starting  2014/11/05  20:36:39  (~  4s  ago)   web.3:  starting  2014/11/05  20:36:39  (~  4s  ago)   web.4:  starting  2014/11/05  20:36:38  (~  4s  ago)   web.5:  starting  2014/11/05  20:36:38  (~  4s  ago)   ===  worker  (Free):  `bundle  exec  stalk  worker.rb`   worker.1:  up  for  1m   $  heroku  ps:scale  web=1   Scaling  dynos...  done,  now  running  web  at  1:1X.

Slide 23

Slide 23 text

No content

Slide 24

Slide 24 text

Demo

Slide 25

Slide 25 text

ADD-ONS

Slide 26

Slide 26 text

your app needs a relational database

Slide 27

Slide 27 text

your app needs a document database

Slide 28

Slide 28 text

your app needs an email gateway

Slide 29

Slide 29 text

your app needs a search engine

Slide 30

Slide 30 text

your app needs an analytics engine

Slide 31

Slide 31 text

your app needs a log storage

Slide 32

Slide 32 text

your app needs... add-ons!

Slide 33

Slide 33 text

$  heroku  addons:create  heroku-­‐postgresql

Slide 34

Slide 34 text

$  heroku  addons:create  heroku-­‐redis

Slide 35

Slide 35 text

$  heroku  addons:create  mongolab

Slide 36

Slide 36 text

$  heroku  addons:create  memcachier

Slide 37

Slide 37 text

$  heroku  addons:create  foundelasticsearch

Slide 38

Slide 38 text

$  heroku  addons:create  cloudamqp

Slide 39

Slide 39 text

$  heroku  addons:create  papertrail

Slide 40

Slide 40 text

$  heroku  addons:create  newrelic

Slide 41

Slide 41 text

$  heroku  addons:create  sendgrid

Slide 42

Slide 42 text

$  heroku  addons:create  pusher

Slide 43

Slide 43 text

150+ ADD-ONS, USE THEM! http://elements.heroku.com/

Slide 44

Slide 44 text

Demo

Slide 45

Slide 45 text

GOOD LUCK!

Slide 46

Slide 46 text

No content

Slide 47

Slide 47 text

xkcd.com/323

Slide 48

Slide 48 text

No content

Slide 49

Slide 49 text

The End

Slide 50

Slide 50 text

THANK YOU FOR LISTENING! Questions? Ask me: @dzuelke & dz@heroku.com