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

WordPress with Microservice Architecture

WordPress with Microservice Architecture

WordCamp Kansai 2016セッション資料

Hidetaka Okamoto

July 10, 2016
Tweet

More Decks by Hidetaka Okamoto

Other Decks in Technology

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. ʮ ࢲ ͕ ٳ Ή ͱ ɺ ɹ ࢓ ࣄ

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

    ͕ · Θ Β ͳ ͍ ʯ ີ݁߹ʢMonolithicʣͳνʔϜ
  8. ʮ ͜ ͷ α ʔόʔ ͕ ࢭ · Δ ͱ

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

    t O f F a i l u re ୯ Ұ ো ֐ ఺
  10. ̍ Օ ॴ ͷ ো ֐ Ͱ αΠ τ ͕

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

    c ro s e r v i c e s
  12. ෳ ਺ ͷ Ξ ϓ Ϧ Λ ૊ Έ ߹

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    ֎෦αʔϏεͱͷ࿈ܞ • ΠϯϑϥϨΠϠͷ෼ׂ • WordPress as a Microservices
  28. 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͕Ϛωʔδυ͢ΔαʔϏεʹҠৡ
  29. 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 ͕ ࣮ ࢪ
  30. h t t p : / / j a .

    s t a t i c p re s s . n e t / StaticPressʹΑΔwp-adminͱ ϑϩϯτΤϯυͷ෼཭
  31. ̏ छ ྨ ͷ Ξ ϓ ϩ ʔ ν •

    ֎෦αʔϏεͱͷ࿈ܞ • ΠϯϑϥϨΠϠͷ෼ׂ • WordPress as a Microservices
  32. 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 / Ի੠ೝࣝαʔϏεͱͷ࿈ܞ
  33. 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 …
  34. 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Λ༻͍ͨ ωΠςΟϒΞϓϦ
  35. Ta l k a b o u t … •

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

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

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

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

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

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

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

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

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

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

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

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

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

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

     1MVHJO  1MVHJO  $IJME  1MVHJO  1MVHJO  1MVHJO  1MVHJO  1MVHJO  1MVHJO  1MVHJO  1MVHJO  1MVHJO
  50. ཛ Λ ̍ ͭ ͷ Χ ΰ ʹ · ͱ

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

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

    ͏ ʹ ؤ ு Δ ʯ Ͱ ͸ ͳ ͘ ɺ ʮ ো ֐ ͕ ى ͖ ͯ ΋ શ ໓ ͞ ͤ ͳ ͍ ʯ
  53. ϥϜ Τ Ξ λ ʔ Ϗ ϯ • ඈߦػͷΤϯδϯ͕ࢭ·Δ ͱىಈ͢Δ෩ྗൃిػ

    • ඈߦܭثͷిྗΛ֬อ͢Δ • Ͳ͔͜ʹো֐͕ى͖ͯ΋ɺ ઈରʹඞཁͳ෺͸֬อ͢Δ 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
  54. ʮ ઈ ର ʹ མ ͱ ͞ ͳ ͍ Α

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

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