Slide 1

Slide 1 text

2021/9/8 Πϯλʔϯ͔Βೖࣾͯ͠Railsͷϝʔϧૹ৴ΛSengGridʹҠߦͯ͠Έͯ Πϯλʔϯ͔Βೖࣾͯ͠
 Railsͷϝʔϧૹ৴ΛSendGrid ʹҠߦͯ͠Έͯ ϥϯαʔζגࣜձࣾ ։ൃ෦/ฏ໺ୡ໵

Slide 2

Slide 2 text

2021/9/8 ʲLancers x SUPER STUDIOʳEngineer Meetup ΞδΣϯμ • ࣗݾ঺հ • ϑϥϯεྉཧਓ͔ΒRailsΛษڧ͠ɺۦ͚ग़͠ΤϯδχΞ΁ • MENTAͱͷग़ձ͍ • ϙʔτϑΥϦΦ࡞੒ͷϙΠϯτ • ϥϯαʔζΠϯλʔϯ΁ೖࣾ • Lancers Assistant/Creativeͷ঺հ • ϝʔϧૹ৴ΛSendGrid΁Ҡߦ • ·ͱΊ

Slide 3

Slide 3 text

2021/9/8 Πϯλʔϯ͔Βೖࣾͯ͠Railsͷϝʔϧૹ৴ΛSengGridʹҠߦͯ͠Έͯ ࣗݾ঺հ

Slide 4

Slide 4 text

2021/9/8 ʲLancers x SUPER STUDIOʳEngineer Meetup ࣗݾ঺հ ฏ໺ ୡ໵(ͻΒͷ ͨͭ΍ ) • Lancers৽ଔΤϯδχΞ • ϑϥϯεྉཧਓˠ2020/11ʹΠϯλʔϯ
 ͱͯ͠δϣΠϯɻ4݄͔Βਖ਼ࣾһʹ • Rails੡ͷLCC(LancersCreativeCloud)Λ։ൃ • झຯ: ஋ஈ͸͍͚҆Ͳྉཧ͕ඒຯ͍͠
 ډञ԰Λ୳͢͜ͱ(࠷ۙ͸ࣗॗؾຯɻɻ ) tatuya4451 @44511336tatuya

Slide 5

Slide 5 text

2021/9/8 Πϯλʔϯ͔Βೖࣾͯ͠Railsͷϝʔϧૹ৴ΛSengGridʹҠߦͯ͠Έͯ ͳͥϑϥϯεྉཧਓ͔Β
 ׬શҟۀछͷΤϯδχΞΛ໨ࢦͨ͠ͷ͔

Slide 6

Slide 6 text

2021/9/8 ʲLancers x SUPER STUDIOʳEngineer Meetup ϑϥϯεྉཧਓ͔Βۦ͚ग़͠ΤϯδχΞ΁ ಇ͍ͯͨళฮ • ϑϥϯεͷҰͭ੕ϨετϥϯʮChartronʯ • େࡕҰͭ੕ʮAgneldorʯ • ϋΠΞοτϦʔδΣʔϯγʔେࡕ ߴߍੜͷ࣌ɺ฼ͱϑϨϯνΛ৯΂ʹ͍͖িܸΛड͚Δɻ
 →⁋ௐཧࢣઐ໳ֶߍ΁ೖֶ • แஸͷ࢖͍ํ͔Βϑϥϯεޠɺௐཧ࣮शΛ௨ͯ͠ϑϨϯνͷجຊΛֶͿ • ଔۀޙɺϑϥϯε΁Ұ೥ཹֶ • ൒೥ؒ͸ϑϥϯεୈೋͷ౎ࢢϦϤϯͷ͓৓Ͱ(ߍࣷ)ͰޠֶɺྉཧΛษڧ • ࢒Γͷ൒೥͸ݱ஍ݚमΛߦ͏ • ؼࠃޙ͸େࡕͷொ৔΍ϗςϧͰݚᮎΛੵΉ

Slide 7

