2012.09.15 PyCon JP 2012 「ナウでヤングな17歳のVPS 構築機」

D12b0581b8218af98bf3014af3eeaac3?s=47 Kohei YOSHIDA
September 15, 2012

2012.09.15 PyCon JP 2012 「ナウでヤングな17歳のVPS 構築機」

This slide was used for PyCon JP 2012. I spoke about building private VPS on my server at PyCon JP 2012. Video of the session is published on YouTube. That's here ! http://www.youtube.com/watch?v=tOWZB9tFgu8 Both slide and session is Japanese only.

D12b0581b8218af98bf3014af3eeaac3?s=128

Kohei YOSHIDA

September 15, 2012
Tweet

Transcript

  1. φ΢ͰϠϯάͳ17ࡀͷ VPSߏஙه ͋ͳͨͷொͷGeekɻ yosida95 / ٢ా ߉ฏ 1 12೥9݄15೔౔༵೔

  2. ͓·͑ɺ୭Αʁ ٢ా߉ฏ, @yosida95, id:yosida95 17ࡀͷߴߍ2೥ੜ ΞϑλʔεΫʔϧϓϩάϥϚʔ ࣗࣨαʔόʔͰWeb αʔϏεΛӡӦ ͢Δఔ౓ͷೳྗ http://yosida95.com/

    2 12೥9݄15೔౔༵೔
  3. ͓·͑ɺ୭Αʁ ՆٳΈதʹौ୩ܥIT اۀͰεϚϑΥ ΤϯδχΞͱͯ͠ΞϧόΠτ ݱࡏઈࢍٻΞϧόΠτத Python ͰΖ͘Ζճ͍ͨ͠ʂʂ http://yosida95.com/ 3 12೥9݄15೔౔༵೔

  4. ͓·͑ɺ୭Αʁ TwitActivity / http://twit.yosida95.com Twitter Ͱͷձ࿩ΛϦΞϧλΠϜʹ ·ͱΊɺදࣔ͢ΔαʔϏε Event Search /

    http://event.yosida95.com ATND Beta, Connpass, Zusaar ͔Β ΠϕϯτΛݕࡧ͢ΔαʔϏε http://yosida95.com/ 4 12೥9݄15೔౔༵೔
  5. ͓·͑ɺ୭Αʁ ݟͯΔͳ͏(Ծ) http://miteru.yosida95.com/ Ӿཡதͷ΢ΣϒϖʔδΛTwitter ্ ʹϙετ͢ΔϒοΫϚʔΫϨοτ Ϣʔβʔ150໊ఔ౓ http://yosida95.com/ 5 12೥9݄15೔౔༵೔

  6. ࠓ೔ͷ͋͐͡Μͩ VPS ͱ͸ʁ Ͳ͏ͯ͠VPS Λ࡞ͬͨͷʁ Ծ૝Ϛγϯ੍ޚΛࢧ͑Δٕज़ ίϯύωΛࢧ͑Δٕज़ ࠓޙ࣮૷͍ͨ͠΋ͷ 6 12೥9݄15೔౔༵೔

  7. ࠓ೔ͷ͋͐͡Μͩ αςετ βςετ σϞ (࣭ٙԠ౴) 7 12೥9݄15೔౔༵೔

  8. ͱ͍͏͜ͱͰ Θͨ͠ɺ͓͏ͪʹVPSߏஙͪ͠Ό͍·͠ ͨʂ 8 12೥9݄15೔౔༵೔

  9. VPS ͱ͸ Virtual Private Server ͷུɻ ͘͞ΒVPS ͳͲ͕༗໊ɻ௿Ձ֨Ͱઐ༻ αʔόʔͱಉఔ౓ͷࣗ༝౓͕ఏڙ͞Ε Δ͜ͱͰਓؾͷϨϯλϧαʔόʔαʔϏ

    εɻ 9 12೥9݄15೔౔༵೔
  10. VPS ͱ͸ ٕज़తʹ͸αʔόʔԾ૝Խٕज़ʹΑͬͯ 1୆ͷ෺ཧϚγϯ্Ͱಈ͍͍ͯΔݸʑͷ αʔόʔͷ͜ͱɻ গ਺ͷ෺ཧαʔόʔͰଟ͘ͷԾ૝Ϛγ ϯΛಈ͔ͤΔͷͰ҆ՁͰఏڙͰ͖Δɻ 10 12೥9݄15೔౔༵೔

  11. VPS ͱ͸ ϗεταʔόʔ VPS VPS VPS VPS 11 12೥9݄15೔౔༵೔

  12. Ͳ͏ͯ͠VPS Λ࡞ͬͨͷʁ (1)ܭࢉϦιʔε༗ޮ׆༻ͷͨΊʹࣗ୐ ͷαʔόʔΛԾ૝Խ (2)Ծ૝ϚγϯΛίϚϯυ1ͭͰ࡞੒Ͱ ͖ΔΑ͏ʹͯ͠Έͨ 12 12೥9݄15೔౔༵೔

  13. Ͳ͏ͯ͠VPS Λ࡞ͬͨͷʁ (3)Ծ૝ϚγϯΛ΢Σϒίϯύω͔Β੍ ޚͰ͖Ε͹ૉఢ (4)Α͠ɺ࡞Ζ͏ 13 12೥9݄15೔౔༵೔

  14. Ͳ͏ͯ͠VPS Λ࡞ͬͨͷʁ (5)Ծ૝Ϛγϯ + ΢Σϒίϯύω ʹ͜ΕͬͯVPS ͳͷͰ͸ 14 12೥9݄15೔౔༵೔

  15. Ծ૝Ϛγϯ੍ޚΛࢧ͑Δٕज़ αʔόʔ Scientific Linux - ϗετOS KVM/QEMU - Ծ૝Խج൫ ⇒

    ׬શԾ૝Խ libvirt(Python Package) - Ϛγϯ੍ޚ 15 12೥9݄15೔౔༵೔
  16. KVM/QEMU KVM Kernel-based Virtual Machine ͷུ Linux Χʔωϧʹඪ४Ͱ౥ࡌ Intel VT-x

    ΍AMD-V Λར༻ͯ͠Ծ૝ ԽΛ࣮ݱ͢Δ 16 12೥9݄15೔౔༵೔
  17. KVM/QEMU QEMU ϋʔυ΢ΣΞͷΤϛϡϨʔτΛ ߦ͏ Linux ͷϢʔβʔϓϩηεͱͯ͠ ಈ࡞͢Δ 17 12೥9݄15೔౔༵೔

  18. KVM/QEMU Linux Kernel KVM VPS QEMU VPS QEMU VPS QEMU

    VPS QEMU 18 12೥9݄15೔౔༵೔
  19. libvirt QEMU ΍XEN ଞଟ͘ͷ؀ڥͰಈ͘Ծ ૝ϚγϯΛڞ௨API Ͱίϯτϩʔϧ Ͱ͖ΔCϥΠϒϥϦ Ծ૝Ϛγϯʹର͢Δ͋ΒΏΔૢ࡞Λ libvirt ͔Βߦͳ͍ͬͯ·͢ɻ

    19 12೥9݄15೔౔༵೔
  20. libvirt libvirt Λར༻Ͱ͖Δݴޠ C C# Java OCaml Perl PHP Python

    Ruby 20 12೥9݄15೔౔༵೔
  21. libvirt virt-manager ͱ͍͏Ծ૝Ϛγϯૢ࡞༻ GUI ΞϓϦέʔγϣϯ͕Python Ͱ࣮ ૷͞Ε͍ͯΔ ࠓճͷίϯτϩʔϧύωϧ੡࡞ʹ ͋ͨΓେ͍ʹࢀߟʹͳͬͨ 21

    12೥9݄15೔౔༵೔
  22. ίϯύωΛࢧ͑Δٕज़ ίϯύωʹཁٻ͞ΕΔػೳ VPS ৽ن࡞੒ VPS ిݯૢ࡞ VNC ίϯιʔϧ OS ࠶Πϯετʔϧ

    22 12೥9݄15೔౔༵೔
  23. Task Queueing ॲཧͷڝ߹๷ࢭ ੔߹ੑอ࣋ ίωΫγϣϯઅ໿ etc... 23 12೥9݄15೔౔༵೔

  24. Task Queueing Kestrel Scala ੡ϝοηʔδΩϡʔαʔό memcached ޓ׵ MongoDB υΩϡϝϯτࢦ޲NoSQL 24

    12೥9݄15೔౔༵೔
  25. Task Queueing Queue Client Web Control Panel Mongo DB Kestrel

    25 12೥9݄15೔౔༵೔
  26. Task Queueing Queue Client Web Control Panel Mongo DB (1)Task

    Kestrel 25 12೥9݄15೔౔༵೔
  27. Task Queueing Queue Client Web Control Panel Mongo DB (1)Task

    (2)Task ID + Task Kestrel 25 12೥9݄15೔౔༵೔
  28. Task Queueing Queue Client Web Control Panel Mongo DB (1)Task

    (2)Task ID + Task Kestrel (3) Task ID 25 12೥9݄15೔౔༵೔
  29. Task Queueing Queue Client Web Control Panel Mongo DB (1)Task

    (2)Task ID + Task Kestrel (3) Task ID (4)Task ID 25 12೥9݄15೔౔༵೔
  30. Task Queueing Queue Client Task Worker Mongo DB Kestrel 26

    12೥9݄15೔౔༵೔
  31. Task Queueing Queue Client Task Worker Mongo DB (1)Get Task

    Kestrel 26 12೥9݄15೔౔༵೔
  32. Task Queueing Queue Client Task Worker Mongo DB (1)Get Task

    (2)pop Kestrel 26 12೥9݄15೔౔༵೔
  33. Task Queueing Queue Client Task Worker Mongo DB (1)Get Task

    (2)pop Kestrel (3)Task ID 26 12೥9݄15೔౔༵೔
  34. Task Queueing Queue Client Task Worker Mongo DB (1)Get Task

    (2)pop Kestrel (4) Task ID (3)Task ID 26 12೥9݄15೔౔༵೔
  35. Task Queueing Queue Client Task Worker Mongo DB (1)Get Task

    (2)pop Kestrel (4) Task ID (3)Task ID (5)Task 26 12೥9݄15೔౔༵೔
  36. Task Queueing Queue Client Task Worker Mongo DB (1)Get Task

    (2)pop Kestrel (4) Task ID (6)Task (3)Task ID (5)Task 26 12೥9݄15೔౔༵೔
  37. VPS ৽ن࡞੒ (1)ऩ༰͢ΔϗετΛબ୒͢Δ (2)ήετʹඞཁͳ৘ใΛੜ੒͢Δ (1)Mac Address (2)IP Address 27 12೥9݄15೔౔༵೔

  38. VPS ৽ن࡞੒ (3)ετϨʔδΛ࡞੒͢Δ (4)VPS ఆٛXML Λੜ੒͢Δ (5)libvirt ʹ౉ͯ͠QEMU ʹఆٛͤ͞Δ (6)OS

    ΠϯετʔϧσΟεΫΛೖΕͯ ىಈ͢Δ 28 12೥9݄15೔౔༵೔
  39. VPS ిݯૢ࡞ (1)ిݯΛೖΕΔ (2)ిݯΛ੾Δ (3)࠶ىಈ͢Δ 29 12೥9݄15೔౔༵೔

  40. VNC ίϯιʔϧ 30 12೥9݄15೔౔༵೔

  41. VNC ίϯιʔϧ QEMU ʹ͸ඪ४ͰVNC αʔόʔ͕಺ ଁ͞Ε͍ͯΔ noVNC https://github.com/kanaka/ VNC ΫϥΠΞϯτ

    େ෯ʹखΛೖΕͨ 31 12೥9݄15೔౔༵೔
  42. VNC ίϯιʔϧ gevent-websocket Gunicorn ͕αϙʔτ͞Ε͍ͯΔ Nginx nginx_tcp_proxy_module 32 12೥9݄15೔౔༵೔

  43. OS ࠶Πϯετʔϧ (1)if OS มߋΛ൐͏৔߹: (1)ݱࡏͷετϨʔδΛ࡟আ (2)৽͘͠ετϨʔδΛ࡞੒ (2)Ծ૝Ϛγϯ࠶ىಈ (3)OS ΠϝʔδΛ౤ೖ͢Δ

    33 12೥9݄15೔౔༵೔
  44. ࠓޙ࣮૷͍ͨ͠΋ͷ γϦΞϧίϯιʔϧ VNC ॏ͍…… OS Πϯετʔϧ࣌͸࢓ํͳ͍͕ଞ ͷૢ࡞͸γϦΞϧίϯιʔϧͰ΍ Γ͍ͨ 34 12೥9݄15೔౔༵೔

  45. ࠓޙ࣮૷͍ͨ͠΋ͷ ϦιʔεϞχλ CPU ͱϝϞϦͷ࢖༻཰ʹ͍ͭͯί ϯύωʹάϥϑද͍ࣔͨ͠ ϝʔϧͰ௨஌ͨ͠ΓɺΞϥʔτ௨ ஌ͨ͠Γ͍ͨ͠ 35 12೥9݄15೔౔༵೔

  46. ࠓޙ࣮૷͍ͨ͠΋ͷ εφοϓγϣοτ ೚ҙͷλΠϛϯά + ఆظͰεφο ϓγϣοτΛͱΓ͍ͨ Ծ૝Ϛγϯ͋ͨΓ3ͭ͘Β͍εφ οϓγϣοτͱ͓͖͍ͬͯͨ 36 12೥9݄15೔౔༵೔

  47. αςετ 2໊, 4୆ λεΫΩϡʔΠϯάະಋೖ 1ͭͷαʔόʔϓϩηεͰHTTP ͱ WebSocket 37 12೥9݄15೔౔༵೔

  48. βςετ 4໊, 8୆ λεΫΩϡʔΠϯάಋೖ HTTP ͱWebSocket ͷαʔόʔϓϩ ηε෼཭ ػೳ௥Ճ 38

    12೥9݄15೔౔༵೔
  49. ςελʔ αςελʔ @Alice1017 ͞Μ, @LGA128 ͞Μ βςελʔ @YDKKK ͞Μ, @Tiryoh_kun

    ͞Μ ͋Γ͕ͱ͏͍͟͝·ͨ͠ 39 12೥9݄15೔౔༵೔
  50. σϞ - ࣮ԋ - yosida95@pyconjp[~]$ yosida95vps start 40 12೥9݄15೔౔༵೔

  51. Thank You for Listening ! 41 12೥9݄15೔౔༵೔