WordPress with Microservice Architecture

WordPress with Microservice Architecture

WordCamp Kansai 2016セッション資料

75486cbfd37125f121cf4a6c5614601c?s=128

Hidetaka Okamoto

July 10, 2016
Tweet

Transcript

  1. Wo rd P re s s w i t h

    M i c ro s e r v i c e s Wo rd C a m p K a n s a i 2 0 1 6
  2. Ta l k a b o u t … •

    Why Microservices ? • Example Case • How to building Microservices ? • Conclusion
  3. H i d e t a k a O k

    a m o t o • Digitalcube developer • WordBenchژ౎ϞσϨʔλ WP REST API / WP - CLIɹɹ ίΞίϯτϦϏϡʔλʔ • WP/React/AWS SDK/Alexa
  4. A W S + Wo rd P re s s

    = > A M I M O T O A M I h t t p s : / / a m i m o t o - a m i . c o m /
  5. Ta l k a b o u t … •

    Why Microservices ? • Example Case • How to building Microservices ? • Conclusion
  6. T h i n k a b o u t

  7. ʮ ࢲ ͕ ٳ Ή ͱ ɺ ɹ ࢓ ࣄ

    ͕ · Θ Β ͳ ͍ ʯ
  8. ʮ ࢲ ͕ ٳ Ή ͱ ɺ ɹ ࢓ ࣄ

    ͕ · Θ Β ͳ ͍ ʯ ີ݁߹ʢMonolithicʣͳνʔϜ
  9. W H Y ? • ͦͷਓ͕͍ͳ͍ͱػೳ͠ͳ͍Օॴ͕͋Δ ɹˠͦͷਓ͕͍ͳ͘ͳͬͨΒػೳෆશʹؕΔ • ͋ͳͨͷձࣾʹ ɹʮ͍ͳ͘ͳΔͱۀ຿͕ࢭ·Δਓʯ͸͍·ͤΜ͔ʁ

  10. T h i n k a b o u t

  11. ʮ ͜ ͷ α ʔόʔ ͕ ࢭ · Δ ͱ

    ɺ ɹ α ʔ Ϗ ε ͕ ࢭ · Δ ʯ
  12. S i n g l e P o i n

    t O f F a i l u re ୯ Ұ ো ֐ ఺
  13. ྫ ͑ ͹ ɺ ͜ Μ ͳ ߏ ੒

  14. ̍ Օ ॴ ͷ ো ֐ Ͱ αΠ τ ͕

    શ ͯ μ ΢ ϯ ͢ Δ ×
  15. B u i l d i n g M i

    c ro s e r v i c e s
  16. None
  17. ί ϯ ς ϯ π ؅ ཧ

  18. Ϛʔ έ ς Ο ϯ ά

  19. σ ʔ λ ݕ ࡧ

  20. α ʔό ϩ ά ऩ ू

  21. α ʔό ϩ ά ղ ੳ

  22. Ϗ δϡ Ξ ϥ Π ζ

  23. ෳ ਺ ͷ Ξ ϓ Ϧ Λ ૊ Έ ߹

    Θ ͤ ͯ α ʔ Ϗ ε ʹ ͢ Δ
  24. ো ֐ ͕ α ʔ Ϗ ε શ ମ ʹ

    ೾ ٴ ͠ ʹ͘͘ ͳ Δ ×
  25. ো ֐ ͕ α ʔ Ϗ ε શ ମ ʹ

    ೾ ٴ ͠ ʹ͘͘ ͳ Δ × Ϛʔ έ ς Ο ϯ ά ػ ೳ ͩ ͚ ఀ ࢭ
  26. W h y M i c ro s e r

    v i c e ? • εέʔϧʢ֦ுʣ͠΍͘͢ɺμ΢ϯ͠ʹ͍͘ • ಛఆͷٕज़΁ͷґଘ͕খ͘͞ͳΔ • σϓϩΠ͠΍͘͢ɺΞοϓσʔτΛසൟʹͰ͖Δ
  27. εέ ʔϧ ͱ མ ͪ ʹ͘ ͞ • αʔϏεಉ͕࢜ૄ݁߹ •

    མͪͨαʔϏεΛ੾Γ཭͢ • ػೳ͸ݮΔ͕ɺαʔϏεΛ མͱ͞ͳ͍ • ඞཁͳαʔϏε͚ͩɺɹɹ εέʔϧͤ͞Δ ×
  28. ಛ ఆ ٕ ज़ ΁ ͷ ґ ଘ Λ ճ

    ආ • αʔϏεಉ͕࢜ૄ݁߹ɹɹ ˠϓϩάϥϜ͕ಠཱՔಇ • ॲཧɾαʔϏεʹ࠷దͳɹ ݴޠɾFW͕બ୒Մೳ • ඞཁʹԠͯ͡ɹɹɹɹɹɹ αʔϏε୯ҐͰϦϓϨΠε s y m f o n y J S J a v a Wo rd P re s s
  29. ͋ · Γ ߋ ৽ ͠ ͳ ͍ ස ൟ

    ʹ Ξ ο ϓ σ ʔ τ খ ͞ ͘ ස ൟ ͳ Ξ οϓ σ ʔ τ • αʔϏε୯ҐͰͷσϓϩΠ • มߋͷӨڹ͕શମ͔Βɹɹ αʔϏε୯Ґʹ • όʔδϣχϯά͞ΕͨAPI • ςετͷࣗಈԽͰΑΓߴ଎ɾ ߴස౓ͳσϓϩΠ͕Մೳʹ
  30. খ ͞ ͘ ස ൟ ͳ Ξ οϓ σ ʔ

    τ • αʔϏε୯ҐͰͷσϓϩΠ • มߋͷӨڹ͕શମ͔Βɹɹ αʔϏε୯Ґʹ • όʔδϣχϯά͞ΕͨAPI • ςετͷࣗಈԽͰΑΓߴ଎ɾ ߴස౓ͳσϓϩΠ͕Մೳʹ  7 "1*αʔϏε
  31. খ ͞ ͘ ස ൟ ͳ Ξ οϓ σ ʔ

    τ • αʔϏε୯ҐͰͷσϓϩΠ • มߋͷӨڹ͕શମ͔Βɹɹ αʔϏε୯Ґʹ • όʔδϣχϯά͞ΕͨAPI • ςετͷࣗಈԽͰΑΓߴ଎ɾ ߴස౓ͳσϓϩΠ͕Մೳʹ  7  7 "1*αʔϏε
  32. খ ͞ ͘ ස ൟ ͳ Ξ οϓ σ ʔ

    τ • αʔϏε୯ҐͰͷσϓϩΠ • มߋͷӨڹ͕શମ͔Βɹɹ αʔϏε୯Ґʹ • όʔδϣχϯά͞ΕͨAPI • ςετͷࣗಈԽͰΑΓߴ଎ɾ ߴස౓ͳσϓϩΠ͕Մೳʹ  7  7 "1*αʔϏε
  33. Ta l k a b o u t … •

    Why Microservices ? • Example Case • How to building Microservices ? • Conclusion
  34. ̏ छ ྨ ͷ Ξ ϓ ϩ ʔ ν •

    ֎෦αʔϏεͱͷ࿈ܞ • ΠϯϑϥϨΠϠͷ෼ׂ • WordPress as a Microservices
  35. ̏ छ ྨ ͷ Ξ ϓ ϩ ʔ ν •

    ֎෦αʔϏεͱͷ࿈ܞ • ΠϯϑϥϨΠϠͷ෼ׂ • WordPress as a Microservices
  36. ಛ ఆ ͷ ػ ೳ Λ ଞ ͷ α ʔ

    Ϗ ε Ͱ ࣮ ૷ ͢ Δ
  37. ֎ ෦ α ʔ Ϗ ε ͷ A P I

    ʹ ର ͯ͠ɺ w p _ re m o t e _ g e t ( ) ; w p _ re m o t e _ p o s t ( ) ; ͳ Ͳ Ͱ ઀ ଓ ͢ Δ
  38. ̏ छ ྨ ͷ Ξ ϓ ϩ ʔ ν •

    ֎෦αʔϏεͱͷ࿈ܞ • ΠϯϑϥϨΠϠͷ෼ׂ • WordPress as a Microservices
  39. h t t p s : / / a w

    s . a m a z o n . c o m / m a r k e t p l a c e / p p / B 0 1 B 3 Z E 1 N C RDB΍ϝσΟΞετϨʔδΛ AWS͕Ϛωʔδυ͢ΔαʔϏεʹҠৡ
  40. h t t p s : / / a w

    s . a m a z o n . c o m / m a r k e t p l a c e / p p / B 0 1 B 3 Z E 1 N C RDB΍ϝσΟΞετϨʔδΛ AWS͕Ϛωʔδυ͢ΔαʔϏεʹҠৡ ϝ ϯ ς φ ϯε Λ AW S ͕ ࣮ ࢪ ϝ ϯ ς φ ϯε Λ AW S ͕ ࣮ ࢪ ϝ ϯ ς φ ϯε Λ AW S ͕ ࣮ ࢪ ϝ ϯ ς φ ϯε Λ AW S ͕ ࣮ ࢪ
  41. ϑΝΠϧɾσʔλΛ֎෦Խ͢Δ͜ͱͰɺ αʔόʔͷࣗಈεέʔϧΞ΢τ͕Մೳʹ

  42. h t t p : / / j a .

    s t a t i c p re s s . n e t / StaticPressʹΑΔwp-adminͱ ϑϩϯτΤϯυͷ෼཭
  43. StaticPressʹΑΔwp-adminͱ ϑϩϯτΤϯυͷ෼཭

  44. ̏ छ ྨ ͷ Ξ ϓ ϩ ʔ ν •

    ֎෦αʔϏεͱͷ࿈ܞ • ΠϯϑϥϨΠϠͷ෼ׂ • WordPress as a Microservices
  45. h t t p s : / / a m

    i m o t o - a m i . c o m / a m i m o t o - n i n j a / Ի੠ೝࣝαʔϏεͱͷ࿈ܞ
  46. A u d i o C a p t u

    re A u d i o P l a y b a c k Yo u r C o d e a n o t h e r A P I W h a t i s Wo rd p re s s ? Wo rd P re s s i s …
  47. h t t p s : / / g i

    t h u b . c o m / w c - a p p / w c - a p p Cordova΍React NativeΛ༻͍ͨ ωΠςΟϒΞϓϦ
  48. None
  49. Ta l k a b o u t … •

    Why Microservices ? • Example Case • How to building Microservices ? • Conclusion
  50. M i c ro s e r v i c

    e Ξ ϯ νύ λ ʔϯ ͸͡Ί͔Β Microserviceͱͯ͠ ߏங͠Α͏ͱ͢Δ
  51. ε λ ʔ τ ͸ Ұ ຕ ؠ • ελʔτ͸γϯϓϧ͔ͭখ͘͞

    • ͸͡Ί͔Βෳࡶͳߏ੒ʹ͢Δͱมߋίετ͕ߴ͘ͳΔ • γϯϓϧʹ͸͡ΊɺඞཁʹԠͯ͡෼ׂ͢Δ
  52. ͍ ͭ ෼ ׂ ͢΂ ͖ ͔ʁ • ίʔυͷ؅ཧ͕Ͱ͖ͳ͘ͳΔ·ͰංେԽͨ࣌͠ •

    Ұ෦ͷػೳͷΈසൟʹΞοϓσʔτ͍ͨ࣌͠ • ։ൃνʔϜ͕෺ཧతʹ཭Ε͍ͯΔ࣌ • ηΩϡϦςΟΛڧݻʹ͍ͨ͠෦෼͕Ͱ͖ͨ࣌ • ଞͷݴޠɾϑϨʔϜϫʔΫΛ࢖༻͍ͨ࣌͠
  53. H o w t o M i c ro s

    e r v i c e ? • Ϗδωε୯ҐͰ෼ׂʢίϯ΢ΣΠͷ๏ଇʣ • ີ݁߹͔Βૄ݁߹΁ʢAPIϕʔεͰͷߏஙʣ • αʔϏεͷ؂ࢹͱো֐ͷ෼཭
  54. ί ϯ ΢ Σ Π ͷ ๏ ଇ

  55. – M E LV I N C O N WAY

    “γεςϜΛઃܭ͢Δ૊৫͸ɺ ͦͷߏ଄Λͦͬ͘Γ·Ͷͨߏ଄ͷ ઃܭΛੜΈग़ͯ͠͠·͏”
  56. ί ϯ ΢ Σ Π ͷ ๏ ଇ • ີ݁߹ͳ૊৫͸ɺີ݁߹ͳγεςϜΛઃܭ͠΍͍͢

    • ϓϩδΣΫτɾػೳ୯ҐͷνʔϜͰ։ൃ͢Δͱɺɹɹ ૄ݁߹ʹͳΓ΍͍͢ • ʮ̎ຕͷϐβͰ଍Γͳ͍νʔϜ͸࡞Δ΂͖Ͱͳ͍ʯ (Amazon)
  57. A P I ϕʔε ͷ ։ ൃ

  58. A P I ϕʔε ͷ ։ ൃ • αʔϏεຖʹಠཱͨ͠ΞϓϦͱͯ͠։ൃ •

    APIΛ༻͍ͯ֎෦ͱ࿈ܞ͢Δ • APIͷΤϯυϙΠϯτ͸όʔδϣχϯά͠ɺɹɹɹɹ ഁյతͳΞοϓσʔτʹඋ͑Δɹɹɹɹɹɹɹɹɹɹ ྫɿʮ/v1/coupons/ʯʮ /v2/wp/postsʯ
  59. α ʔ Ϗ ε ͷ ؂ ࢹ ͱ ো ֐

    ͷ ෼ ཭
  60. Ͳͷ α ʔ Ϗ ε ͕ ࢭ · ͬͯ ͍

    Δ ͔ Λ ஌ Δ ඞ ཁ ͕ ͋ Δ ×
  61. α ʔ Ϗ ε ؂ ࢹ ͱ ো ֐ ͷ

    ෼ ཭ • αʔϏε୯ҐɾΞϓϦશମͰࢮ׆؂ࢹ • ো֐ͷى͖ͨαʔϏεҎ֎ͰՔಇ͢Δ࢓૊Έͷߏங • APIϦΫΤετͷλΠϜΞ΢τʹΑΔ஗Ԇʹ΋උ͑Δ
  62. R O U T E 5 3 Λ ༻ ͍

    ͨ ϑ Σ Πϧ Φ ʔόʔ α ʔό ো ֐ ࣌ ͸ S 3 ʹ ϧ ʔ ς Ο ϯ ά
  63. Ta l k a b o u t … •

    Why Microservices ? • Example Case • How to building Microservices ? • Conclusion
  64. ै དྷ ͷ Wo rd P re s s ߏ

    ங 8PSE1SFTT$PSF  1MVHJO  1MVHJO  1MVHJO  5IFNF  1MVHJO
  65. ै དྷ ͷ Wo rd P re s s ߏ

    ங ͸ Ұ ຕ ؠ ʹ ͳ Γ ΍ ͢ ͍ 8PSE1SFTT$PSF  1MVHJO  1MVHJO  1MVHJO  5IFNF  1MVHJO  1MVHJO  $IJME  1MVHJO  1MVHJO  1MVHJO  1MVHJO  1MVHJO  1MVHJO  1MVHJO  1MVHJO  1MVHJO
  66. ϓϥάΠϯɾςʔϚͷিಥ͕ൃੜ͢Δͱɾɾɾ 8PSE1SFTT$PSF  1MVHJO  1MVHJO  1MVHJO  5IFNF

     1MVHJO  1MVHJO  $IJME  1MVHJO  1MVHJO  1MVHJO  1MVHJO  1MVHJO  1MVHJO  1MVHJO  1MVHJO  1MVHJO
  67. None
  68. ཛ Λ ̍ ͭ ͷ Χ ΰ ʹ · ͱ

    Ί Δ ͱ ɺ ͦ ͷ Χ ΰ Λ མ ͱ ͠ ͨ ࣌ ʹ શ ໓ ͢ Δ
  69. +BWB4DSJQU ػ ೳ ͸ ݮ Δ ͕ ɺ શ ମ

    ͸ ੜ ͖ ࢒ Δ )5.- "1* "1* "1* ×
  70. ʮ ઈ ର ʹ མ ͱ ͞ ͳ ͍ Α

    ͏ ʹ ؤ ு Δ ʯ Ͱ ͸ ͳ ͘ ɺ ʮ ো ֐ ͕ ى ͖ ͯ ΋ શ ໓ ͞ ͤ ͳ ͍ ʯ
  71. https://ja.wikipedia.org/wiki/%E8%88%AA%E7%A9%BA%E6%A9%9F#/media/File:Qantas_a380_vh-oqa_takeoff_heathrow_arp.jpg

  72. https://ja.wikipedia.org/wiki/%E8%88%AA%E7%A9%BA%E6%A9%9F#/media/File:Qantas_a380_vh-oqa_takeoff_heathrow_arp.jpg ΋ ͠ Τ ϯ δ ϯ ͕ ࢭ ·

    ͬ ͨ Β ʁ
  73. ϥϜ Τ Ξ λ ʔ Ϗ ϯ • ඈߦػͷΤϯδϯ͕ࢭ·Δ ͱىಈ͢Δ෩ྗൃిػ

    • ඈߦܭثͷిྗΛ֬อ͢Δ • Ͳ͔͜ʹো֐͕ى͖ͯ΋ɺ ઈରʹඞཁͳ෺͸֬อ͢Δ https://ja.wikipedia.org/wiki/%E3%83%A9%E3%83%A0%E3%82%A8%E3%82%A2%E3%83%BB%E3%82%BF%E3%83%BC%E3%83%93%E3%83%B3#/media/File:757_ram_air_turbine.jpg
  74. ʮ ઈ ର ʹ མ ͱ ͞ ͳ ͍ Α

    ͏ ʹ ؤ ு Δ ʯ ͔ Β ʮ ো ֐ ͕ ى ͖ ͯ ΋ શ ໓ ͞ ͤ ͳ ͍ ʯ
  75. T H A N K S ! • Why Microservices

    ? • Example Case • How to building Microservices ? • Conclusion