Slide 7 text

2021/9/8 ʲLancers x SUPER STUDIOʳEngineer Meetup ϑϥϯεྉཧਓ͔Βۦ͚ग़͠ΤϯδχΞ΁ • ౦ژͰग़ళ͢ΔλΠϛϯάͰίϩφ͕ྲྀߦ • ͲΜͳ؀ڥͰ΋ࣗ෼Ͱίϯτϩʔϧͯ͠࢓ࣄ͕Ͱ͖Δ 
 ৬छʹ௅ઓ͍ͨ͠ • ࣌ؒͱ৔ॴʹͱΒΘΕͳ͍ಇ͖ํΛ͍ͨ͠ • ҰͭͷεΩϧʹґଘͨ͘͠ͳ͍ స৬Λܾҙ

Slide 8

Slide 8 text

2021/9/8 ʲLancers x SUPER STUDIOʳEngineer Meetup ϑϥϯεྉཧਓ͔Βۦ͚ग़͠ΤϯδχΞ΁ • ϓϩάϥϛϯάεΫʔϧͰ໿2ϲ݄ษڧ • HTM L • CS S • Rub y • Rail s • Javascrip t • ϝϧΧϦͷΫϩʔϯΞϓϦʮFURIMAʯ
 ΛνʔϜͰ੍࡞

Slide 9

Slide 9 text

2021/9/8 ʲLancers x SUPER STUDIOʳEngineer Meetup ϑϥϯεྉཧਓ͔Βۦ͚ग़͠ΤϯδχΞ΁ • ΦϯϥΠϯͰษڧ஥͕ؒͰ͖ΔʮLIve-StudyʯΛ੍࡞ • ௨஌ػೳ • DMػೳ • ϑΥϩʔػೳ • ݕࡧػೳ • ܝࣔ൘ػೳ • Slack௨஌ • Πϕϯτͷ։࠵ɺฤूɺ࡟আɺࢀՃɺऴྃ(CRUD ) • ϩʔΧϧͰ։ൃ • ຊ൪؀ڥ͸͸ECSΛ༧ఆ

Slide 10

Slide 10 text

2021/9/8 Πϯλʔϯ͔Βೖࣾͯ͠Railsͷϝʔϧૹ৴ΛSengGridʹҠߦͯ͠Έͯ ͔͠͠

Slide 11

Slide 11 text

2021/9/8 Πϯλʔϯ͔Βೖࣾͯ͠Railsͷϝʔϧૹ৴ΛSengGridʹҠߦͯ͠Έͯ AWSͰϙʔτϑΥϦΦެ։͢Δ
 ํ๏͕Θ͔ΒΜ

Slide 12

Slide 12 text

2021/9/8 ʲLancers x SUPER STUDIOʳEngineer Meetup MENTAͰSREͷ҆ୡ(@adachin0817)͞Μͱग़ձ͍
 ΠϯϑϥͷجૅΛڭ͑ͯ௖͘͜ͱʹ • LinuxͰͷίϚϯυͷૢ࡞ • DockerͰͷ։ൃ؀ڥͷߏங • AWSͰͷαʔόʔߏங • AnsibleΛར༻ͨ͠ΠϯϑϥίʔυԽ • CircleCIͰͷϦϦʔεࣗಈԽ ϑϥϯεྉཧਓ͔Βۦ͚ग़͠ΤϯδχΞ΁

Slide 13

Slide 13 text

2021/9/8 ʲLancers x SUPER STUDIOʳEngineer Meetup ϑϥϯεྉཧਓ͔Βۦ͚ग़͠ΤϯδχΞ΁ ։ൃ؀ڥߏ੒ਤ • ։ൃ؀ڥ͸DockerΛ࠾༻ • nginxͱunicornΛϦόʔεϓϩΩγ • supervisorͰىಈ͢ΔϓϩηεΛ؅ཧ


Slide 14

Slide 14 text

