Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Running container at BlaBlaCar — While 42 (San-Francisco)

Running container at BlaBlaCar — While 42 (San-Francisco)

Meetup While42 in San-Francisco

Matthieu Moquet

April 06, 2016
Tweet

More Decks by Matthieu Moquet

Other Decks in Technology

Transcript

  1. Running containers at
    #While42 (San-Francisco)

    View full-size slide

  2. $100
    $25
    $25 $25 $25

    View full-size slide

  3. 25 million
    members in January 2016

    View full-size slide

  4. 22 countries

    View full-size slide

  5. 20M
    40M
    80M
    160M
    129M
    2014 2015 2016 2017
    Travelers
    transported
    2014

    View full-size slide

  6. metal servers
    services
    run. containers
    120
    150+
    2000+

    View full-size slide

  7. github.com/coreos/rkt

    View full-size slide

  8. $ (sudo) rkt run ./image.aci
    Archive of filesystem
    & instructions of
    what to run
    Foreground process
    Require root

    View full-size slide

  9. $ rkt run example.org/image.aci
    Fetch the image first
    and then run it

    View full-size slide

  10. How to build an ACI?

    View full-size slide

  11. App Container (appc)
    Open specification that defines several aspects
    of how to run applications in containers

    View full-size slide

  12. Pronounced « digg-er »
    github.com/blablacar/dgr

    View full-size slide

  13. ├── aci-manifest.yml
    ├── attributes
    │ └── redis.yml
    ├── runlevels
    │ └── build
    │ └── install.sh
    └── templates
    └── etc
    └── redis
    └── redis.conf.tmpl

    View full-size slide

  14. name: aci-redis
    aci:
    app:
    exec:
    - /usr/bin/redis-server
    - /etc/redis/redis.conf

    View full-size slide

  15. name: aci-redis
    aci:
    app:
    exec:
    - /usr/bin/redis-server
    - /etc/redis/redis.conf
    dependencies:
    - aci-debian
    Not included in
    redis image

    View full-size slide

  16. Runlevel: Build

    View full-size slide

  17. ├── aci-manifest.yml
    ├── attributes
    │ └── redis.yml
    ├── runlevels
    │ └── build
    │ └── install.sh
    └── templates
    └── etc
    └── redis
    └── redis.conf.tmpl

    View full-size slide

  18. #!/bin/bash
    apt install -y redis-server

    View full-size slide

  19. Runlevel: Prestart

    View full-size slide

  20. Dump configuration files
    Initialize database/user
    Enable/Disable modules
    Change mod/owner

    View full-size slide

  21. ├── aci-manifest.yml
    ├── attributes
    │ └── redis.yml
    ├── runlevels
    │ └── build
    │ └── install.sh
    └── templates
    └── etc
    └── redis
    └── redis.conf.tmpl

    View full-size slide

  22. # templates/etc/redis/redis.conf.tmpl
    daemonize no
    port {{ .redis.port }}
    ...
    # attributes/redis.yml
    default:
    redis:
    port: 6379
    Resolved at
    runtime

    View full-size slide

  23. POD
    Running several ACIs
    in the same context

    View full-size slide

  24. name: example.org/pod-myapp:1
    pod:
    apps:
    - dependencies:
    - example.org/aci-nginx:1.8.1
    app:
    exec: [/usr/sbin/nginx, -g, daemon off]
    - dependencies:
    - example.org/aci-php:5.6
    - example.org/aci-myapp:42
    app:
    exec: [/usr/sbin/php5-fpm, -F]

    View full-size slide

  25. $ rkt run \
    example.org/pod-myapp_aci-nginx:1 \
    example.org/pod-myapp_aci-php:1

    View full-size slide

  26. pod-myapp_aci-nginx
    pod-myapp_aci-php
    Linux kernel
    other process
    ...
    1.2.3.4
    172.16.8.8
    :80
    :9000

    View full-size slide

  27. Services discovery with
    smartstack
    synapse + nerve
    by Airbnb

    View full-size slide

  28. Zookeeper
    haproxy
    php
    healtcheck
    mysql
    client
    server

    View full-size slide

  29. Thank you!
    @BlaBlaCarTech
    @MattKetmo
    blablatech.com

    View full-size slide