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

Firebase & Google Cloud によるサーバーレス帳票管理 #FJUG / S...

Firebase & Google Cloud によるサーバーレス帳票管理 #FJUG / Serverless Architecture in Candy

2019/12/03 に Google にて開催された「Firebase Meetup #15」の資料です。

potato4d(Takuma HANATANI)

December 03, 2019
Tweet

More Decks by potato4d(Takuma HANATANI)

Other Decks in Technology

Transcript

  1. Takuma HANATANI (@potato4d) • Status • Senior Front-End Enginner at

    LINE Corp. • CEO at ElevenBack LLC. • Core skills • Front-End and Cloud Native Application Development • User Interface and Interaction Design • OpenSource Ecosystem • React.js / Vue.js ja document maintainer • Ex-Nuxt.js ja document maintainer • Nuxt.js beginners guide (C&R Institute) author
  2. Candy ʹஔ͚Δཁ݅ͱ՝୊ײ w $BOEZ w ձܭ؅ཧͷΫϥ΢υιϑτ΢ΣΞ w )JTUPSZϕʔεͰݪຊͱͳΔσʔλΛ؅ཧ͢Δ͜ͱΛཁٻ͞ΕΔ w ϞόΠϧ

    18"8FC ʹಛԽ͍ͨ͠ΘΏΔ41" w ʮؾʹ͠ͳ͍ʯΛ࣠ͱͳΔϓϩμΫτ w 1%'ੜ੒ͱϝʔϧ഑৴ɺεέδϡʔϦϯάػೳ w J$BMFOEBS΍(PPHMF$BMFOEBSͰͷߪಡ༻ͷΤϯυϙΠϯτ
  3. Candy ʹஔ͚Δཁ݅ͱ՝୊ײ w $BOEZ w ձܭ؅ཧͷΫϥ΢υιϑτ΢ΣΞ w )JTUPSZϕʔεͰݪຊͱͳΔσʔλΛ؅ཧ͢Δ͜ͱΛཁٻ͞ΕΔ w ϞόΠϧ

    18"8FC ʹಛԽ͍ͨ͠ΘΏΔ41" w ʮؾʹ͠ͳ͍ʯΛ࣠ͱͳΔϓϩμΫτ w 1%'ੜ੒ͱϝʔϧ഑৴ɺεέδϡʔϦϯάػೳ w J$BMFOEBS΍(PPHMF$BMFOEBSͰͷߪಡ༻ͷΤϯυϙΠϯτ
  4. ݪຊอ؅ͷͨΊͷ History ؅ཧ w ձܭॻྨ͸੫੍্ݪຊอ؅͕ඞਢ w 1%'ɺ΋ͱͷσʔλ྆ํΛݫີʹ؅ཧ w ඇਖ਼نԽͨ͠ߏ଄͕ٻΊΒΕΔ w

    ໊͕ࣾมΘͬͯ΋ϦΞΫςΟϒʹมΘ Βͳ͍ w αʔόʔʹ1%'ͷੜ੒೔࣌ͱϑΝΠ ϧࢀরΛอ͓࣋ͯ͘͠ w ݱঢ়ϦϏδϣϯӾཡػೳ͸ఏڙ͠ͳ͍
  5. PDF ੜ੒ͱϝʔϧ഑৴ʹ͍ͭͯ w Α͋͘Δாථग़ྗػೳ w 1%'ʹΑΔ w 4.51αʔόʔܦ༝Ͱͷϝʔϧૹ෇ w ׬ྃ݁ՌͷσʔλετΞ΁ͷॻ͖ࠐΈ

    w ॳظϦϦʔεʹ͸ͳ͍͕༧໿഑৴Λߟྀ w ࢥ͍ग़ͨ࣌͠ʹૹΕΔΑ͏ʹ w ͋ͱʹͳͬͯ๨Εͳ͍Α͏ʹ
  6. 1. ݪຊอ؅ͷ՝୊Λ Firestore Ͱ౗͢ w 'JSFTUPSF͸υΩϡϝϯτܕͷσʔλϕʔε w Ͱ͖Δ͚ͩϑϥοτͳߏ଄ʹ΋Ͱ͖Δ͠ਂ͘ωετͤ͞Δ͜ͱ΋Ͱ͖Δ w جຊతʹඇਖ਼نԽͨ͠σʔλߏ଄ΛόονॲཧͰ੔߹ੑΛ߹ΘͤΔ͜ͱ͕جຊ

    w ݪຊΛอ؅͢Δ৔߹͸ࣄ৘͕ಛूͱͳΓɺͦΕͧΕ͕࿈ܞঢ়ଶʹͳ͍͜ͱ͕େ੾ w 3FGFSFODFܕΛલఏͱͤͣసࣸ͢ΔɺόονͰυΩϡϝϯτؒͷಉظΛ͠ͳ͍ w 3%#Ͱ͍͏ͱ͜Ζͷ',ΛറΔΑ͏ͳҹ৅
  7. 2. PDF ग़ྗΛ puppeteer + Cloud Functions Ͱ౗͢ w ͦ΋ͦ΋1%'ग़ྗ͸ͭΒ͍

    w '%1' 1)1  w ͦ΋ͦ΋6OJDPEFະରԠͰ·ͱ΋ʹϝϯςφϯε͞Ε͍ͯͳ͍ w ςϯϓϨʔτػೳ͸͋Δ͚Ͳجຊ࠲ඪϕʔεͰંΓฦ͠΋ͳ͍ w 1SBXO 3VCZ  w ςϯϓϨʔτ1%'ΛಡΈࠐΉػೳ͕ͳ͍ ࣗྗͰશ෦ॻ͘  w ௕Β͘·ͱ΋ʹ࢖ΘΕͯͳͦ͞͏
  8. 2. PDF ग़ྗΛ puppeteer + Cloud Functions Ͱ౗͢ w ͦ΋ͦ΋1%'ग़ྗ͸ͭΒ͍

    w XLIUNMUPQEG ൚༻  w /PEFKTͰ΋ಈ࡞͢ΔͷͰΫϥ΢υ؀ڥͰಈ͖ͦ͏ͳͷ͕خ͍͠ w 8FC,JUͷ͸ͣͳͷʹಈ࡞΋ग़ྗ඼࣭΋ඍົͰ/BUJWF&YUFOTJPO΋ݫ͍͠ w QVQQFUFFS /PEFKT  w )5.-$44ϨΠΞ΢τ͕ॻ͚ͯ·ͱ΋ʹಈ͘ɺ࣮࣭తͳ།Ұ͔ͭ༗ྗͳख๏ w $BOEZͰ͸αʔόʔଆͰ3FBDUͷ443Λͯ͠ܕ҆શʹாථΛίʔσΟϯά w $ISPNJVNͳͷͰී௨ʹ1BB4*BB4Ͱಈ͔͢෼ʹ͸Ϧιʔε͕ͭΒ͍
  9. 2. PDF ग़ྗΛ puppeteer + Cloud Functions Ͱ౗͢ w QVQQFUFFSΛ'JSFCBTF'VODUJPOT͔Βݺͼग़͢

    w 'VODUJPOT͸ؔ਺୯ҐͰϚγϯεϖοΫΛௐ੔Ͱ͖Δ w "ENJO4%,ʹؔ͢Δઃఆ͕ऴΘ͍ͬͯΔͷͰ'JSFTUPSFͱͷ࿈ܞָ͕ w ίϯϐϡʔςΟϯάίετ͕ߴ͍QVQQFUFFS༻ͷεϖοΫΞοϓΛ࠷௿ݶʹ w 1BB4ͷ৔߹ɺશͯΛ૿ڧ͢Δ͔ผͷϓϩδΣΫτΛ࡞Δ͔ͷೋ୒ͩͬͨ w "QQ&OHJOF͸4FSWJDF୯ҐͰͷεϖοΫมߋΛड͚෇͚ͳ͍ͨΊ w 'VODUJPOTΛར༻͢Δ͜ͱͰɺߟྀ͢΂͖ࣄ߲Λ࠷খԽͰ͖Δ
  10. 2. ͷ࣌఺Ͱͷாථൃߦϑϩʔ JOWPJDF1SFWJFX IUUQT$BMMBCMF 1/(#JOBSZ JTTVF*OWPJDF IUUQT$BMMBCMF 6TFS%FWJDF ϑΝΠϧΛอଘ 1

    2 3 4 1%'63-Λอଘ 5 ϝʔϧૹ෇ 6 ੒ޭσʔλΛอଘ 7 4VCTDSJCFͨ͠'JSFTUPSFͷσʔλΛ41"͕ݕ஌
  11. 3. ฒྻॲཧͱϝʔϧͳͲίέΔॲཧͷରॲ ࠷ऴతͳ࣮૷ํ਑ɹ  $MPVE1VC4VCܖػͰ'VODUJPOTΛ࣮ߦ͠ɺૹ෇ͷ࢓૊ΈΛ౷Ұ  ༧໿ૹ෇͸'VODUJPOTͷDSPOͰFORVFVF͢Δ͚ͩ  খن໛ࣄۀऀͰ4JEFLJRͳͲΛδϣϒΛ࣋ͪͨ͘ͳ͍ਓʹ΋Φεεϝ 

    ༧໿֎ͷૹ෇͸"QQ&OHJOFʹཱͯͨ#''αʔόʔ͔ΒൃՐ  &YBDUMZPODFʹ͍ͨ͠ɺଞͰ#''ཱ͕͍ͬͯΔͷͰศརͳͲ  ࣦഊ࣌͸ࣗ෼ࣗ਎ΛFORVFVF͠௚͢͜ͱͰճ਺੍ݶ͖ͭSFUSZΛ࣮ݱ
  12. ࠷ऴతʹग़དྷ্͕ͬͨΞʔΩςΫνϟਤ (௨ৗ࣌) JOWPJDF1SFWJFX IUUQT$BMMBCMF 1/(#JOBSZ JTTVF*OWPJDF )5511045 6TFS%FWJDF ϑΝΠϧΛอଘ 63-Λอଘ

    ϝʔϧૹ෇ ੒ޭσʔλΛอଘ 9 4VCTDSJCFͨ͠'JSFTUPSFͷσʔλΛ41"͕ݕ஌ #'' 3 2 &ORVFVF 1 4 $POTVNF 5 7 6 8 ࣦഊ࣌͸࠶౓FORVFVF X
  13. ࠷ऴతʹग़དྷ্͕ͬͨΞʔΩςΫνϟਤ (༧໿࣌) JOWPJDF1SFWJFX IUUQT$BMMBCMF 1/(#JOBSZ JTTVF*OWPJDF )5511045 6TFS%FWJDF ϑΝΠϧΛอଘ 63-Λอଘ

    ϝʔϧૹ෇ ੒ޭσʔλΛอଘ 9 4VCTDSJCFͨ͠'JSFTUPSFͷσʔλΛ41"͕ݕ஌ $SPO5BTL 3 2 &ORVFVF 1 4 $POTVNF 5 7 6 8 ࣦഊ࣌͸࠶౓FORVFVF X
  14. ݁ہԿ͕خ͔ͬͨ͠ͷ͔ - σʔλߏ଄ฤ w υΩϡϝϯτ%#ΛυΩϡϝϯτ%#Β͘͠ར༻ͯ͠ݪຊΛอ؅͠΍͘͢ͳͬͨ w 3%#Λར༻͢Δ৔߹ͱൺֱͯ͠ૉ௚ͳίʔυهड़͕Մೳ w ߟྀࣄ߲͕ݮΓɺഊ๺ײ΋ͳ͍ w

    ·ͨɺར༻͕݄ ճ͔ͭ૝ఆ."6͕௚ۙ೥Ͱ΋d ఔ౓ͳͷͰྉۚ΋˕ w ϢʔβʔωʔϜεϖʔεΛ࣋ͭΞϓϦέʔγϣϯͱͷ૬ੑͷྑ͞Λڗड w 'SJFOETIJQͷ3FMBUJPO͕͋Δσʔλߏ଄͸'JSFTUPSFͰ͸࡞ΓͮΒ͍ w ࠓճ͸جຊతʹ0OF5P.BOZͷ3FMBUJPO͔͠ແ͔ͬͨͨΊ͏·͘ޮ͍ͨ
  15. ݁ہԿ͕خ͔ͬͨ͠ͷ͔ - αʔόʔϨεԽฤ w 'VODUJPOTΛར༻͢Δ͜ͱͰQVQQFUFFSΛִ཭ͨ͠؀ڥԼͰ࣮ߦͰ͖ͨ w ϚγϯεϖοΫΛඞཁͳͱ͜Ζ্͚ͩ͛ΒΕΔͷͰίετతʹ͍҆ w $ISPNJVNͷϝϞϦϦʔΫͳͲʹ೰·͞ΕΔඞཁ͕ͳ͍ w

    'VODUJPOTͷεέʔϦϯάੑೳΛे෼ʹڗडͰ͖ͨ w ݱ࣌఺Ͱ΋࠷খݶͷίϯϐϡʔςΟϯάར༻Ͱ཈͑ΒΕ͍ͯΔ w ϦϦʔε४උதͷ༧໿ૹ෇Ͱ͸ಛఆ೔࣌ ".࣌ͳͲ ʹεύΠΫ͢ΔՄೳੑ͕ߴ͍ w ٯʹͦΕҎ֎ͷ࣌͸Πϯελϯε͕ඞཁͳ͍͜ͱ΋ଟ͘ͳΔ༧૝
  16. ݁ہԿ͕خ͔ͬͨ͠ͷ͔ - ΞʔΩςΫνϟฤ w ௨ৗૹ෇ɾ༧໿ૹ෇΍ɺࠓޙ࣮૷͢Δఆظૹ෇ͰऔΓѻ͍ʹҧ͍͕ͳ͍ w ըҰతͳͷͰ࣮૷ίετ΋௿͘ɺߟྀࣄ߲΋গͳ͍ w 41""1*1VC4VC'VODUJPOT'JSFTUPSF41"ͷྲྀΕ͕࡞Εͨ w

    41"͸'JSFTUPSFΛߪಡ͢Δ͚ͩͰඇಉظॲཧΛಉظͷΑ͏ʹʹ࣮ߦͰ͖Δ w Ϩεϙϯεࣗମ͸Ұ౓ฦ٫͞Ε͍ͯΔͷͰɺϦτϥΠͳͲͷ࢓૊Έʹࡌͤ΍͍͢ w 41"͕ؔ৺Λ࣋ͭ΂͖ͳͷ͸ҟৗ࣌ͷλΠϜΞ΢τॲཧͷΈͰ؆ܿ
  17. iCal ܗࣜͷΧϨϯμʔͷఏڙ w Ϣʔβʔ͝ͱʹݸผͷ63-Λఏڙ w ߪಡ͢Δ͜ͱͰΧϨϯμʔͱ৘ใΛಉظ w ͍͕ͭૹ෇ظݶ೔͔ w ͍͕ͭΫϥΠΞϯτ͔Βͷೖۚ೔͔

    w ظݶ಺ʹ׬͍ྃͯ͠Δ͔ w ΧϨϯμʔΛΈͯؾ͍ͮͨΒൃߦͰ͖Δ w ϞόΠϧಛԽΏ͑ͷ༏Ґੑ ৗ࣌҆ఆͨܰ͠ඍͳϦΫΤετ͕ඈΜͰ͘Δ
  18. Firebase Functions ͩͱͭΒ͍ྖҬΛ AppEngine ͰΧόʔ w ৗ࣌ϦΫΤετ͕͘Δ΋ͷ͸"QQ&OHJOF Ͱରॲ͍ͨ͠ w 'BB4͸՝ۚܗଶతʹৗ࣌Քಇʹ͸޲͔

    ͳ͍΍Δ΂͖Ͱͳ͍☠ w ٯʹ"QQ&OHJOFʹશ෦ࡌͤΔͱ QVQQFUFFS෼૿ڧ͞Εͨαʔόʔ͕େ ྔʹඞཁʹͳΓ w ͲͷΈͪ'BB4ͱ͸ผʹ"1*͸ඞਢ
  19. جຊతͳٕज़ͷ࣠ʹ͍ͭͯ w ·ͣ͸'JSFCBTF'VODUJPOTͰղܾͰ͖ͳ͍͔ߟ͑Δ w Ͱ͖ͳ͍ͱࢥ͍ͬͯͯ΋Ͱ͖Δ͜ͱ΋ׂͱଟ͍ w #VTZͳ͕࣌ؒ୹͚Ε͹୹͍΄Ͳ'BB4ͷར఺͸૿͢ w ΠϕϯτۦಈͰ࣮૷Ͱ͖ΔͳΒͦͷ΄͏͕ྑ͍ͷͰ)551ͷޱΛۃྗ։͚ͳ͍ w

    Ͳ͏ͯ͠΋ඞཁͳॲཧΛٵऩ͢ΔͨΊʹ1BB4αʔόʔΛ༻ҙ͢Δͱศར w 'JSFCBTFറΓͩͱͭΒ͍෦෼͸ग़ͯ͘Δ w "QQ&OHJOF͸͋Δఔ౓αʔόʔϨεతࢥ૝ͱ͸ݴ͑ίϯϐϡʔςΟϯάͱཧղ͢Δ
  20. ͓ΘΓʹ w Ұ࣌తʹεύΠΫ͢ΔՄೳੑ͕͋ΔΑ͏ͳϔϏʔͳॲཧ͸'VODUJPOTͰ0, w ඞཁͳͱ͖͚ͩͦΕͳΓͷεϖοΫ d.#3".ͳͲ ΛआΓΒΕΔ w ར༻͠ͳ͍࣌͸໪࿦՝͕͔͔ۚΒͳ͍ͷͰۚમίετͱͯ͠΋خ͍͠ w

    Ϋϥ΢υ͸ָͯ҆͘͠Ͱ͖Δٕज़ͳͷͰɺշద͞ͱίετΛॏࢹͯ͠ར༻͢Δ w 'BB4ͱ1BB4Λซ༻͢Δ͜ͱͰߟྀࣄ߲΋ݮΓɺ͔ͭ҆͘Ͱ͖Δ w ։ൃମ੍ʹٻΊΒΕ͍ͯΔཁૉΛߟ͑ͭͭΠϯϑϥετϥΫνϟΛߟ࡯͠Α͏