flynnの時代 #dockerjp

flynnの時代 #dockerjp

Ecb3acc2d246962361a4f8b3f7a6dd12?s=128

taichi nakashima

July 04, 2014
Tweet

Transcript

  1. The age of flynn

  2. I’m Taichi Nakashima Twitter ID is @deeeet

  3. http://deeeet.com/writing

  4. Yo SOTABLOG

  5. rbdock dmux https://github.com/tcnksm/dmux https://github.com/tcnksm/rbdock - docker + tmux = dmux

    ! - generate Dockerfile for ruby, rails and sinatra cli-init https://github.com/tcnksm/cli-init - TheThe easy way to start building Golang CLI docc https://github.com/tcnksm/docc - docc open your project document
  6. DockerͷԠ༻ྫͷ1ͭͰ͋Δ OSSͷPaaSΛߏங͢Δ͜ͱΛ໨ࢦ͢Flynnͷ঺հ TL;DR

  7. • Dockerʹ͍ͭͯجຊతͳ஌͕ࣝ͋Δ • DockerΛ৮ͬͨ͜ͱ͕͋Δ Assumes

  8. Docker͸͍͢͝ʂͰ΋Docker͚ͩͰ͸ෆे෼ • Dockerͷ࢖͍ํ͸·ͩ·ͩະ஌ͳͱ͜Ζ͕ଟ͍ • Flynnʹ͸Dockerͷ໘ന͍࢖͍ํ͕ͨ͘͞Μ٧·͍ͬͯΔʂ Why flynn at Docker meet

    up ?
  9. • Flynnͱ͸Կ͔ʁ • Flynnͷಛ௃ • FlynnͷΞʔΩςΫνϟʔ • σϞ • ࠓޙͷϩʔυϚοϓ

    Agenda
  10. • DockerΛ࢖ͬͨϚϧνϗετରԠͷPlatform as a Service • Jeff Lindsay (dokkuͷ࡞ऀ) ΍Jonathan

    Rudenberg • Φʔϓϯιʔε & Ϋϥ΢υϑΝϯσΟϯά • Goݴޠ What is flynn ?
  11. Goal of flynn “The product that ops provides to developers”

    • ؆୯͔ͭҰ؏ͨ͠ํ๏ͰσϓϩΠͰ͖Δ • git pushͰ, Docker containerͰ • ͲΜͳݴޠ/ϑϨʔϜϫʔΫͰ΋ಈ͔ͤΔ • ؆୯ʹεέʔϧͰ͖Δ • ৽ͨʹϊʔυΛ௥Ճ͢Δ͚ͩ
  12. dokku (https://github.com/progrium/dokku) • 100ߦఔ౓ͷbashͰॻ͔ΕͨγϯϓϧͳPaaS → flynn͸ϚϧνϗετʹରԠ ! Deis (http://deis.io/) •

    ≒ flynn • CoreOSΛར༻ͨ͠ϚϧνϗετͷDocker PaaS → flynn͸ϗετOSΛݶఆ͠ͳ͍ OSS PaaS by Docker
  13. FlynnͷΞʔΩςΫνϟʔ

  14. FlynnͷΞʔΩςΫνϟ͸γϯϓϧ͔ͭཧղ͠΍͍͢Α ͏ʹσβΠϯ͞Ε͍ͯΔ • ΄΅͢΂ͯͷίϯϙʔωϯτ͕DockerίϯςφͰಈ͘ • ίϯϙʔωϯτͷมߋɾೖΕସ͕͑؆୯ • Heroku΍Apache MesosͳͲͷػೳΛγϯϓϧͳܗͰ࠶࣮૷͍ͯ͠Δ Architecture

    of Flynn
  15. Architecture of Flynn layer0 (The Grid) • ௿ҐͳϦιʔεϑϨʔϜϫʔΫ૚ • FlynnͷશͯͷΞϓϦέʔγϣϯ΍αʔϏεͷجૅ

    • ίϯςφ؅ཧ, αʔϏεσΟεΧόϦʔ, λεΫεέδϡʔϥʔ, ෼ࢄܕKVS layer1 • ߴҐͳίϯϙʔωϯτ૚ • PaaSͷػೳ: Git-receiveɼHeroku BuildpackɼDBɼHTTP Routing • αʔϏε (ΞϓϦέʔγϣϯ)
  16. Layer0

  17. Overview of Layer0 H D flynn/discoverd flynn/flynn-host https://github.com/flynn/discoverd https://github.com/flynn/flynn-host -

    αʔϏεσΟεΧόϦʔ - ίϯςφ؅ཧ
  18. flynn/discoverd D αʔϏεσΟεΧόϦʔ ػೳ • ϗετͷΫϥελͷߏங • ৽ͨͳϗετͷࢀՃ/཭୤Πϕϯτͷଞϗετ΁ͷ௨஌ • ΫϥελͷϦʔμʔͷબग़

    ΫϥΠΞϯτ (flynn/go-discoverd) • Ϋϥελ΁ͷϗετͷొ࿥/࡟আ • ֤ϗετͷΞυϨε΍ϝλ৘ใɼ৽͍͠ϗετͷࢀՃ/཭୤Πϕϯτͷߪಡ όοΫΤϯυ • etcdʢzookeeperʣ
  19. ίϯςφ؅ཧ ػೳ • HTTP APIܦ༝ͰϗετͷDockerίϯςφΛ؅ཧ ໾ׂ • Ϧʔμʔ → ΫϥελશମͷϗετͷҰཡͱͦΕΒ͕࣮ߦ͍ͯ͠Δδϣϒͷ؅ཧ

    → ৽͍͠δϣϒͷొ࿥/ґཔ • ͦͷଞ → Ϧʔμ͔ΒͷδϣϒΛDockerίϯςφͰ࣮ߦ → ࣮ߦதͷδϣϒɼࢦఆ͞Εͨδϣϒͷ৘ใͷฦ౴ flynn/flynn-host D H
  20. ίϯςφ؅ཧ δϣϒ • XͷॲཧΛYͱ͍͏DockerΠϝʔδͷίϯςφ্Ͱ࣮ߦ͢Δ flynn/flynn-host D H S flynn/flynn-host/sampi •

    λεΫεέδϡʔϥϑϨʔϜϫʔΫ • ≒ Apache Mesos
  21. HOST A HOST B HOST C https://flynn.io/blog/demo-roadmap

  22. HOST A HOST B HOST C H H H https://flynn.io/blog/demo-roadmap

  23. HOST A HOST B HOST C H H H D

    D D https://flynn.io/blog/demo-roadmap
  24. HOST A HOST B HOST C H H H D

    D D https://flynn.io/blog/demo-roadmap R
  25. HOST A HOST B HOST C H H H D

    D D S https://flynn.io/blog/demo-roadmap R
  26. HOST A HOST B HOST C H H H D

    D D S https://flynn.io/blog/demo-roadmap R HOST D
  27. HOST A HOST B HOST C H H H D

    D D S https://flynn.io/blog/demo-roadmap R HOST D H D
  28. HOST A HOST B HOST C HOST D H H

    H H D D D D S https://flynn.io/blog/demo-roadmap R
  29. Layer1

  30. Overview of Layer1 G D flynn/flynn-controller flynn/gitreceived https://github.com/flynn/flynn-controller https://github.com/flynn/gitreceived -

    HTTP API αʔό - git pushઐ༻ͷSSHαʔό flynn/slugbuilder https://github.com/flynn/slugbuilder - (Herokuతͳ) slugͷ࡞੒ flynn/slugrunner https://github.com/flynn/slugrunner - (Herokuతͳ) slugͷ࣮ߦ C SB SR
  31. Overview of Layer1 D flynn/strowger flynn/flynn-cli https://github.com/flynn/strowger https://github.com/flynn/flynn-cli - TCP/HTTP

    ϧʔλ - ίϚϯυϥΠϯΫϥΠΞϯτ R flynn/flynn-postgres https://github.com/flynn/flynn-postgres - flynn༻ͷPostgreSQL DB
  32. flynn/flynn-controller D HTTP APIαʔόʔ ػೳ • Flynn্Ͱಈ͘શͯͷΞϓϦέʔγϣϯ (αʔϏε) ΛHTTP APIͰૢ࡞͢Δ

    • ≒ Heroku Platform API ΫϥΠΞϯτ (flynn/flynn-cli) • Controllerʹରͯ͠ίϚϯυΛൃߦ͢Δ • ≒ Heroku Toolbelt D C
  33. flynn/gitreceived D git pushΛ͏͚Δ͜ͱʹಛԽͨ͠SSHαʔό ಈ࡞ 1. git pushʹΑΓΞϓϦέʔγϣϯͷίʔυ͕σϓϩΠ͞ΕΔ 2. ೝূΩʔͱϢʔβ໊ΛҾ਺ʹ`authchecker`εΫϦϓτ(ೝূ)Λ࣮ߦ͢Δ

    3. push͞ΕͨΞϓϦέʔγϣϯͷιʔε (.tar) ΛҾ਺ʹ`receiver`εΫϦϓτΛ࣮ߦ͢Δ D G
  34. flynn/flynn-receive gitreceivedΛ࢖ͬͨϢʔβͷೝূͱΞϓϦέʔγϣϯ ͷϏϧυ+࣮ߦ receiver εΫϦϓτ (flynn-controllerʹରͯ͠ҎԼΛཁ੥) • git push͞ΕͨΞϓϦέʔγϣϯΛslugbuilderʹ౉ͯ͠Ϗϧυ͢Δʢslugͷ࡞੒ʣ •

    ࡞੒͞ΕͨϏϧυΛslugrunnerͰ࣮ߦ͢Δ
  35. flynn/slugbuilder D DockerͱBuildpackͰʢHerokuతͳʣslugͷ࡞੒ Herokuͷ৔߹ • buildpackͰΞϓϦέʔγϣϯͷϏϧυ • ϏϧυΛslugʢSquashFS:ѹॖϑΝΠϧγεςϜʣͱͯ͠อଘ flynnͷ৔߹ •

    Dockerίϯςφ಺ʢΫϦʔϯʂʂʣͰBuildpackΛ࢖ͬͯΞϓέʔγϣϯͷϏϧυ • ϏϧυΛ.tgzܗࣜʹݻΊͯอଘ D SB
  36. flynn/slugbuilder D DockerͱBuildpackͰʢHerokuతͳʣslugͷ࡞੒ D SB $ id=$(git archive master |

    docker run -i -a stdin flynn/slugbuilder) $ docker wait $id $ docker cp $id:/tmp/slug.tgz .
  37. flynn/slugrunner D slugbuilderͰ࡞੒͞ΕͨʢHerokuతͳʣslugͷ࣮ߦ D SR Herokuͷ৔߹ • Dyno (LXCϕʔε)ʹslugΛϩʔυ͢Δ •

    ProcfileΛ΋ͱʹΞϓϦέʔγϣϯΛىಈ͢Δ flynnͷ৔߹ • Dockerίϯςφ಺ʹslug(.tgz)Λϩʔυ͢Δ • ProcfileΛ΋ͱʹΞϓϦέʔγϣϯ (Dockerίϯςφ) Λىಈ͢Δ
  38. flynn/slugrunner D slugbuilderͰ࡞੒͞ΕͨʢHerokuతͳʣslugͷ࣮ߦ D SR $ cat myslug.tgz | docker

    run -i -a stdin -a stdout flynn/slugrunner start web
  39. flynn/strowger D TCP/HTTP ϧʔλ ػೳ • ϥϯμϜϩʔυόϥϯγϯάͷͨΊͷϦόʔεϓϩΩγͱͯ͠ಈ࡞ e.g., ෳ਺ͷslugrunnerʹରͯ͠ϥϯμϜʹϦΫΤετΛৼΓ෼͚Δ •

    αʔϏεσΟεΧόϦʔʹΑΓόοΫΤϯυͰԿ͕ىಈ͔ͨ͠Λৗʹ؂ࢹ vs. HAProxy/nginx • αʔϏεσΟεΧόϦʔʹΑΔಈతͳઃఆมߋ͕Մೳ • HAProxy΍nginx͸ઃఆߋ৽ͷͨΊʹ৽͍͠ϓϩηε͕ඞཁʹͳΔ D R
  40. HOST A HOST B HOST C HOST D H H

    H H D D D D S https://flynn.io/blog/demo-roadmap
  41. HOST A HOST B HOST C HOST D H H

    H H D D D D S https://flynn.io/blog/demo-roadmap G port 22
  42. HOST A HOST B HOST C HOST D H H

    H H D D D D S https://flynn.io/blog/demo-roadmap G port 22 C
  43. HOST A HOST B HOST C HOST D H H

    H H D D D D S https://flynn.io/blog/demo-roadmap G port 22 C SB
  44. HOST A HOST B HOST C HOST D H H

    H H D D D D S https://flynn.io/blog/demo-roadmap G port 22 C SB SR
  45. HOST A HOST B HOST C HOST D H H

    H H D D D D S https://flynn.io/blog/demo-roadmap G port 22 C SB SR R
  46. HOST A HOST B HOST C HOST D H H

    H H D D D D S https://flynn.io/blog/demo-roadmap G port 22 C SB SR R port 80/443
  47. HOST A HOST B HOST C HOST D H H

    H H D D D D S https://flynn.io/blog/demo-roadmap G port 22 C SB SR R port 80/443 DB
  48. HOST A HOST B HOST C HOST D H H

    H H D D D D S https://flynn.io/blog/demo-roadmap G port 22 C SB SR R port 80/443 DB SR
  49. HOST A HOST B HOST C HOST D H H

    H H D D D D S https://flynn.io/blog/demo-roadmap G port 22 C SB SR R port 80/443 DB SR SR
  50. Demo

  51. https://flynn.cupcake.io

  52. None
  53. Flynnͷࠓޙ

  54. Production؀ڥͰ҆ఆͯ͠ಈ࡞ͤ͞Δ͜ͱΛ࠷༏ઌ • ਺िؒҎ಺ʹFlynn Beta (ࣾ಺؀ڥ޲͚) ΛϦϦʔε • ՆͷऴΘΓʹFlynn 1.0ΛϦϦʔε Roadmap

    of flynn ༧ఆ (2014.07)
  55. "Container Indepnedence” - FlynnͷϢʔβ͸Docker Inc΍ଞͷاۀʹ݁ͼ͚ͭΒΕΔ΂͖Ͱ͸ͳ͍ Future of flynn • DockerҎ֎ͷίϯςφ؅ཧιϑτͰDocker

    ImageΛར༻͢Δπʔϧ • systemd+nspawn, LXC, libvirt-lxc, Lmctfy, OpenVZ flynn/pinkerton
  56. References • Flynn - Open source Platform as a Service

    powered by Docker • https://flynn.io/ • The Start of the Age of Flynn • http://progrium.com/blog/2014/02/06/the-start-of-the-age-of-flynn/ • Unveiling Flynn, a new PAAS based on Docker • http://jpetazzo.github.io/2013/11/17/flynn-docker-paas/ • 5by5 | The Changelog #99: Flynn, Tent, open source PaaSes and more with Jeff Lindsay and Jonathan Rudenberg • http://5by5.tv/changelog/99 • 5by5 | The Changelog #115: Flynn updates with Jonathan Rudenberg and Jeff Lindsay • http://5by5.tv/changelog/115
  57. References • Container Independence • https://flynn.io/blog/container-indepedence • Deis: Evolution of

    a Docker PAAS • http://gabrtv.github.io/deis-dockercon-2014/#/ • Flynn vs. Deis: The Tale of Two Docker Micro-PaaS Technologies | CenturyLink Labs • http://www.centurylinklabs.com/flynn-vs-deis-the-tale-of-two-docker-micro-paas- technologies/ • Inside Dokku in 5 minutes • http://banyan.me/slides/20140116/slides.html
  58. References • Discoverd - r7km/s • http://r7kamura.github.io/2014/06/24/discoverd.html • Flynn Host

    - r7km/s • http://r7kamura.github.io/2014/06/26/flynn-host.html • Beyond Flynn, or Flynn-as-a-Worldview • http://progrium.com/blog/2014/07/01/beyond-flynn-or-flynn-as-a-worldview/