Slide 1

Slide 1 text

Building  Applications With  Docker

Slide 2

Slide 2 text

Cloud  Computing  Lingo

Slide 3

Slide 3 text

No content

Slide 4

Slide 4 text

Project  Infrastructures

Slide 5

Slide 5 text

Traditional  single-­‐tenant  application

Slide 6

Slide 6 text

Traditional  multi-­‐tenant  application

Slide 7

Slide 7 text

Docker multi-­‐tenant  application

Slide 8

Slide 8 text

Containers

Slide 9

Slide 9 text

Problem:  hay  from  field  to  bakery ???

Slide 10

Slide 10 text

No content

Slide 11

Slide 11 text

No content

Slide 12

Slide 12 text

No content

Slide 13

Slide 13 text

Problem:  code  from  DEV  to  PRD manual  setup (-­‐) nearly  impossible  to  replicate  environments scripted  setup (+) +/-­‐ easy  to  replicate  environments (-­‐) knowlegderequired  about  what  is  inside  to   create  the  scripts containers (+) very  easy  to  replicate  (just  drop  it  into  place) (+) no  knowlegderequired  about  what  is  inside

Slide 14

Slide 14 text

Docker

Slide 15

Slide 15 text

No content

Slide 16

Slide 16 text

No content

Slide 17

Slide 17 text

Build: #  docker build  -­‐t  trescst/phprodemo . Ship:   #  docker push  trescst/phprodemo Run:   #  docker run  -­‐d  trescst/phprodemo

Slide 18

Slide 18 text

Demo

Slide 19

Slide 19 text

Twelve  Factor  App

Slide 20

Slide 20 text

1 Codebase

Slide 21

Slide 21 text

2  Dependencies • Explicitly declare  and  isolate  dependencies • Composer  json +  lock  file • Bower  /  NPM  /  Bundle

Slide 22

Slide 22 text

3  Config • Store  config in  the  environment  variables • Never  group  configuration  in  “environments” • Each  env var is  independently  managed  for  each  deploy • Easy  upscaling

Slide 23

Slide 23 text

4  Backing  services

Slide 24

Slide 24 text

5  Build,  release,  run

Slide 25

Slide 25 text

6  Process • Execute  the  app  as  one  or  more  stateless  processes • Share  nothing • Data  must  be  stored  in  statefull backing  services

Slide 26

Slide 26 text

7.  Port  binding • Include  an  HTTP  server • Export  services  via  port  binding • Add  a  routing  layer  for  mapping  the  port  to  a  subdomain • The  services  can  communicate  over  containers  by  port

Slide 27

Slide 27 text

8  Concurrency • Scale  out  via  the  process  model • Nothing  is  shared • Reliable  and  easy

Slide 28

Slide 28 text

9  Disposability • All  processes  can  be  stopped  /  started  at  any  time. • Minimum  startup  time • Gracefull shutdown  in  SIGTERM • Maximum  robustness • Fast  deploys

Slide 29

Slide 29 text

10  Dev/prod  parity • Keep  development,  staging,  and  production  as  similar  as  possible Traditional  app Twelve-­‐factor  app Time  between  deploys Weeks Hours Code  authors  vs  code  deployes Different  people Same  people Dev  vs  production  environments Divergent As  similar  as  possible

Slide 30

Slide 30 text

11  Logs • Treat  logs  as  event  streams • Always  send  logs  to  the  output  stream • Never  concern  about  storage  of  the  output • Storage  is  handled  by  the  executing  environment.

Slide 31

Slide 31 text

monolog: handlers: docker: type:  stream path:  "php://stdout" level:  debug formatter:  monolog.formatter.logstash

Slide 32

Slide 32 text

CloudWatch Lambda ElastiCache

Slide 33

Slide 33 text

12  Admin  processes • Run  management  tasks  as  one-­‐off  processes • CLI  scripts • Migrations

Slide 34

Slide 34 text

Demo

Slide 35

Slide 35 text

Any  questions?!