Slide 1

Slide 1 text

1 /FYU$VSSFODZͱ("&(P HPMBOHUPLZP !TPOBUBSE

Slide 2

Slide 2 text

Server Side Engineer ͦͳͨ @sonatard • University • Linux Server and Network Engineer • Canon • Develop Wireless LAN Module Simulator with SystemC • Develop TCP/IP protocol stack on RTOS • Go in my free time • Mercari/Souzoh • Google App Engine Go Engineer • Mercari Atte • Next Currency • Google App Engine Go Engineer

Slide 3

Slide 3 text

• ຊ ೔ ͷ ࿩ • N C ͷ ٕ ज़ બ ఆ

Slide 4

Slide 4 text

4 ຊ೔ͷ࿩ w ελʔτΞοϓͰ͸("&(P͕͍͍ w Φʔτεέʔϧ w εϐϯΞοϓ͕ૣ͍ w 04ͷ؅ཧ͕ෆཁ w ϓϩμΫτͷ։ൃʹूதͰ͖Δ w ࣮ࡍʹ࢖ͬͯΈͯ w ΍͸Γศར w ݕ౼͕ඞཁͳϙΠϯτ͸ଟ͍

Slide 5

Slide 5 text

5 ຊ೔ͷ࿩ w ελʔτΞοϓΤϯδχΞ͕গͳ͍ w ϓϩμΫτͷ։ൃɺಛʹࠩผԽཁҼ͚ͩʹूத͍ͨ͠ w ϓϩμΫτͷ։ൃ w ΠϯϑϥͷΞʔΩςΫνϟ w ։ൃ؀ڥ w σϓϩΠ؀ڥ w $*؀ڥ w ςετ ϑϨʔϜϫʔΫɺॻ͖ํ w ϑϨʔϜϫʔΫ΍ϥΠϒϥϦͷબఆ w ηΩϡϦςΟ w ΞϓϦέʔγϣϯͷΞʔΩςΫνϟݕ౼ w %#ͷઃܭ w "1*ͷઃܭ w ϏδωεϩδοΫͷίʔσΟϯά w ϏδωεϩδοΫΛ༻͍ͯΞϓϦέʔγϣϯΛߏங͢Δίʔυ w ΫϥΠΞϯτνʔϜ޲͚ͷυΩϡϝϯτ w ϩάղੳ

Slide 6

Slide 6 text

6 ελʔτΞοϓʹ͓͚Δ։ൃ w ελʔτΞοϓͱͯ͠/$͕ࣾͲͷΑ͏ʹ("&(PΛར༻͠ɺͲͷΑ͏ʹߟٕ͑ͯज़બఆΛ ͖͔ͯͨ͠Λ঺հ͠·͢ɻ

Slide 7

Slide 7 text

• ຊ ೔ ͷ ࿩ • N C ͷ ٕ ज़ બ ఆ

Slide 8

Slide 8 text

• ٕ ज़ બ ఆ ͷ ج ຊ ํ ਑ • ϓ ϩ δ Σ Ϋ τ ߏ ੒ • α ʔ Ϗ ε ߏ ੒ • σ ϓ ϩ Π • Ξ ʔ Ω ς Ϋ ν ϟ • ϑ Ϩ ʔ Ϝ ϫ ʔ Ϋ ɺ ϥ Π ϒ ϥ Ϧ • A P I ϓ ϩ τ ί ϧ • A P I ։ ൃ ํ ਑ • A P I Ϋ ϥ Π Ξ ϯ τ ͱ υ Ω ϡ ϝ ϯ τ • c o n f i g • η Ω ϡ Ϧ ς Ο • ։ ൃ ؀ ڥ • C I ؀ ڥ • ς ε τ • ϩ ά ղ ੳ • d a t a s t o r e ͷ ό ο Ϋ Ξ ο ϓ

Slide 9

Slide 9 text

9 ٕज़બఆͷجຊํ਑ w ˓4JNQMF w ʷ&BTZ w ඞཁҎ্ʹརศੑΛ͋͛ΔͨΊʹϑϨʔϜϫʔΫ΍ϥΠϒϥϦΛ࠾༻͠ͳ͍ w ϑϨʔϜϫʔΫΛ࠾༻͢Δ͜ͱͰɺཧղ͕༰қʹͳΔ΋ͷΛ࠾༻͢Δɻ w ˓4JNQMF w ίʔυͷهड़Λ୹͘͢ΔͳͲɺ࡞ۀྔΛݮΒ͢͜ͱΛ໨తͱͨ͠΋ͷ͸࠾༻͠ͳ͍ɻ w ʷ&BTZ

Slide 10

Slide 10 text

• ٕ ज़ બ ఆ ͷ ج ຊ ํ ਑ • ϓ ϩ δ Σ Ϋ τ ߏ ੒ • α ʔ Ϗ ε ߏ ੒ • σ ϓ ϩ Π • Ξ ʔ Ω ς Ϋ ν ϟ • ϑ Ϩ ʔ Ϝ ϫ ʔ Ϋ ɺ ϥ Π ϒ ϥ Ϧ • A P I ϓ ϩ τ ί ϧ • A P I ։ ൃ ํ ਑ • A P I Ϋ ϥ Π Ξ ϯ τ ͱ υ Ω ϡ ϝ ϯ τ • c o n f i g • η Ω ϡ Ϧ ς Ο • ։ ൃ ؀ ڥ • C I ؀ ڥ • ς ε τ • ϩ ά ղ ੳ • d a t a s t o r e ͷ ό ο Ϋ Ξ ο ϓ

Slide 11

Slide 11 text

11 ϓϩδΣΫτͷߏ੒ w ("&4&Ͱ͸ͭͷΞϓϦέʔγϣϯ͝ͱʹͭͷϓϩδΣΫτΛ࡞Δ w /$Ͱ͸ɺຊ൪ɺ2"ɺ։ൃऀ͝ͱͷݸਓ։ൃ؀ڥͷछྨ

Slide 12

Slide 12 text

• ٕ ज़ બ ఆ ͷ ج ຊ ํ ਑ • ϓ ϩ δ Σ Ϋ τ ߏ ੒ • α ʔ Ϗ ε ߏ ੒ • σ ϓ ϩ Π • Ξ ʔ Ω ς Ϋ ν ϟ • ϑ Ϩ ʔ Ϝ ϫ ʔ Ϋ ɺ ϥ Π ϒ ϥ Ϧ • A P I ϓ ϩ τ ί ϧ • A P I ։ ൃ ํ ਑ • A P I Ϋ ϥ Π Ξ ϯ τ ͱ υ Ω ϡ ϝ ϯ τ • c o n f i g • η Ω ϡ Ϧ ς Ο • ։ ൃ ؀ ڥ • C I ؀ ڥ • ς ε τ • ϩ ά ղ ੳ • d a t a s t o r e ͷ ό ο Ϋ Ξ ο ϓ

Slide 13

Slide 13 text

13 αʔϏεͷߏ੒ w αʔϏε w ("&4&Ͱ͸αʔϏεͱ͍͏୯ҐͰΞϓϦέʔγϣϯΛ෼ׂՄೳ w αʔϏεͷ୯ҐͰΠϯελϯε͕࡞੒͞ΕΔ w αʔϏε͝ͱʹεέʔϧ w αʔϏε͝ͱʹΠϯελϯεͷछྨΛબ୒ w $16ɺϝϞϦͷαΠζ͕ҟͳΔ BQJ CBUDI BVUI BQJ BQJ YYY

Slide 14

Slide 14 text

14 αʔϏεͷߏ੒ w -ωοτϫʔΫ͸("&4&Ͱ͸ߟ͑Δඞཁ͸ͳ͍ w *1ΞυϨεΛҙࣝ͢Δ͜ͱ͸ͳ͍ w ("&ͷαʔϏε͝ͱʹࣗಈతʹυϝΠϯׂ͕ΓৼΒΕΔ w IUUQTαʔϏε໊EPUϓϩδΣΫτ໊BQQTQPUDPN w αʔϏεͱಠࣗʹऔಘͨ͠υϝΠϯΛඥ͚ͮΔ͜ͱ͕Մೳ BQJ BVUI BQJ BQJ YYY IUUQTBQJFYBNQMFDPN IUUQTBQJEPUQSPKFDUBQQTQPUDPN

Slide 15

Slide 15 text

15 αʔϏεͷߏ੒ w /$Ͱ͸.JDSPTFSWJDFTͰ͸ͳ͍͕ɺαʔϏεͷ෼ׂΛ͍ͯ͠Δ w ιʔείʔυ͸શαʔϏεڞ௨ w αʔϏεؒͰͷ௨৴͸جຊతʹͳ͠ɺϢʔβ͔ΒͷೖΓޱ͚ͩΛ෼͚͍ͯΔ w /$ͰͷαʔϏεͷར༻໨త w εέʔϧΞοϓͷ୯ҐɺΠϯελϯεͷೳྗ w ։ൃ༻ w EFCVHαʔϏε͸ຊ൪ʹ͸σϓϩΠ͠ͳ͍ w ೝূͷ༗ແ w BENJOαʔϏε͸ɺ(PPHMFΞΧ΢ϯτͷೝূ͕ඞཁ w αʔϏε͝ͱʹσϓϩΠ͕ඞཁʹͳΔͷͰɺ෼͚͗͢ΔͱσϓϩΠʹ͕͔͔࣌ؒΔΑ͏ ʹͳΔͷͰ஫ҙ

Slide 16

Slide 16 text

16 αʔϏεͷߏ੒ w ೝূͷৄࡉ app.yaml handlers: - url: /.* # ೝূ͋Γ login :required # HTTPSඞਢ secure: always func login(w http.ResponseWriter, r *http.Request) { ctx := appengine.NewContext(r) u := user.Current(ctx) if u == nil { url, _ := user.LoginURL(ctx, "/") fmt.Fprintf(w, `Sign in or register`, url) return } url, _ := user.LogoutURL(ctx, "/") fmt.Fprintf(w, `Welcome, %s! (sign out)`, u, url) }

Slide 17

Slide 17 text

17 αʔϏεͷߏ੒ w .JDSPTFSWJDFTͷඞཁੑ w ʮΦʔφʔγοϓΛ࣋ͭͨΊʯͱ͍͏ࢦ਑͸ͱͯ΋͍͍ w "1*࢓༷͑͞ڞ༗͢Ε͹ɺͦͷ಺෦ͷٕज़બఆ͸ࣗ༝ʹͳΔ w ιʔείʔυɺ"1*ͷϓϩτίϧɺ%#ͳͲ w ػೳʹ߹Θͤͨద੾ͳٕज़બఆ͕Մೳ w "*ج൫ͳΒ1ZUIPOɺ"1*ͳΒ(P w ෳ਺ͷαʔϏε͔Βڞ௨ج൫Λར༻Ͱ͖ΔΑ͏ʹͳΔ w ೝূɺϩά w .JDSPTFSWJDFTΛ࠾༻͢Δฐ֐ w ݕ౼ཁૉ͕૿͑Δ w ίʔυϦϙδτϦΛαʔϏε͝ͱʹ෼ׂ͢Δ΂͖͔ w ෼ׂͨ͠৔߹ɺڞ௨υϝΠϯͷมߋΛͲͷΑ͏ʹ؅ཧ͢Δ͔ w ֤αʔϏεͷϩάͷ؅ཧ͸Ͳ͏͢Δ͔

Slide 18

Slide 18 text

18 αʔϏεͷߏ੒ w /$ͱͯ͠͸.JDSPTFSWJDFTΛ࠾༻͍ͯ͠ͳ͍ w શһ͕ΦʔφʔγοϓΛ࣋ͯΔ૊৫ن໛Ͱ͋ΔͨΊ෼ׂ͸ඞཁͳ͍ w কདྷΛ૝ఆͨ͠ڞ௨ج൫Λਖ਼͘͠ࣄલʹઃܭ͢Δ͜ͱ͸ࠔ೉ w γεςϜ͕૊৫ʹґଘ͢Δ͜ͱ΋ϦεΫ w େن໛ͳมߋࢪࡦΛଧͭͨΊʹ͸ɺ૊৫Λԣஅ͢Δඞཁ͕Ͱͯ͘Δ w ෦෼࠷దʹ͍ؕΔՄೳੑ w ΠϊϕʔγϣϯͷδϨϯϚͰ͸ϦεΫͱͯ͠঺հ͞Ε͍ͯΔ w ੡඼ͷઃܭ͕૊৫ਤͦͷ΋ͷ w ՄೳͳݶΓগਓ਺ͰɺγϯϓϧͰϞϊϦγοΫͳγεςϜΛӡ༻͍͖͍ͯͨ͠ w .JDSPTFWJDFT͸໨ࢦ͢΋ͷͰ͸ͳ͘ඞཁʹഭΒΕͨΒऔΔ΂͖બ୒ࢶͷͭ

Slide 19

Slide 19 text

• ٕ ज़ બ ఆ ͷ ج ຊ ํ ਑ • ϓ ϩ δ Σ Ϋ τ ߏ ੒ • α ʔ Ϗ ε ߏ ੒ • σ ϓ ϩ Π • Ξ ʔ Ω ς Ϋ ν ϟ • ϑ Ϩ ʔ Ϝ ϫ ʔ Ϋ ɺ ϥ Π ϒ ϥ Ϧ • A P I ϓ ϩ τ ί ϧ • A P I ։ ൃ ํ ਑ • A P I Ϋ ϥ Π Ξ ϯ τ ͱ υ Ω ϡ ϝ ϯ τ • c o n f i g • η Ω ϡ Ϧ ς Ο • ։ ൃ ؀ ڥ • C I ؀ ڥ • ς ε τ • ϩ ά ղ ੳ • d a t a s t o r e ͷ ό ο Ϋ Ξ ο ϓ

Slide 20

Slide 20 text

20 σϓϩΠ w ("&ͷσϓϩΠํ๏ w αʔϏε͝ͱʹσϓϩΠΛ͢Δ w ࢦఆͨ͠όʔδϣϯͷΠϯελϯε͕࡞੒͞Εɺ63-͕ൃߦ͞ΕΔ w IUUQT\όʔδϣϯ^EPU\αʔϏε^EPU\ϓϩδΣΫτ^BQQTQPUDPN w όʔδϣϯ୯ҐͰCMVFHSFFOEFWFMPQNFOUΛ࣮ݱ͢Δػೳ͕ඪ४Ͱ༻ҙ w τϥϑΟοΫͷׂ߹Λࢦఆͯ͠੾Γସ͑ΒΕΔɺϩʔϧόοΫ΋༰қ w gcloud app deploy --version=${vers} ${ayml}

Slide 21

Slide 21 text

21 σϓϩΠ w /$ͰͷόʔδϣϯͷܾΊํ w ։ൃத͸ɺϒϥϯν໊ w σϓϩΠ͢Δ͝ͱʹ্ॻ͖͞ΕΔ w ຊ൪͸ɺ೔෇ίϛοτϋογϡ w σϓϩΠ͝ͱʹόʔδϣϯΛ࢒ͯ͠ɺϩʔϧόοΫՄೳͳঢ়ଶʹ͓ͯ͘͠

Slide 22

Slide 22 text

22 σϓϩΠ w σϓϩΠޙͷϔϧενΣοΫ w σϓϩΠεΫϦϓτͰࣗಈνΣοΫ w ࣦഊͨ͠ΒϚΠάϨʔγϣϯ͠ͳ͍ w ˌσϓϩΠͰ͖͍ͯΔ͜ͱΛ֬ೝ gcloud app versions list | grep "${αʔϏε} *${όʔδϣϯ}.*SERVING” || return 1 # HTTPεςʔλε 200͕ฦͬͯ͘Δ͜ͱΛ֬ೝ # init()ͷΤϥʔͳͲΛݕग़Ͱ͖Δ curl --fail https://${όʔδϣϯ}-dot-${αʔϏε}-dot-${ϓϩδΣΫτ}.appspot.com/_/health” > /dev/null 2>&1

Slide 23

Slide 23 text

23 σϓϩΠ w ஫ҙ w ("&ͷλεΫΩϡʔ΍DSPOͷઃఆ͸̍ϓϩδΣΫτͰ͔ͭ͠؅ཧ͞Εͳ͍ w ϚΠάϨʔγϣϯ͠ͳͯ͘΋σϓϩΠ͢Δͱॻ͖׵Θͬͯ͠·͏

Slide 24

Slide 24 text

• ٕ ज़ બ ఆ ͷ ج ຊ ํ ਑ • ϓ ϩ δ Σ Ϋ τ ߏ ੒ • α ʔ Ϗ ε ߏ ੒ • σ ϓ ϩ Π • Ξ ʔ Ω ς Ϋ ν ϟ • ϑ Ϩ ʔ Ϝ ϫ ʔ Ϋ ɺ ϥ Π ϒ ϥ Ϧ • A P I ϓ ϩ τ ί ϧ • A P I ։ ൃ ํ ਑ • A P I Ϋ ϥ Π Ξ ϯ τ ͱ υ Ω ϡ ϝ ϯ τ • c o n f i g • η Ω ϡ Ϧ ς Ο • ։ ൃ ؀ ڥ • C I ؀ ڥ • ς ε τ • ϩ ά ղ ੳ • d a t a s t o r e ͷ ό ο Ϋ Ξ ο ϓ

Slide 25

Slide 25 text

25 /$ͷΞʔΩςΫνϟ w Α͋͘ΔϨΠϠʔυΞʔΩςΫνϟ BQQMJDBUJPO IBOEMFS EPNBJO *OGSBTUSVDUVSF

Slide 26

Slide 26 text

26 ΞʔΩςΫνϟΛݕ౼͢ΔՁ஋ w ΞϓϦέʔγϣϯ։ൃʹूதͰ͖Δ w ػೳ௥ՃͷͨͼʹΞʔΩςΫνϟΛߟ͑Δͷ͸ඇޮ཰ w ౷Ұͨ͠ํ਑ͷίʔυ w ৽ϝϯόʔͷΩϟονΞοϓ͕༰қ

Slide 27

Slide 27 text

27 ΞʔΩςΫνϟΛݕ౼͢ΔՁ஋ͱϦεΫ w ਖ਼ղͰ͸ͳ͘ͱ΋ܾΊΔ͜ͱࣗମʹՁ஋͕͋Δ w ඞཁҎ্ʹਖ਼ղΛ௥͍ٻΊΔ͜ͱ͸ϦεΫ w ʮਖ਼͍͠%%%Λ࣮ݱ͢Δ͜ͱʯΛ໨తʹ͠ͳ͍ w ਖ਼͍͠ΞʔΩςΫνϟ͕׬੒͢Δ͜ͱ͸ͳ͍ͨΊɺແݶʹ࣌ؒΛফඅ͢ΔϦεΫ w ԿΛ໨తʹΞʔΩςΫνϟΛܾఆ͢Δ͔͕େ੾ w ͦͷΞʔΩςΫνϟΛબ୒ͨ͠ͳΒɺඞͣ໨తΛୡ੒͢Δ w ྫ w ໨తςετλϏϦςΟ͋͛Δ w खஈ%*Ͱ͖ΔΑ͏ʹϨΠϠʔ෼ׂΛ͢Δ w ໨తୡ੒ޙඞͣςετΛॻ͘ w ៉ྷʹͳͬͯຬ଍͢ΔͳΒػೳ։ൃΛ༏ઌ͢Δ w

Slide 28

Slide 28 text

28 ΞʔΩςΫνϟͷ໨తͱํ਑ w /$Ͱ͸ଟ͘ͷϏδωεϩδοΫΛ࣋ͭͨΊɺυϝΠϯΛॏ఺తʹςετ͍ͨ͠ w υϝΠϯͷςετΛಠཱ࣮ͯ͠ࢪͰ͖ΔΑ͏ʹ w ϏδωεϩδοΫ͕ಠཱ͍ͯ͠ͳ͍৔߹ͷςετ w )551ϦΫΤετͷ࡞੒ɺ%#ͷ؀ڥͷ࣮ߦɺ%#্ͷσʔλ४උ w ςετ؀ڥߏஙͷखؒ w ΦϯϝϞϦͰ׬݁͠ͳ͍ςετ͸஗͍ w େྔͷϞοΫΛ%* w ςετ؀ڥߏஙͷखؒ w ςετ࣮ߦ͕஗͘ɺ؀ڥߏங͕खؒͩͱςετΛॻ͔ͳ͘ͳΔ

Slide 29

Slide 29 text

29 /$ͷΞʔΩςΫνϟ w BQQMJDBUJPO૚ w υϝΠϯϞσϧɺ%#ɺ֎෦"1*ͳͲͱͷॲཧΛ·ͱΊ ͯɺΞϓϦέʔγϣϯͱͯ͠ͷػೳΛఏڙ͢Δɻ w %#͔Βऔಘ w υϝΠϯΛੜ੒ͯ͠ɺϝϞϦ্Ͱૢ࡞ w %#ʹอଘ BQQMJDBUJPO IBOEMFS EPNBJO *OGSBTUSVDUVSF func (a app)Buy(uid string, cid int64, amount, rate float64) error { u, err := a.RepoUser.Get(ctx, uid) // 1. DB͔Βऔಘ buy := domain.NewBuyOrder(u, cid, amount, rate) 2. υϝΠϯΛੜ੒ err := buy.Exec(ctx) // 2. υϝΠϯΛϝϞϦ্Ͱૢ࡞ err = a.RepoUser.Save(ctx, u) // 4 DBʹอଘ return nil }

Slide 30

Slide 30 text

30 /$ͷΞʔΩςΫνϟ w BQQMJDBUJPO૚ w BQQMJDBUJPOʹϏδωεϩδοΫΛॻ͔ͳ͍͜ͱ͕େ੾ w ҎԼͷίʔυ͸BQQMJDBUJPOʹϏδωεϩδοΫ͕࿙Ε͍ͯΔɻ w ߪೖॲཧΛςετ͢ΔͷʹBQQMJDBUJPO૚͕ඞਢʹͳΔɻ w %#ͷϞοΫૠೖ͕ඞਢʹͳΔςετͷϋʔυϧ্͕͕Δ func (a app)Buy(uid string, currency_id int64, amount, rate float64) error { u, err := a.RepoUser.Get(ctx, uid) // 1. DB͔Βऔಘ // ߪೖͨ͠௨՟Λ૿΍͢ b := u.GetBalance(currency_id) b.Add(amount) // ೔ຊԁΛݮΒ͢ yen := u.GetYenBalance() yen.Sub(amount * rate) err = a.RepoBalance.Save(ctx, b) // 4 DBʹอଘ return nil } ѱ͍ྫ

Slide 31

Slide 31 text

31 /$ͷΞʔΩςΫνϟ w ࣮ફυϝΠϯۦಈઃܭ1ϨΠϠҾ༻ w ΞϓϦέʔγϣϯαʔϏε͸ɺΞϓϦέʔγϣϯϨΠϠʹҐஔ෇͚ΒΕΔɻυϝΠϯαʔϏεͱ͸ҟͳ ΓɺυϝΠϯϩδοΫΛ࣋ͨͳ͍αʔϏεͩɻӬଓԽͷτϥϯβΫγϣϯ΍ɺηΩϡϦςΟΛ؅ཧ͢Δͨ Ίʹ࢖͏͜ͱ΋͋Δɻ·ͨɺଞͷγεςϜʹ௨஌ϝʔϧΛૹͬͨΓɺϢʔβ޲͚ͷϝʔϧͷϝοηʔδΛ ૊ΈཱͯͨΓ͢Δͷ΋ΞϓϦέʔγϣϯαʔϏεͷ໾ׂͩɻΞϓϦέʔγϣϯϨΠϠʹҐஔ͢ΔΞϓϦ έʔγϣϯαʔϏε͸ɺυϝΠϯϞσϧͷ௚઀ͷར༻ऀͰ͸͋Δ͕ɺࣗ෼ࣗ਎͸ϏδωεϩδοΫΛ࣋ͨ ͳ͍ɻ

Slide 32

Slide 32 text

• ٕ ज़ બ ఆ ͷ ج ຊ ํ ਑ • ϓ ϩ δ Σ Ϋ τ ߏ ੒ • α ʔ Ϗ ε ߏ ੒ • σ ϓ ϩ Π • Ξ ʔ Ω ς Ϋ ν ϟ • ϑ Ϩ ʔ Ϝ ϫ ʔ Ϋ ɺ ϥ Π ϒ ϥ Ϧ • A P I ϓ ϩ τ ί ϧ • A P I ։ ൃ ํ ਑ • A P I Ϋ ϥ Π Ξ ϯ τ ͱ υ Ω ϡ ϝ ϯ τ • c o n f i g • η Ω ϡ Ϧ ς Ο • ։ ൃ ؀ ڥ • C I ؀ ڥ • ς ε τ • ϩ ά ղ ੳ • d a t a s t o r e ͷ ό ο Ϋ Ξ ο ϓ

Slide 33

Slide 33 text

33 ϑϨʔϜϫʔΫɺϥΠϒϥϦͷબఆ w ࠶ܝ w ඞཁҎ্ʹརศੑΛ͋͛ΔͨΊʹϑϨʔϜϫʔΫ΍ϥΠϒϥϦΛ࠾༻͠ͳ͍ w ϑϨʔϜϫʔΫΛ࠾༻͢Δ͜ͱͰɺཧղ͕༰қʹͳΔ΋ͷΛ࠾༻͢Δɻ w ˓4JNQMF w ίʔυͷهड़Λ୹͘͢ΔͳͲɺ࡞ۀྔΛݮΒ͢͜ͱΛ໨తͱͨ͠΋ͷ͸࠾༻͠ͳ͍ɻ w ʷ&BTZ

Slide 34

Slide 34 text

34 ϑϨʔϜϫʔΫɺϥΠϒϥϦͷબఆ w 8FCΞϓϦέʔγϣϯϑϨʔϜϫʔΫʹٻΊΔػೳ w ϛυϧ΢ΣΞͷૠೖखஈ w ϧʔςΟϯάͷઃఆ w DIJIUUQTHJUIVCDPNHPDIJDIJ w FDIP΍HJO͸ඪ४ͷOFUIUUQͱ4FSWF)UUQϝιουͷΠϯλʔϑΣʔε͕ҟͳΔ w NJEEMFXBSFΛڬΉ৔߹ʹେن໛ͳมߋ͕ඞཁʹͳΔ r := chi.NewRouter() r.Use(func(w http.ResponseWriter, r *http.Request) { // ϩά }) r.Get("/", func(w http.ResponseWriter, r *http.Request) { w.Write([]byte(“welcome")) }) http.ListenAndServe(“:80", r)

Slide 35

Slide 35 text

35 ϑϨʔϜϫʔΫɺϥΠϒϥϦͷબఆ w HPSQ w (Pͷߏ଄ମͱ%#ͷςʔϒϧΛϚοϐϯά w HPSN w ςʔϒϧؒͷϦϨʔγϣϯΛղܾͯ͘͠ΕΔ w TFMFDUGSPNUBCMFΛॻ͘ඞཁ͕ͳ͍ type Product struct { Id int64 `db:"product_id, primarykey, autoincrement”` Price int64 `db:”unit_price"` } var p Product err := dbmap.SelectOne(&p, "select * from table WHERE id=? , id) p := &Product{1,2} err := dbmap.Insert(p)

Slide 36

Slide 36 text

• ٕ ज़ બ ఆ ͷ ج ຊ ํ ਑ • ϓ ϩ δ Σ Ϋ τ ߏ ੒ • α ʔ Ϗ ε ߏ ੒ • σ ϓ ϩ Π • Ξ ʔ Ω ς Ϋ ν ϟ • ϑ Ϩ ʔ Ϝ ϫ ʔ Ϋ ɺ ϥ Π ϒ ϥ Ϧ • A P I ϓ ϩ τ ί ϧ • A P I ։ ൃ ํ ਑ • A P I Ϋ ϥ Π Ξ ϯ τ ͱ υ Ω ϡ ϝ ϯ τ • c o n f i g • η Ω ϡ Ϧ ς Ο • ։ ൃ ؀ ڥ • C I ؀ ڥ • ς ε τ • ϩ ά ղ ੳ • d a t a s t o r e ͷ ό ο Ϋ Ξ ο ϓ

Slide 37

Slide 37 text

37 "1*ͷϓϩτίϧબఆ w ϓϩτίϧͷબఆ w 3&45"1* +40/31$PS(31$ w 3&45"1*ʹଇͬͯ63-ࢦ޲Ͱ)551ϝιουΛ࢖͍෼͚Δͷ͸ઃܭʹۤ࿑͢Δɻ +40/31$PS(31$ʁ w ("&͸(31$ະରԠ ݱࡏ w +40/31$ ɹ(31$͕࢖͍͍ͨ w ͳͥ(31$Λ࢖͍͍͔ͨʁ w 1SPUPDPM#V⒎FSTͷఆٛϑΝΠϧ w ΫϥΠΞϯτͱ"1*ͷιʔείʔυΛࣗಈੜ੒ w (31$Ͱ͋Δඞཁ͸ͳ͍

Slide 38

Slide 38 text

38 "1*ͷϓϩτίϧબఆ w ϓϩτίϧͷબఆ1SPUPDPM#V⒎FSTPO)551 w 3&45"1* +40/31$ (31$ͷ͍͍ͱ͜औΓ w 63-Ͱ࣮ߦ͢ΔϝιουΛࢦఆɻ w IUUQBQJFYNBQMFDPNW&YDIBOHF#VZ w )551ϝιου͸1045ͷΈ w ϦΫΤετɺϨεϙϯεɺϝιουͷܕ͸ɺ1SPUPDPM#V⒎FSTͰఆٛ w (31$ͱಉ༷ʹ(31$ͷπʔϧ܈Ͱιʔείʔυੜ੒Մೳ w 1SPUPDPM#V⒎FSTͷఆٛϑΝΠϧ͔Β(P 4XJGU 5ZQF4DSJQU +BWBͷίʔυੜ੒ w message BuyRequest{ int currency_id = 1; double amount = 2; double rate = 3; } message BuyResponse {} rpc Buy(BuyRequest) returns (BuyResponse);

Slide 39

Slide 39 text

39 "1*ͷϓϩτίϧબఆ1SPUPDPM#V⒎FSTPO)551ͱैདྷٕज़ͷൺֱ w 3&45"1*ͱൺֱ w ྑ͍఺31$ͳͷͰ"1*ઃܭ͕༰қ w 3&45Ͱ͸ɺ)551ϝιουɺ63-ͷݕ౼͕ඞཁ w 1VUϝιουW&YDIBOHF#BMBODF w 31$ͳΒɺϝιου͸1PTUݻఆɻ63-͸ίʔυ্ͷϝιουʹରԠɻ w W&YDOBIHF#VZ w +40/31$ͱൺֱ w ྑ͍఺1SPUPDPM#V⒎FSTʹΑΓɺΫϥΠΞϯτ͸"1*ͷมߋΛίϯύΠϧ࣌ʹݕग़ w ѱ͍఺ඪ४Ͱ͸ͳ͍ͷͰɺଞࣾ΍ެ։"1*ʹ͸޲͔ͳ͍ w (31$ͱൺֱ w ྑ͍఺)551ͳͷͰैདྷͷ؀ڥͰɺैདྷͷίʔυ͕ಈ͘ɻ w (31$͸ɺ(31$ͷίʔυΛॻ͘ඞཁ͕͋Δɻ w ѱ͍఺(31$ͷػೳ͕࢖͑ͳ͍ TUSFBN

Slide 40

Slide 40 text

40 "1*ͷϓϩτίϧબఆ1SPUPDPM#V⒎FSTPO)551Λ࢖ͬͯΈͯΑ͔ͬͨ఺ w 4UBDL%SJWFSͷϩά͕ݟ΍͍͢ w 63-͚ͩͰϝιουΛಛఆͰ͖Δɻ w 3&45)551ϝιουΛ֬ೝ͢Δඞཁ͋Γ w +40/31$63-͢΂ͯಉ͡ͳͷͰϩάͷҰཡΛݟͯ΋ύοͱݟͯΘ͔Βͳ͍ w 1SPUPDPM#V⒎FSTPO)551 w 63-W&YDOBIHF#VZ

Slide 41

Slide 41 text

41 "1*ͷϓϩτίϧબఆ1SPUPDPM#V⒎FSTPO)551Λར༻ͨ͠։ൃ w 1SPUPDPM#V⒎FSTPO)551ͷ31$ w σόοά༻ʹ+40/ʹ΋ରԠͨ͠ w )551ϔομͷ$POUFOU5ZQFͱ"DDFQUΛར༻͢Δ w (31$ͷHSQDHBUFXBZͱಉ͡໾ׂ w

Slide 42

Slide 42 text

42 "1*ͷϓϩτίϧબఆ w UXJSQUXJDI੡ͷ31$GSBNFXPSL w IUUQTCMPHUXJUDIUWUXJSQBTXFFUOFXSQDGSBNFXPSLGPSHPGGFCCGG w 1SPUPDPM#V⒎FST͚ͩͰ͸ͳ͘+40/ʹ΋ରԠ w )551ͷͨΊैདྷͷ؀ڥͰ࢖͑Δ w .JDSPTFSWJDFTؒͷ௨৴Λ૝ఆͯ͠࡞ΒΕͨϑϨʔϜϫʔΫͳͷͰɺ(Pͷίʔυ͔͠ ੜ੒ͯ͘͠ΕͣɺΫϥΠΞϯτͱͷར༻͸Ͱ͖ͳ͍

Slide 43

Slide 43 text

43 "1*ͷϓϩτίϧબఆ w (31$PS)551PO1SPUPDPM#V⒎FSTͷݕ౼ w ໨త͸ w ߏ଄Խ͞ΕͨఆٛϑΝΠϧ͔ΒιʔείʔυΛੜ੒͍ͨ͠ w PS w TUSFBN͕࢖͍͍ͨɻͦͷଞ(31$ݻ༗ͷػೳΛ࢖͍͍ͨɻ w े෼ͳ։ൃϦιʔε͕͋Δ͔ w (31$Λ࠾༻ͯ͠ैདྷͷγεςϜ΍ίʔυ͕࢖͑ͳ͍ͱ͖ରԠՄೳ͔

Slide 44

Slide 44 text

• ٕ ज़ બ ఆ ͷ ج ຊ ํ ਑ • ϓ ϩ δ Σ Ϋ τ ߏ ੒ • α ʔ Ϗ ε ߏ ੒ • σ ϓ ϩ Π • Ξ ʔ Ω ς Ϋ ν ϟ • ϑ Ϩ ʔ Ϝ ϫ ʔ Ϋ ɺ ϥ Π ϒ ϥ Ϧ • A P I ϓ ϩ τ ί ϧ • A P I ։ ൃ ํ ਑ • A P I Ϋ ϥ Π Ξ ϯ τ ͱ υ Ω ϡ ϝ ϯ τ • c o n f i g • η Ω ϡ Ϧ ς Ο • ։ ൃ ؀ ڥ • C I ؀ ڥ • ς ε τ • ϩ ά ղ ੳ • d a t a s t o r e ͷ ό ο Ϋ Ξ ο ϓ

Slide 45

Slide 45 text

45 "1*։ൃํ਑ w "1*͸มΘΔલఏͰɺΫϥΠΞϯτͷ։ൃΛࢭΊͳ͍Α͏ʹॻ͍͍ͯ͘ w ճ͘Β͍େ෯ͳมߋ͓ئ͍͍ͯ͠Δ w ࠷ॳ͔Β࢓༷Λ໢ཏ͢Δ͜ͱ͸ແཧ w ΫϥΠΞϯτνʔϜʹ͸ɺʮϦϦʔε·Ͱ͸มΘΓଓ͚Δͷڐͯ͠ʯ w ٯʹΫϥΠΞϯτ͔Βͷཁ๬͸ۃྗड͚Δ w ࢓༷͕໢ཏ͞ΕΔॠؒ͸ϦϦʔε௚લ w ϦϦʔε௚લ͕Ұ൪͍͍"1*Λ࡞Δ͜ͱ͕Ͱ͖Δ w ͦΕ·Ͱ௚͠ଓ͚Δ w ྑ͍΋ͷΛ࡞Γ͍ͨͱ͍͏ҙ͕ࣝڞ༗͞Ε͍ͯΔϝϯόʔͳͷͰڐ͞ΕΔ w ײँ

Slide 46

Slide 46 text

• ٕ ज़ બ ఆ ͷ ج ຊ ํ ਑ • ϓ ϩ δ Σ Ϋ τ ߏ ੒ • α ʔ Ϗ ε ߏ ੒ • σ ϓ ϩ Π • Ξ ʔ Ω ς Ϋ ν ϟ • ϑ Ϩ ʔ Ϝ ϫ ʔ Ϋ ɺ ϥ Π ϒ ϥ Ϧ • A P I ϓ ϩ τ ί ϧ • A P I ։ ൃ ํ ਑ • A P I Ϋ ϥ Π Ξ ϯ τ ͱ υ Ω ϡ ϝ ϯ τ • c o n f i g • η Ω ϡ Ϧ ς Ο • ։ ൃ ؀ ڥ • C I ؀ ڥ • ς ε τ • ϩ ά ղ ੳ • d a t a s t o r e ͷ ό ο Ϋ Ξ ο ϓ

Slide 47

Slide 47 text

47 "1*ΫϥΠΞϯτͱυΩϡϝϯτ w "1*ΫϥΠΞϯτ w ։ൃதͷ"1*Λୟ͘खஈΛͲ͏͢Δ͔ʁ w DVSM w ։ൃऀ͝ͱͷಠࣗΫϥΠΞϯτ w ։ൃதͷΞϓϦ͔Βୟ͘

Slide 48

Slide 48 text

48 "1*ΫϥΠΞϯτͱυΩϡϝϯτ w 1PTUNBOΛνʔϜͰڞ༗͢Δ͜ͱͰɺαʔόαΠυɺΫϥΠΞϯταΠυͷΤϯδχΞ ͕ؾܰʹ"1*Λୟ͚Δ؀ڥΛ༻ҙ͢Δ

Slide 49

Slide 49 text

49 "1*ΫϥΠΞϯτͱυΩϡϝϯτ w ("&͸σϓϩΠ͢Δ͚ͩͰɺϒϥϯνઐ༻ͷ63-͕ൃߦ͞ΕΔͨΊɺΞΫηε͢Δ63- Λม਺ʹ͓ͯ͘͜͠ͱͰɺؾܰʹΞΫηεઌΛม͑ΒΕΔ w IUUQT\όʔδϣϯ^EPU\αʔϏε^EPU\ϓϩδΣΫτ^BQQTQPUDPN w ϝϯςϞʔυதͷόʔδϣϯ w IUUQTNBJOUFOBODFEPUBQJEPUQSPKFDU"BQQTQPUDPN ؀ڥม਺Λઃఆ ؀ڥม਺ͷ੾Γସ͑

Slide 50

Slide 50 text

50 "1*ΫϥΠΞϯτͱυΩϡϝϯτ w ϨεϙϯεΛม਺ʹઃఆͰ͖ΔͷͰɺ"DDFTT5PLFOͷ؅ཧ΋͓खܰ w "DDFTT5PLFOͷϨεϙϯε w ϨεϙϯεΛ؀ڥม਺ʹઃఆ w ϦΫΤετΛૹΔࡍͷɺ)551ϔομʔͰ؀ڥม਺Λࢀর var res = JSON.parse(responseBody); postman.setEnvironmentVariable("ACCESS_TOKEN", res.token); { "token": “accesstokennnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnn" }

Slide 51

Slide 51 text

51 "1*ΫϥΠΞϯτͱυΩϡϝϯτ w 1PTUNBOΛνʔϜͰڞ༗͢Δ͜ͱͰɺαʔόαΠυɺΫϥΠΞϯταΠυͷΤϯδχΞ ͕ؾܰʹ"1*Λୟ͘͜ͱ͕Մೳ w ։ൃதͷ໰୊ൃੜ࣌ͷ੾Γ෼͚͕༰қʹͳΔ w 1PTUNBO͔Βୟ͍ͯ΋໰୊͕͋Ε͹αʔόʹ໰୊͋ΔՄೳੑ͕ߴ͍ w ΫϥΠΞϯτΤϯδχΞ΋αʔόαΠυΤϯδχΞʹ໰୊ڀ໌ΛཔΈ΍͘͢ͳΔ w ࣮ࡍʹಈ͘΋ͷ͕͋ΔͷͰɺυΩϡϝϯτͷ୅ΘΓʹͳΔ w 1SPUPDPM#V⒎FSTͷఆٛϑΝΠϧͱ߹Θͤͯ࢓༷ͷཧղ͕Մೳ w Θ͔Βͳ͍ͱ͜Ζ͕͋Ε͹ฉ͍ͯ΋Βͬͯղܾ w 4XBHHFS΋ඞཁͳ͍

Slide 52

Slide 52 text

• ٕ ज़ બ ఆ ͷ ج ຊ ํ ਑ • ϓ ϩ δ Σ Ϋ τ ߏ ੒ • α ʔ Ϗ ε ߏ ੒ • σ ϓ ϩ Π • Ξ ʔ Ω ς Ϋ ν ϟ • ϑ Ϩ ʔ Ϝ ϫ ʔ Ϋ ɺ ϥ Π ϒ ϥ Ϧ • A P I ϓ ϩ τ ί ϧ • A P I ։ ൃ ํ ਑ • A P I Ϋ ϥ Π Ξ ϯ τ ͱ υ Ω ϡ ϝ ϯ τ • c o n f i g • η Ω ϡ Ϧ ς Ο • ։ ൃ ؀ ڥ • C I ؀ ڥ • ς ε τ • ϩ ά ղ ੳ • d a t a s t o r e ͷ ό ο Ϋ Ξ ο ϓ

Slide 53

Slide 53 text

53 DPOpH w ։ൃϓϩδΣΫτ͝ͱʹDPOpHΛઃఆ͍ͨ͠ w 42-ͷ઀ଓઌͳͲ w DPOpHͷ࣮ݱํ๏ w ZBNM΍UPNMͰಠࣗͷDPOpHϞδϡʔϧΛ࡞Δʁ w ("&Ͱ͸BQQZBNMͷ؀ڥม਺ʹઃఆ͢Δͷ͕ηΦϦʔ w DPOpHͷ੾Γସ͑ํ๏ w DPOpHZBNMΛ؀ڥ͝ͱʹ࡞੒ͯ͠ɺBQQZBNM͔ΒJODMVEF͢Δ w σϓϩΠ࣌ʹDPOpHZBNMΛγϯϘϦοΫϦϯΫͰ੾Γସ͑Δ env_variables: MYSQL_CONNECTION : user:pass@cloudsql(project:asia-northeast1:xxxxx)/yyy includes: - config.yaml

Slide 54

Slide 54 text

54 DPOpH w DPOpHͷಡΈࠐΈํ w ؀ڥม਺ΛίʔυʹಡΈࠐΉͨΊʹFOWDPOpHΛ࠾༻ɻ w DPOpHͷ஋ΛඞཁʹͳͬͨλΠϛϯάͰ؀ڥม਺͔ΒಡΈࠐΉͷͰ͸ͳ͘ɺJOJU࣌ʹ ߏ଄ମʹಡΈࠐΜͰ͓͘ w type Config struct { MysqlConnection string `required:"true" split_words:"true"` var C Config func Setup() { if err := envconfig.Process(“prefix", &C); err != nil { panic(err) } }

Slide 55

Slide 55 text

55 DPOpH w DPOpHͷಡΈࠐΈํ w ·ͨಡΈࠐΜͩ஋Λ֤ϨΠϠʔ͔Β௚઀ࢀর͸ͤͣɺJOJU࣌ʹ֤ϨΠϠʔͷߏ଄ମʹ ηοτ͓ͯ͘͠ɻ w ςετ࣌ʹDPOpHϞδϡʔϧ͕ඞਢʹͳΔ͜ͱΛආ͚Δ w ςελϏϦςΟͷ޲্

Slide 56

Slide 56 text

• ٕ ज़ બ ఆ ͷ ج ຊ ํ ਑ • ϓ ϩ δ Σ Ϋ τ ߏ ੒ • α ʔ Ϗ ε ߏ ੒ • σ ϓ ϩ Π • Ξ ʔ Ω ς Ϋ ν ϟ • ϑ Ϩ ʔ Ϝ ϫ ʔ Ϋ ɺ ϥ Π ϒ ϥ Ϧ • A P I ϓ ϩ τ ί ϧ • A P I ։ ൃ ํ ਑ • A P I Ϋ ϥ Π Ξ ϯ τ ͱ υ Ω ϡ ϝ ϯ τ • c o n f i g • η Ω ϡ Ϧ ς Ο • ։ ൃ ؀ ڥ • C I ؀ ڥ • ς ε τ • ϩ ά ղ ੳ • d a t a s t o r e ͷ ό ο Ϋ Ξ ο ϓ

Slide 57

Slide 57 text

57 ηΩϡϦςΟ w $MPVE,.4 w ݸਓ৘ใɺ֎෦ͷ"1*ΩʔͳͲྲྀग़ͯ͠͸͍͚ͳ͍΋ͷ͸$MPVE,.4Λ࢖ͬͯ҉߸Խ্ͨ͠Ͱ อଘ͢Δɻ w ҉߸Խ͢Δ͏͑Ͱͷൿີ伴Λಠࣗʹ༻ҙͯ͠؅ཧ͢Δඞཁ͕ͳ͍ɻ w ௚઀EBUBTUPSFͷσʔλ͕ྲྀग़ͯ͠΋҉߸Խ͞Ε͍ͯΔͨΊ໰୊͸ى͖ͳ͍ɻ w 伴ͷϩʔςʔτΛఆظతʹ͢Δ͜ͱͰɺྲྀग़ͨ͠ࡍͷϦεΫΛ௿ݮɻ w 伴ͷϩʔςʔτͷ࠶҉߸ԽͳͲ΋Մೳɻ w ΦʔφʔݖݶΛ࣋ͬͨ(PPHMFΞΧ΢ϯτͱύεϫʔυ͕ྲྀग़ͨ͠৔߹ͷΈ໰୊ͱͳΔɻ w $MPVE,.4ࣗମͷೝূ͸("&ͷαʔϏεΞΧ΢ϯτͰߦ͏ɻ w ݖݶΛ࣋ͬͨαʔϏεΞΧ΢ϯτͷΩʔΛੜ੒͍ͯ͠ͳ͚Ε͹ɺ֎෦͔Β$MPVE,.4Λୟ ͘͜ͱ΋Ͱ͖ͳ͍ɻ w ΋͠αʔϏεଆͷϢʔβͷΞΧ΢ϯτͱύεϫʔυ͕࿙Εͨ৔߹ʹ΋ɺର৅Ϣʔβͷݸਓ৘ใ ͔͠ྲྀग़͸͠ͳ͍ɻ w ৄࡉ͸ެࣜυΩϡϝϯτͱHDQVHOPVIBVΛࢀর w IUUQTHJUIVCDPNHDQVHOPVIBVUSFFNBTUFSDMPVELNTQPFNJOUSPEVDUJPO w

Slide 58

Slide 58 text

• ٕ ज़ બ ఆ ͷ ج ຊ ํ ਑ • ϓ ϩ δ Σ Ϋ τ ߏ ੒ • α ʔ Ϗ ε ߏ ੒ • σ ϓ ϩ Π • Ξ ʔ Ω ς Ϋ ν ϟ • ϑ Ϩ ʔ Ϝ ϫ ʔ Ϋ ɺ ϥ Π ϒ ϥ Ϧ • A P I ϓ ϩ τ ί ϧ • A P I ։ ൃ ํ ਑ • A P I Ϋ ϥ Π Ξ ϯ τ ͱ υ Ω ϡ ϝ ϯ τ • c o n f i g • η Ω ϡ Ϧ ς Ο • ։ ൃ ؀ ڥ • C I ؀ ڥ • ς ε τ • ϩ ά ղ ੳ • d a t a s t o r e ͷ ό ο Ϋ Ξ ο ϓ

Slide 59

Slide 59 text

59 ։ൃ؀ڥ w ৽نͷ։ൃऀ͕ೖͬͨࡍͷ։ൃ؀ڥߏங w (Pͷ։ൃ؀ڥ w HPJNQPSUT w EFQ w ΤσΟλɺ*%&͸ࣗ༝ w 7JN w (P-BOE w HPMBOHUPLZPˌͰ(P։ൃ؀ڥ(PHMBOEͷϥΠϒσϞΛݟ͖ͯͨ w IUUQUFDINFSDBSJDPNFOUSZ w

Slide 60

Slide 60 text

60 ։ൃ؀ڥ w ৽نͷ։ൃऀ͕ೖͬͨࡍͷ("&։ൃ؀ڥߏங w ίϚϯυϥΠϯͰ͢΂ͯΛ࣮ݱ w ($1ͷίϯιʔϧΛ৮Βͳ͍ w ίϚϯυͳΒखॱ͕࢒ΓɺεΫϦϓτͱͯ͠ߏ੒؅ཧ͕Մೳ w *OGSBTUSVDUVSFBTDPEFɺίϚϯυΛௐ΂Ε͹ԿΛ΍͍ͬͯΔ͔Θ͔Δ w 8JLJͳͲʹखॱΛ·ͱΊΔඞཁ΋ͳ͍ w ($1ίϯιʔϧ͸೔ʑߋ৽͞ΕΔͨΊυΩϡϝϯτͷ௥ै͕೉͍͠ w ؀ڥߏங࣌ʹ౓͚ͩॱ൪ʹίϚϯυΛୟ͚ͩ͘ͳͷͰTIFMMTDSJQUͰ࣮ݱ w 04ͷঢ়ଶ؅ཧ͢ΔΘ͚Ͱ͸ͳ͍ͨΊEPDLFS BOTJCMF DIFG͸ར༻͠ͳ͍

Slide 61

Slide 61 text

• ٕ ज़ બ ఆ ͷ ج ຊ ํ ਑ • ϓ ϩ δ Σ Ϋ τ ߏ ੒ • α ʔ Ϗ ε ߏ ੒ • σ ϓ ϩ Π • Ξ ʔ Ω ς Ϋ ν ϟ • ϑ Ϩ ʔ Ϝ ϫ ʔ Ϋ ɺ ϥ Π ϒ ϥ Ϧ • A P I ϓ ϩ τ ί ϧ • A P I ։ ൃ ํ ਑ • A P I Ϋ ϥ Π Ξ ϯ τ ͱ υ Ω ϡ ϝ ϯ τ • c o n f i g • η Ω ϡ Ϧ ς Ο • ։ ൃ ؀ ڥ • C I ؀ ڥ • ς ε τ • ϩ ά ղ ੳ • d a t a s t o r e ͷ ό ο Ϋ Ξ ο ϓ

Slide 62

Slide 62 text

62 $*؀ڥ w $*πʔϧʹٻΊΔػೳ w %PDLFSJNBHF͕࢖͑Δ w Ωϟογϡػೳ͕͋Δ w ߴ଎ w ෳࡶͳػೳΛ$*πʔϧʹٻΊͳ͍+FOLJOT͓͡͞Μ͕ඞཁʹͳΔ͜ͱΛආ͚Δ

Slide 63

Slide 63 text

63 $*؀ڥ w $JSDMF$* w USBWJT͔ΒҠͬͨΒഒʹ w $JSDMF$*ΑΓ଎͍4BB4͕ͰͨΒҠߦ͍ͯ͘͠ w ("&(P༻ͷ$*ΠϝʔδNFSDBSJEPDLFSBQQFOHJOFHP w HPBQQUFTU΍HDMPVEʹΑΔσϓϩΠ͕Մೳ w ෆ଍͍ͯ͠Δπʔϧ͸NFSDBSJBQQFOHJOFHPΛϕʔεΠϝʔδͱͯ͠ಠࣗΠϝʔδΛ࡞੒ w $JSDMF$*্ͰπʔϧͷΠϯετʔϧ͸͠ͳ͍ w ςετ͕஗͘ͳΔ w ஗͘ͳΒͳ͍ͨΊʹΩϟογϡ͢ΔॲཧΛॻ͘ͱDJSDMFDJDPOpHZBNM͕େ͖͘ͳΔ w $*πʔϧ΁ͷґଘ͕େ͖͘ͳΔ

Slide 64

Slide 64 text

64 $*؀ڥ w ద੾ʹ੹຿Λ෼ׂ w $JSDMF$* DJSDMFDJDPOpHZBNM w %PDLFSJNBHF w .BLFpMF w TIFMMTDSJQU

Slide 65

Slide 65 text

65 $*؀ڥ w ద੾ʹ੹຿Λ෼ׂ w $JSDMF$* DJSDMFDJDPOpHZBNM w ࣮ߦ؀ڥͷࢦఆ w ϦϙδτϦͷDMPOF w $*΁ͷࢦࣔ w $JFDMF$*͸ϩʔΧϧͰ࣮ߦՄೳ w DJFDMFDJCVJME w $*؀ڥͷσόοάʹศར version: 2 jobs: build: working_directory: /go/src/github.com/org/proj docker: - image: sonatard/appengine-go steps: - checkout - run: command: make ci

Slide 66

Slide 66 text

66 $*؀ڥ w ద੾ʹ੹຿Λ෼ׂ w %PDLFSJNBHF w ࣮ߦ؀ڥͷߏஙʹಛԽ͢Δ w Πϝʔδʹ͸ϓϩδΣΫτͷݻ༗৘ใ͸ࡌͤͳ͍ w 伴 w $JSDMF$*ͷ؀ڥม਺ʹઃఆ w ιʔείʔυ w (JUIVCϦϙδτϦʹ഑ஔ w ެ։ՄೳͳΠϝʔδʹ͢Δ w ೝূɺηΩϡϦςΟͷۤ࿑͕ͳ͘ͳΔ w FROM mercari/appengine-go:1.8-slim ←ϕʔεΠϝʔδʹ͢Δ ARG PROTOC_VERSION=3.4.0 RUN curl -fo protoc.zip -sSL “https://github.com/protobuf/releases/protoc-${PROTOC_VERSION}-linux-x86_64.zip" // ུ

Slide 67

Slide 67 text

67 $*؀ڥ w ద੾ʹ੹຿Λ෼ׂ w .BLFpMF w ਓؒͱTIFMMTDSJQUΛܨ͙ΠϯλʔϑΣʔε w NBLFpMFʹॲཧ͸ॻ͔ͣɺTIFMMTDSJQUͷίϚϯυΛ࣮ߦ͢Δ͚ͩ w $*Ͱ࣮ߦ͢ΔίϚϯυͱ։ൃͰ࣮ߦ͢ΔίϚϯυ͸ՄೳͳݶΓಉ౳ʹ͢Δ w dep: dep ensure -vendor-only -v test: gen test.sh $(GOLIST) ci: ci.sh deploy_qa: gen deploy.sh qa $(ALL_SERVICES) deploy_prod: gen deploy.sh qa $(ALL_SERVICES)

Slide 68

Slide 68 text

68 $*؀ڥ w ద੾ʹ੹຿Λ෼ׂ w TIFMMTDSJQU w ۩ମతͳॲཧΛهड़͢Δ GOLIST=$(goapp list ./... | grep -v vendor) test.sh ${GOLIST} branch=$(git rev-parse --abbrev-ref @) if [ "x${branch}" = "xmaster" ] ; then deploy_target="qa" else # ։ൃϒϥϯν͸σϓϩΠ͠ͳ͍ return 0 fi all_services="api batch pre default" deploy.sh "${deploy_target}" “${all_services}"

Slide 69

Slide 69 text

• ٕ ज़ બ ఆ ͷ ج ຊ ํ ਑ • ϓ ϩ δ Σ Ϋ τ ߏ ੒ • α ʔ Ϗ ε ߏ ੒ • σ ϓ ϩ Π • Ξ ʔ Ω ς Ϋ ν ϟ • ϑ Ϩ ʔ Ϝ ϫ ʔ Ϋ ɺ ϥ Π ϒ ϥ Ϧ • A P I ϓ ϩ τ ί ϧ • A P I ։ ൃ ํ ਑ • A P I Ϋ ϥ Π Ξ ϯ τ ͱ υ Ω ϡ ϝ ϯ τ • c o n f i g • η Ω ϡ Ϧ ς Ο • ։ ൃ ؀ ڥ • C I ؀ ڥ • ς ε τ • ϩ ά ղ ੳ • d a t a s t o r e ͷ ό ο Ϋ Ξ ο ϓ

Slide 70

Slide 70 text

70 ςετ w 5BCMF%SJWFO5FTU w ςετέʔεΛ໢ཏ͢Δ͜ͱ͕໌ࣔ͞ΕΔ w UFTUJGZͳͲͷςετϑϨʔϜϫʔΫ͸࢖Θͳ͍ w ̍ϝιουʹଟͯ͘ճ͘Β͍ͷ஋ൺֱͳͷͰɺૉ௚ʹΤϥʔग़ྗΛࣗ෼Ͱॻ͘ w ߏ଄ମͷൺֱͷͨΊʹHPDNQΛར༻ w IUUQTHJUIVCDPNHPPHMFHPDNQ w ςετ༻ͷ֎෦πʔϧΛۃྗ࢖Θͳ͍ w πʔϧΛֶͿίετ w ςετΛॻ͘ϋʔυϧͷ૿Ճ

Slide 71

Slide 71 text

71 ςετ w ϞοΫͷૠೖ͸ςετ͕ෳࡶʹͳΔͷͰۃྗճආ͍ͨ͠ w ςετͰϞοΫΛૠೖ͕ඞཁʹͳΒͳ͍Α͏ɺઃܭͯ͠ίʔυΛॻ͘ w υϝΠϯ͸ɺଞͷϨΠϠʔґଘΛͳ͘͢ w ΞϓϦέʔγϣϯ΁ͷϏδωεϩδοΫͷ࿙ӮΛආ͚Δ w 4VC5FTUΛ࢖͏ w ͲͷςετέʔεͰམ͔ͪͨΒΘ͔Γ΍͘͢͢ΔͨΊ w IUUQTXXXTMJEFTIBSFOFUUBLVZBVFEBHPGSJEBZ w

Slide 72

Slide 72 text

• ٕ ज़ બ ఆ ͷ ج ຊ ํ ਑ • ϓ ϩ δ Σ Ϋ τ ߏ ੒ • α ʔ Ϗ ε ߏ ੒ • σ ϓ ϩ Π • Ξ ʔ Ω ς Ϋ ν ϟ • ϑ Ϩ ʔ Ϝ ϫ ʔ Ϋ ɺ ϥ Π ϒ ϥ Ϧ • A P I ϓ ϩ τ ί ϧ • A P I ։ ൃ ํ ਑ • A P I Ϋ ϥ Π Ξ ϯ τ ͱ υ Ω ϡ ϝ ϯ τ • c o n f i g • η Ω ϡ Ϧ ς Ο • ։ ൃ ؀ ڥ • C I ؀ ڥ • ς ε τ • ϩ ά ղ ੳ • d a t a s t o r e ͷ ό ο Ϋ Ξ ο ϓ

Slide 73

Slide 73 text

73 ϩάղੳ w ($1ͱ͍͑͹#JH2VFSZ w ඞཁͦ͏ͳϩά͸4UBDL%SJWFSʹ͸͍ͯ#JH2VFSZʹΠϯϙʔτ͓ͯ͘͠ w "1*ͷΞΫηεϩάͳͲ w ো֐࣌ʹͱͯ΋໾ʹཱͭ w

Slide 74

Slide 74 text

• ٕ ज़ બ ఆ ͷ ج ຊ ํ ਑ • ϓ ϩ δ Σ Ϋ τ ߏ ੒ • α ʔ Ϗ ε ߏ ੒ • σ ϓ ϩ Π • Ξ ʔ Ω ς Ϋ ν ϟ • ϑ Ϩ ʔ Ϝ ϫ ʔ Ϋ ɺ ϥ Π ϒ ϥ Ϧ • A P I ϓ ϩ τ ί ϧ • A P I ։ ൃ ํ ਑ • A P I Ϋ ϥ Π Ξ ϯ τ ͱ υ Ω ϡ ϝ ϯ τ • c o n f i g • η Ω ϡ Ϧ ς Ο • ։ ൃ ؀ ڥ • C I ؀ ڥ • ς ε τ • ϩ ά ղ ੳ • d a t a s t o r e ͷ ό ο Ϋ Ξ ο ϓ

Slide 75

Slide 75 text

75 EBUBTUPSFͷόοΫΞοϓ w EBUBTUPSF($4 w ($4#JH2VFSZ w IUUQTHJUIVCDPNGBWDMJQETCR

Slide 76

Slide 76 text

• ٕ ज़ બ ఆ ͷ ج ຊ ํ ਑ • ϓ ϩ δ Σ Ϋ τ ߏ ੒ • α ʔ Ϗ ε ߏ ੒ • σ ϓ ϩ Π • Ξ ʔ Ω ς Ϋ ν ϟ • ϑ Ϩ ʔ Ϝ ϫ ʔ Ϋ ɺ ϥ Π ϒ ϥ Ϧ • A P I ϓ ϩ τ ί ϧ • A P I ։ ൃ ํ ਑ • A P I Ϋ ϥ Π Ξ ϯ τ ͱ υ Ω ϡ ϝ ϯ τ • c o n f i g • η Ω ϡ Ϧ ς Ο • ։ ൃ ؀ ڥ • C I ؀ ڥ • ς ε τ • ϩ ά ղ ੳ • d a t a s t o r e ͷ ό ο Ϋ Ξ ο ϓ

Slide 77

Slide 77 text

77 ·ͱΊ w /FYU$VSSFODZͷߏ੒ w (PPHMF"QQ&OHJOF(PEBUBTUPSF$MPVE42- w ϑϨʔϜϫʔΫHPDIJ ϧʔςΟϯάͱϛυϧ΢ΣΞ w ߏ଄ମͱ%#ςʔϒϧͷόΠϯυHPSQ w ϨΠϠʔυΞʔΩςΫνϟ )BOEMFS "QQMJDBUJPO %PNBJO *OGSBTUSVDUVSF w (31$ޓ׵ͷಠࣗ)551ϕʔεͷ31$ w DPOpHFOWDPOpH w $JSDMF$* NFSDBSJEPDLFSBQQFOHJOFHPQSPUPDΛՃ͑ͨΠϝʔδ w 5FTUඪ४ͷUFTUJOHύοέʔδHPDNQ w σόοά༻"1*ΫϥΠΞϯτ1PTUNBO w ػີ৘ใͷ؅ཧ$MPVE,.4 w ղੳ#JH2VFSZ w 4UBDL%SJWFS͔ΒΠϯϙʔτ w EBUBTUPSF͔ΒΠϯϙʔτ GBWDMJQETCR

Slide 78

Slide 78 text

78 ͋Γ͕ͱ͏͍͟͝·ͨ͠