2021/9/8 ʲLancers x SUPER STUDIOʳEngineer Meetup ϑϥϯεྉཧਓ͔Βۦ͚ग़͠ΤϯδχΞ΁ ຊ൪؀ڥߏ੒ਤ • ຊ൪αʔόʔ͸AWS/EC 2 • ߏ੒؅ཧ͸AnsibleΛ࠾༻ • CircleCIͰࣗಈσϓϩΠ • SSLԽ͸Let`sEncrypt ALB΍RDSΛ࢖༻͔͕ͨͬͨ͠
 ίετ࡟ݮͷͨΊ࠷খݶͷߏ੒Ͱӡ༻

Slide 15

Slide 15 text

2021/9/8 Πϯλʔϯ͔Βೖࣾͯ͠Railsͷϝʔϧૹ৴ΛSengGridʹҠߦͯ͠Έͯ ϙʔτϑΥϦΦ࡞੒ͷϙΠϯτ

Slide 16

Slide 16 text

2021/9/8 ʲLancers x SUPER STUDIOʳEngineer Meetup ϙʔτϑΥϦΦ࡞੒ͷϙΠϯτ • όάͷͳ͍ΞϓϦέʔγϣϯΛ࡞Δ • ׬੒౓ > ೉͍͠ػೳɺڽͬͨσβΠϯ • ࢖༻ٕज़ͷબఆཧ༝Λઆ໌Ͱ͖Δ • ࠷৽ͷٕज़ΛऔΓೖΕͯ΋ཧ༝͕આ໌Ͱ͖ͳ͍ͱ୯७ʹٕज़͕࢖͍͍ͨਓͳͷ͔ͳͱ
 ࢥΘΕͯ͠·͏ • ݱ৔Ͱ͸՝୊ʹଇٕͨ͠ज़બఆΛ͢Δඞཁ͕͋Δ
 • ࢤ๬ઌͷٕज़ελοΫʹ߹ΘͤΔ • Πϯϑϥ໘Ͱ͸ͳΔ΂͘ίετΛ཈͑ͨΠϯϑϥઃܭΛ͢Δ΂͖(݄/2000~3000ԁ ) • ౰࣌ࣗ෼͸ECS/FargateͰӡ༻ֶ͔͕ͨͬͨ͠शίετ(ӡ༻ίετ΋)͕ߴ࣮͗ͯ͢૷Ͱ͖ͳ͔ͬͨ
 


Slide 17

Slide 17 text

2021/9/8 Πϯλʔϯ͔Βೖࣾͯ͠Railsͷϝʔϧૹ৴ΛSengGridʹҠߦͯ͠Έͯ ϥϯαʔζ΁Πϯλʔϯͱͯ͠ೖࣾ

Slide 18

Slide 18 text

2021/9/8 ʲLancers x SUPER STUDIOʳEngineer Meetup ϥϯαʔζ΁Πϯλʔϯͱͯ͠ೖࣾ

Slide 19

Slide 19 text

2021/9/8 ʲLancers x SUPER STUDIOʳEngineer Meetup LancersCreativeCloud→AWS ECS/Fargate • Ruby 2.7. 1 • Rails 6.0. 3 • Jque y • AW S • ECS/Fargat e • Docke r • CircleC I • DATADO G • SendGrid ϥϯαʔζ΁Πϯλʔϯͱͯ͠ೖࣾ

Slide 20

Slide 20 text

2021/9/8 ʲLancers x SUPER STUDIOʳEngineer Meetup • ෳࡶͳόονॲཧͷ࣮૷͔Βద༻·Ͱ • TerraformΛॻ͖׵͑ͯυϝΠϯΛมߋ • ΫϥΠΞϯτͷϚΠϖʔδ • Docker։ൃ؀ڥͷվળ • DB੔ཧ • CircleCiͷϦϑΝΫλϦϯά • ใु؅ཧػೳ • ϝʔϧαʔόʔΛSendGridʹҠߦ • etc. • SREͷ҆ୡ͞Μ͕͍ۙҐஔʹ͍ΔͷͰΞϓϦέʔγϣϯͷ
 ࣮૷͚ͩͰͳ͘Πϯϑϥ΋΍Βͤͯ௖͘ػձ͕͋ΔͷͰ
 ෯޿͍࣮຿ܦݧ͕Ͱ͖Δ • ΠϯλʔϯͰ΋ࡋྔͷ͋ΔλεΫΛ೚ͯ͠໯͑Δ ϥϯαʔζ΁Πϯλʔϯͱͯ͠ೖࣾ

Slide 21

Slide 21 text

2021/9/8 Πϯλʔϯ͔Βೖࣾͯ͠Railsͷϝʔϧૹ৴ΛSengGridʹҠߦͯ͠Έͯ ϝʔϧαʔόʔΛSendGrid΁Ҡߦ

Slide 22

Slide 22 text

2021/9/8 ʲLancers x SUPER STUDIOʳEngineer Meetup ϝʔϧαʔόʔΛSendGridʹҠߦ ՝୊ (NBJMΞΧ΢ϯτݻ༗ͷ໰୊ w ଘࡏ͠ͳ͍ϝʔϧΞυϨεʹϝʔϧૹ৴Λ͢ΔͱεύϜೝఆ͞Εϝʔϧૹ৴͕Ұ࣌తʹ 
 ετοϓ͢Δ w Ұ೔ͷϝʔϧૹ৴্ݶ͕ݶΒΕ͍ͯΔ LCC͸ΞϓϦ಺Ͱͷ௨஌ػೳ͕ແ͍ͷͰ
 ϝʔϧ͕ૹ৴͞Εͳ͍ͱΫϥΠΞϯτ͔Βͷ
 ཁ๬Λݟಀͯ͠͠·͏͜ͱ΋ɺɺ
 ݱ৔͔ΒͷΞϥʔτ্͕͕͍ͬͯͨͷͰ
 ૣٸʹରԠ

Slide 23

Slide 23 text

2021/9/8 ʲLancers x SUPER STUDIOʳEngineer Meetup ϝʔϧαʔόʔΛSendGridʹҠߦ SMTP API ϝϦοτ ϝϦοτ σϝϦοτ σϝϦοτ • ௥੻ػೳʢਖ਼͘͠ૹ৴͞Ε͔ͨ֬ೝͰ͖Δʣ • ෼ੳػೳʢϚʔέςΟϯάʹ׆༻ʣ • ૹ৴཰ͷվળʢSPFɺDKIMͷ׬ᘳͳઃఆʣ • HTTPͰૹ৴͢Δ͜ͱʹΑͬͯrailsΞϓϦଆͷॲཧ͸ϦΫΤετΛ
 ౤͛Δ͚ͩʹͳΔ • ActionMailer͕defalutͰ༻ҙ͍ͯ͠Δ഑৴ํ๏
 Λ࢖͏͜ͱ͸rails wayʹ৐Δ͜ͱͰ͋ΔͷͰ(rails
 ͷ఩ֶͱͯ͜͠Ε͸ॏཁ)ɺ࣮૷ͷखؒ౳͸ল͚Δ • طଘͷActionMailerͱͷڞଘ • RailsαʔόʔଆͰඇಉظॲཧΛ͠ͳ͍ͱ͍͚ͳ͍ • GmailͰૹ৴͍ͯ͠ΔͷͰ্ड़ͨ͠໰୊͕ൃੜ͍ͯ͠Δ

Slide 24

Slide 24 text

2021/9/8 ʲLancers x SUPER STUDIOʳEngineer Meetup w 4.51͔Β4FOE(SJE"1*΁Ҡߦ w "DUJPO.BJMFSͷ֤ϝʔϥʔͷॲཧ͸ͦͷ··ྲྀ༻ w "DUJPO.BJMFSͷ഑৴ํ๏Λ4FOE(SJE"1*༻ʹ৽ͨʹ௥Ճ w طଘͷ֤ϝʔϥʔͰ࡞੒͞ΕͨϝʔϧΦϒδΣΫτ͕࣮ߦ͞ΕͨλΠϛϯάͰ 
 .BJM4FOE(SJEΫϥεΛݺͼग़͠4FOE(SJE༻ͷΦϒδΣΫτʹஔ͖׵͑ w ϝʔϧૹ৴ςετ͸ϞοΫίϯςφΛ༻͍ͯςετ ࣮૷ํ਑ SMTP SendGrid API

Slide 25

Slide 25 text

2021/9/8 ʲLancers x SUPER STUDIOʳEngineer Meetup ࣮૷ํ਑ ࣮૷ͷৄࡉ͸ϥϯαʔζͷΤϯδχΞϒϩάʹॻ͍ͯ·͢ͷͰࢀߟʹʂ

Slide 26

Slide 26 text

2021/9/8 Πϯλʔϯ͔Βೖࣾͯ͠Railsͷϝʔϧૹ৴ΛSengGridʹҠߦͯ͠Έͯ ϝʔϧૹ৴ςετʹ͍ͭͯ

Slide 27

Slide 27 text

2021/9/8 ʲLancers x SUPER STUDIOʳEngineer Meetup ϝʔϧૹ৴ςετʹ͍ͭͯ • SREۚᖒ͞Μ͕࡞ͬͯ͘ΕͨϞοΫίϯςφͰ
 ϝʔϧૹ৴Λςετ • ϞοΫίϯςφͰ༻ҙͨ͠ϞοΫAPIʹϦΫΤετ
 Λૹ৴(ӈਤͷHTTP3030 ) • sendgrid-devܦ༝Ͱmaildev΁SMTPͰϝʔϧ഑৴ • http://xxx.xxx.xxx.xxx:1080/ɹʹΞΫηε͢Δ͜ͱͰ
 maildev΁ϝʔϧ͕ૹ৴͞Ε͍ͯΔ͜ͱ͕ϒϥ΢β্Ͱ
 ֬ೝͰ͖Δ • ΞϓϦଆͷ࣮૷͸Mail:SendGridΫϥε಺Ͱ؀ڥຖʹ
 API઀ଓઌͷϗετΛऔಘ

Slide 28

Slide 28 text

2021/9/8 Πϯλʔϯ͔Βೖࣾͯ͠Railsͷϝʔϧૹ৴ΛSengGridʹҠߦͯ͠Έͯ Ҡߦͯ͠Ͳ͏ͳ͔ͬͨ

Slide 29

Slide 29 text

2021/9/8 ʲLancers x SUPER STUDIOʳEngineer Meetup Ҡߦͯ͠Ͳ͏ͳ͔ͬͨ • ϝʔϧͷૹ৴਺਺্ݶ͕ͳ͘ͳͬͨͷͰΞϓϦέʔγϣϯͷ֦ுʹ޲͚ͯҰาલਐ • ϥϯαʔζຊՈͰ΋SendGridAPIͰૹ৴͍ͯ͠ΔͷͰ஌ݟΛ׆༻Ͱ͖Δ • ௥੻ػೳ(ϝʔϧͷ഑৴ঢ়گΛݟ͑ΔԽ ) • ϝʔϧ΁ͷΧςΰϦʔઃఆ͕Ͱ͖ΔͷͰϚʔέςΟϯάʹ׆༻ • ૹ৴཰ͷվળ(SPFɺDIKMͷ׬ᘳͳઃఆ ) • APIʹΑΔૹ৴(SMTPͰ͸ͳ͘HTTPͰૹ৴Ͱ͖Δ)

Slide 30

Slide 30 text

2021/9/8 ʲLancers x SUPER STUDIOʳEngineer Meetup ࠷ޙʹ ϥϯαʔζͰ͸Ұॹʹಇ͍ͯ͘ΕΔΤϯδχΞɺ
 ςοΫϦʔυ(RubyɺPHP)ืू͍ͯ͠·͢ʂ