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

on-premises-cloud-and-docker

 on-premises-cloud-and-docker

Hatena Engineer Seminar #3 @ Tokyo

Yuuki Tsubouchi (yuuk1)

December 02, 2014
Tweet

More Decks by Yuuki Tsubouchi (yuuk1)

Other Decks in Technology

Transcript

  1. %BUB$FOUFS "84 ࣗ࡞ αʔό 9FO ϕϯμ αʔό &$ 4 $MPVE'SPOU

    3PVUF -74LFFQBMJWFE (MBJDJFS 71$ &-# )"1SPYZ .PHJMF'4 "LBNBJ
  2. DC ͱ AWS • DCͰ Xen ࢖ͬͯͨΓ͢Δͱ AWS ͷ಺෦ΛͳΜͱͳ͘༧૝ Ͱ͖ͨΓ͢Δ

    • ͳΜ͔ϩʔυόϥϯαͷεϧʔϓοτͰͳ͍ → ϋΠύʔ όΠβଆͰ nf_conntrack ᷓΕٙ࿭ • ΠϯελϯελΠϓ͝ͱʹ state ਺ͷ্ݶҧ͏ٙ࿭ • Domain 0ಉډΠϯελϯε • ΞΫςΟϒɾελϯόΠ2୆ͱ΋ಉډͰ࢒೦ • Ϧιʔεͷ৯͍߹͍ (CPU %steal)
  3. Dev ͱ Ops • αʔόͬΆ͍͜ͱʢσϓϩΠΑΓԼʣ͸͍͍ͩͨ Ops • Ξϥʔτ͸ Dev ΋ड͚ͱΔ

    • Dev ͱ Ops ͕ڠྗͯ͠ো֐ରԠ • DevνʔϜͷmeetingʹ΋ఆظతʹࢀՃ • Ops ͸ GHE ͷ issue ΋ΈΔ (ઃఆม͑Δͱ͖͸PR) • ༵ۚϦϦʔε͸͠ͳ͍ • ஈ֊తͳϦϦʔε
  4. DC؀ڥͱAWS؀ڥͷڞ௨Խ • αʔόߏ੒؅ཧ Chef ✓ • ωοτϫʔΫ(VPC + VPN) ✓

    • αʔό؅ཧ/ϞχλϦϯάπʔϧ (Mackerel) ✓ • ؂ࢹ(Nagios) ✓ • ϑΣΠϧΦʔό ✘ • Chef ద༻લͷOSΠϝʔδ(Packer) ✘
  5. Dev ͱ Ops ͷίϛϡχέʔγϣϯ • Dev ͔Β Ops ʹϗετߏஙΛґཔ •

    ຊ൪ʹ Redis ͕ͳͯ͘ࣄނ • Dev ͔Β Ops ʹ Jenkins ϗετʹඞཁͳύοέʔ δΛΠϯετʔϧґཔ • ޓ͍ʹ໘౗ • ΄͍͠ਓͱ༻ҙ͢Δਓ͕ҟͳΔͷ͕໰୊ • ͦ΋ͦ΋ Dev ͕ϗετߏங͠΍͍͢؀ڥ͕Α͍
  6. It is Not Docker • VMͱ͔ੜLXC Έ͍ͨʹϩάΠϯͯ͠ੜ׆͢Δ ΋ͷͰ͸ͳ͍ • Linuxίϯςφ

    ≠ Docker • Docker ͸ಛผɺେن໛؀ڥ޲͚ͱ͍͏Θ͚Ͱ ͸ͳ͍
  7. It is Docker • Linux ͷϢʔβϥϯυ؀ڥΛؙ͝ͱΠϝʔδԽ • ΞϓϦέʔγϣϯ͝ͱʹίϯςφԽ • ls

    ίϚϯυ͚ͩͷ Docker ίϯςφͱ͔ • Dockerίϯςφͷ࣮ମ͸ͨͩͷOSͷϓϩηε • Χʔωϧ಺෦Ͱִ཭͞ΕͯΔ
  8. $ docker run -d mysql:5.5 $ docker run -d mysql:5.6

    $ docker run -d mysql:5.7 It is Docker
  9. DockerͰͳʹ͕Ͱ͖Δ͔ • DC ؀ڥ ͱ Ϋϥ΢υ؀ڥͷڞ௨Խ • DCͱΫϥ΢υͰಉ͡ Docker image

    ͕ಈ͘ • αʔϏεͷ੝ਰʹซͤͯɺDC <=> Ϋϥ΢υ • Dev ͱ Ops ͷίϛϡχέʔγϣϯ • Dev ΤϯδχΞ͕ඞཁͳΞϓϦέʔγϣϯͷ Dockerfile Λॻ͍ͯɺOps ΤϯδχΞ͕ϨϏϡʔͯ͠ ͦͷ··σϓϩΠ • ΄͍͠ਓ͕४උ͠΍͍͢
  10. Docker͕ؔΘΔྖҬ͸ଟ͍ • ΞϓϦέʔγϣϯσϓϩΠ • ϩʔΧϧ؀ڥ͔Β CI Λܦ༝ͯ͠ຊ൪·Ͱ • ߏ੒؅ཧπʔϧʢChef, Puppet…)

    • Docker ࣌୅ͷαʔόϞχλϦϯά • Docker ࣌୅ͷϩάऩू • LinuxΧʔωϧ • LinuxίϯςφɺAUFS ͳͲ
  11. ΞϓϦέʔγϣϯσϓϩΠ • શͯͷ؀ڥͰಉ͡ Docker image Λ࢖Θͳ͍ͱ ϝϦοτ͕ബ͍ • ϩʔΧϧ؀ڥɺ։ൃ؀ڥɺstaging؀ڥɺCI؀ ڥɺຊ൪؀ڥ

    • ෦෼తʹಋೖ͢Δͱ Docker ؀ڥͱ௨ৗͷ؀ ڥΛ྆ํϝϯς͠ͳ͍ͱ͍͚ͳ͘ͳΔ • ։ൃνʔϜͷΤϯδχΞશһ+σβΠφʔ΋ Docker؀ڥͰ։ൃ͢Δ͜ͱʹͳΔ
  12. Graphite ☓ Docker • Graphite ͷΑ͏ͳ؀ڥߏங͕໘౗ͳ΋ͷ͸ Docker ͰϩʔΧϧ؀ڥͱCI؀ڥΛߏங • https://registry.hub.docker.com/u/mackerel/graphite/

    EPDLFSSVOEOBNFHSBQIJUFWUNQMPHWBSMPHHSBQIJUFW UNQXIJTQFSWBSMJCHSBQIJUFTUPSBHFXIJTQFSQQ QNBDLFSFMHSBQIJUF
  13. Docker ͷӡ༻ • Docker ࣗମͷτϥϒϧγϡʔςΟϯά • ಥવDNSҾ͚ͳ͘ͳΔ • ΰϛ૟আ (଺ཹ͢Δίϯςφ)

    • ϚϧνϗετσϓϩΠ • ΦʔέετϨʔγϣϯπʔϧԿΛ࢖͏͔ • Kubernetes, fleet, Consul, … • DNSͰσΟεΧόϦͨ͘͠ͳ͍ • Docker ίϯςφͷωοτϫʔΫߏ੒ • ϗετଆͱϑϥοτ or NAPT • ໰୊ௐࠪͷํ๏ͷཱ֬ • ssh ͰϩάΠϯͱ͍͏ੈքͰ͸ͳ͍ (docker exec /bin/bash)
  14. Ϋϥ΢υαʔϏε • AWS EC2 Container Service • Google Container Engine

    ! • Dockerͷӡ༻Λશ෦೚ͤΒΕΔ • AWS <-> Google ΋Մ
  15. ઐ༻αʔό • શͯͷαʔϏεΛΫϥ΢υʹͷͤΔͱߴ͍ • ωοτϫʔΫ&ϋʔυ΢ΣΞ؅ཧΛΦϑϩʔυͭ͠ ্͕ͭ҆Γ • Xen ͰԾ૝Խͤͣʹɺ෺ཧϋʔυͷ্ʹίϯςφ •

    Docker ͳΒ Ϋϥ΢υ 㱻 ΦϯϓϨϛεͷҠಈ͕΍ Γ΍͍͢ • ৽αʔϏε͸શ෦Ϋϥ΢υ -> ྲྀߦΒͳ͔ͬͨΒ ઐ༻αʔό؀ڥ΁ୀආ ͷΑ͏ͳઓུ͕ͱΓ΍͍͢
  16. ͦΕͰ΋·ͩෆ҆ • ࠓ೔ॻ͍ͨ Dockerfile ͸ 1 ೥ޙಈ͔ͳ͍Մೳੑ (DockerfileࣗମͰόʔδϣϯݻఆͱ͔Ͱ͖ΔΘ ͚Ͱ͸ͳ͍) •

    Docker image Λޙੜେࣄʹ͓࣋ͬͯ͘ඞཁ ͕͋Δ • ࠓ೔࡞ͬͨ Docker image ͕1೥ޙͷDocker runtimeͰಈ͔͘Ͳ͏͔
  17. ɾΞϧόΠτ࣌୅: ࣾ಺Mackerel։ൃ(Perl) (YAPC Asia) ɾೖࣾ: EC2Ͱ HAProxy νϡʔχϯά http://yuuki.hatenablog.com/entry/2014/03/20/085600 ɾXen,

    LVS(keepalived), Chef, Nagios Ұ௨Γ ɾ߹॓: Docker + Mesos σϓϩΠ؅ཧπʔϧ࡞Δ http://yuuki.hatenablog.com/entry/2013/12/22/174813 ! ɾ৽αʔϏεͷߏஙӡ༻ʢMackerelʣ ɾJVM, PostgreSQL, Graphite(࣌ܥྻDB) ɾmackerel-agent ύοέʔδఏڙ http://yuuki.hatenablog.com/entry/docker-package-ci ! ɾJVM Operation Casual http://yuuki.hatenablog.com/entry/2014/04/08/074507 ɾGraphiteνϡʔχϯά http://yuuki.hatenablog.com/entry/monitoringcasual6 ɾMackerel OSS ·ΘΓϝϯςφϯε ɾISUCON4 ຊઓग़৔ http://yuuki.hatenablog.com/entry/dockerized-isucon ɾMackerel CLI tool github.com/y-uuki/gomkr ɾ߹॓: GoͰδϣϒΩϡʔγεςϜ
  18. WebΞϓϦέʔγϣϯ։ൃ ϋʔυ΢ΣΞௐୡͱ͔ωοτϫʔΫઃܭ ্ Լ OSΧʔωϧ ϛυϧ΢ΣΞ: MySQL, PostgreSQL, Redis, memcached,

    Nginx, Apache, Elasticsearch, Solr, Varnish, Squid Jenkins(CI) Capistrano(σϓϩΠ) Nagios Chef