Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Laravel5.5的 継続的インテグレーション / Laravel 5.5 Continu...
Search
kkznch
August 07, 2018
Programming
3
3.3k
Laravel5.5的 継続的インテグレーション / Laravel 5.5 Continuous Integration
レガシーコード改革!UT/CIでWebサービスの技術的負債を解消する取り組み
登壇枠で使用
参考URL
https://base.connpass.com/event/94476/
kkznch
August 07, 2018
Tweet
Share
More Decks by kkznch
See All by kkznch
黒い画面へようこそ/Hello, black screen
kkznch
0
360
VueRouterとNuxtのルーティング/VueRouter and Nuxt Routing
kkznch
0
320
Vuexで何を管理する方が良い?/What is better to store in Vuex?
kkznch
1
700
Firestoreのルール設定 割と何でも出来てビビる/Firestore rule setting
kkznch
1
720
LaraCSVで手軽にCSVを出力する/Easily generate CSV by LaraCSV
kkznch
0
1.6k
自社サービス チャット機能にFirebaseが導入されてた/Firebase was introduced to the chat function of our service
kkznch
0
1.1k
SPA開発未経験者によるNuxt.jsを使った自社サービス開発 / Development of own service using Nuxt.js by inexperienced SPA development
kkznch
3
3.1k
Laravel Telescopeが便利そうな気がする/Laravel Telescope seems to be convenience
kkznch
1
1.1k
Laravel Novaはなんだかいい感じらしい/Laravel Nova seems to be nice
kkznch
0
610
Other Decks in Programming
See All in Programming
Snowflake x dbtで作るセキュアでアジャイルなデータ基盤
tsoshiro
2
520
Click-free releases & the making of a CLI app
oheyadam
2
120
Quine, Polyglot, 良いコード
qnighy
4
640
CSC509 Lecture 11
javiergs
PRO
0
180
CSC509 Lecture 12
javiergs
PRO
0
160
LLM生成文章の精度評価自動化とプロンプトチューニングの効率化について
layerx
PRO
2
190
「今のプロジェクトいろいろ大変なんですよ、app/services とかもあって……」/After Kaigi on Rails 2024 LT Night
junk0612
5
2.1k
Kaigi on Rails 2024 〜運営の裏側〜
krpk1900
1
210
距離関数を極める! / SESSIONS 2024
gam0022
0
280
What’s New in Compose Multiplatform - A Live Tour (droidcon London 2024)
zsmb
1
470
3rd party scriptでもReactを使いたい! Preact + Reactのハイブリッド開発
righttouch
PRO
1
600
レガシーシステムにどう立ち向かうか 複雑さと理想と現実/vs-legacy
suzukihoge
14
2.2k
Featured
See All Featured
ピンチをチャンスに:未来をつくるプロダクトロードマップ #pmconf2020
aki_iinuma
109
49k
How to Think Like a Performance Engineer
csswizardry
20
1.1k
GraphQLの誤解/rethinking-graphql
sonatard
67
10k
The Psychology of Web Performance [Beyond Tellerrand 2023]
tammyeverts
44
2.2k
Documentation Writing (for coders)
carmenintech
65
4.4k
RailsConf 2023
tenderlove
29
900
Large-scale JavaScript Application Architecture
addyosmani
510
110k
I Don’t Have Time: Getting Over the Fear to Launch Your Podcast
jcasabona
28
2k
Facilitating Awesome Meetings
lara
50
6.1k
Building an army of robots
kneath
302
43k
Become a Pro
speakerdeck
PRO
25
5k
Raft: Consensus for Rubyists
vanstee
136
6.6k
Transcript
Copyright Re:Build.inc All Rights Reserved. Laravel5.5的 ܧଓ的インテグレʔション 嘉侑起 2018/08/07 3F#VJME
Copyright Re:Build.inc All Rights Reserved. "HFOEB ձࣾɾࣗݾհ (JU-BC$*Λಋೖ͢ΔϝϦοτ (JU-BC$*ͷಋೖํ๏ -BSBWFM1)16OJUͷϝϦοτ
Copyright Re:Build.inc All Rights Reserved. ձࣾɾࣗݾհ
Copyright Re:Build.inc All Rights Reserved. ࣗݾհ ◆໊લ ླ ೭(Suzuki Takayuki)
◆ࣗݾհ ɾ1990ɺਆಸݝੜ·Εɻ ɾࣾձਓʹͳ͔ͬͯΒɺϓϩάϥϛϯάΛ࢝ΊΔɻ ɾ2015ʹϑϧεϐʔυʹೖࣾ͠ɺ2017ʹ ϑϦʔϥϯεΛͬͨޙʹ201711݄ʹԭೄͰىۀɻ ◆झຯ ίεϓϨɺԻָϥΠϒɺϚϥιϯେձʹग़Δɺٿ؍ઓ ◆εΩϧ ɾPHP, Symfony2,CakePHP3,Laravel5, ɾJavaScript, backbone.js,Angular4
Copyright Re:Build.inc All Rights Reserved. ࣗݾհ ◆໊લ Յ ါى(Kakazu Yuki)
@kkznch ◆ࣗݾհ ɾ1990ɺԭೄݝੜ·Ε ɾ2016ʹԭిάϩʔόϧγεςϜζגࣜձࣾʹೖࣾɺ2018 ʹגࣜձࣾRe:Buildస৬ͯ͠ݱࡏʹࢸΔ ɾࠃॎஅ͍ͨ͠ ◆झຯ όϨʔϘʔϧɺϐΞϊɺήʔϜɺΧϑΣ८Γ ◆εΩϧ ɾPHPɺJavaScriptɺC/C++ɺPythonɺRuby ɾΠϯϑϥશൠɺηΩϡϦςΟগʑ
Copyright Re:Build.inc All Rights Reserved. ձࣾհ ◆ձ໊ࣾ גࣜձࣾRe:Build ◆ॅॴ ԭೄݝԭೄࢢதԝ̍ஸ̍̒−̕
◆ࣄۀ༰ ɾۀʹ͓͍ͯͷϑʔυϩεΛແ͘͢ ࣗࣾWEBαʔϏεͷاըɾ։ൃɻ ɾडୗ։ൃ ◆ࣾһ 4໊ ◆ΤϯδχΞͷಇ͖ํ ϦϞʔτϫʔΫՄೳͳࣗ༝ͳಇ͖ํΛਪͯ͠·͢ʂ
ɾαʔϏε໊ temite ɾγεςϜ֓ཁ ECϓϥοτϑΥʔϜ ΫϨδοτܾࡁ ΞϑΟϦΤΠτ ͳͲ ɾ͍ͬͯΔٕज़ ݴޠ :
PHP,JavaScript ϑϨʔϜϫʔΫ: laravel5,Vue.js,JQueryͳͲ ։ൃதͷαʔϏε
ϑϩϯταΠυ αʔόαΠυ Ϗϧυπʔϧ DB
৫ମ੍ ϓϩμΫτΦʔφʔ ։ൃϦʔμʔ νʔϜϝϯόʔ ▪ϓϩδΣΫτߏ ɾϓϩμΫτΦʔφʔɿ1໊ ɾ։ൃϦʔμʔɿ1໊ ɾνʔϜϝϯόʔɿ3໊ ※σβΠφʔ΄΅ແ͠
Copyright Re:Build.inc All Rights Reserved. (JU-BC$*Λಋೖ͢ΔϝϦοτ
GitLabͱʁ
GitLabͱʁ GitHubͬΆౕ͍
GitLabͷΞΠίϯ
GitLabͷΞΠίϯʢچʣ ͳΜ͔ා͍
GitLabͷΞΠίϯ ॏͶͯΈͨ
GitLabͷػೳ
GitLabͷػೳ ͜͜ΒΜΑ͘͏
‣ GitLabఏڙͷܧଓతΠϯςάϨʔγϣϯπʔϧ ‣ ϦϙδτϦ͕Push͞ΕͨλΠϛϯάͰಈ࡞͢Δ ‣ ಈ͔ͨ͢Ίʹ৭ʑͱ͝ʹΐ͝ʹΐ͢Δඞཁ͋Γ GitLab CIͱʁ
‣ PHPStan(PHP Static Analysis Tool)Ͱ੩తղੳ ‣ PHPUnitͰ୯ମςετɾ݁߹ςετ ‣ εςʔδϯάڥͷσϓϩΠ GitLab
CIͰฐ͕ࣾͬͯΔ͜ͱ
PHPStanͰ੩తղੳ
PHPUnitͰ୯ମςετɾ݁߹ςετ
εςʔδϯάڥͷσϓϩΠ ※اۀൿີͷͨΊ͓ݟͤͰ͖·ͤΜ
2 3 GitLab CIΛಋೖ͢ΔϝϦοτ ѹత҆৺ײ ͷ֫ಘ ॲཧͷࣗಈԽʹΑ ΓޮΞοϓ ࣭Λ୲อ 1
2 3
Copyright Re:Build.inc All Rights Reserved. (JU-BC$*ͷಋೖํ๏
(1)PUSH (2)GitLab CI࣮ߦ (3)ίϯςφىಈ Gitlab (6)Envoy࣮ߦ ςετ࣮ߦ ίϯςφ σϓϩΠ࣮ߦ ίϯςφ
(5)ίϯςφىಈ (4)UnitTest࣮ߦ (7)Pull ຊ൪ڥ or εςʔδϯάڥ ϦϙδτϦ GiaLab CI ࣮ߦϑϩʔ
‣ SSHଓ༻ͷ伴Λ࡞ɾొ͢Δ ‣ DockerΠϝʔδΛ࡞ɾొ͢Δ ‣ GitLabϥϯφʔཧ༻ϑΝΠϧΛ࡞͢Δ ‣ σϓϩΠλεΫϥϯφʔཧ༻ϑΝΠϧΛ࡞͢Δ GitLab CIಋೖखॱ
‣SSHଓ༻ͷ伴Λ࡞ɾొ͢Δ ‣ DockerΠϝʔδΛ࡞ɾొ͢Δ ‣ GitLabϥϯφʔཧ༻ϑΝΠϧΛ࡞͢Δ ‣ σϓϩΠλεΫϥϯφʔཧ༻ϑΝΠϧΛ࡞͢Δ GitLab CIಋೖखॱ
(1)PUSH (2)GitLab CI࣮ߦ (3)ίϯςφىಈ Gitlab (6)Envoy࣮ߦ ςετ࣮ߦ ίϯςφ σϓϩΠ࣮ߦ ίϯςφ
(5)ίϯςφىಈ (4)UnitTest࣮ߦ (7)Pull ຊ൪ڥ or εςʔδϯάڥ ϦϙδτϦ GitLab CI͔ΒσϓϩΠઌ σϓϩΠΛ࣮ߦ͢ΔͨΊʹ SSHଓ༻ͷ伴͕ඞཁ ެ։伴Λઃஔ ൿີ伴Λઃஔ
(1)PUSH (2)GitLab CI࣮ߦ (3)ίϯςφىಈ Gitlab (6)Envoy࣮ߦ ςετ࣮ߦ ίϯςφ σϓϩΠ࣮ߦ ίϯςφ
(5)ίϯςφىಈ (4)UnitTest࣮ߦ (7)Pull ຊ൪ڥ or εςʔδϯάڥ ϦϙδτϦ σϓϩΠઌͷαʔό͔Β GitLabͷϦϙδτϦΛPull͢ΔͨΊʹ SSHଓ༻ͷ伴͕ඞཁ ൿີ伴Λઃஔ ެ։伴Λઃஔ
‣ SSHଓ༻ͷ伴Λ࡞ɾొ͢Δ ‣DockerΠϝʔδΛ࡞ɾొ͢Δ ‣ GitLabϥϯφʔཧ༻ϑΝΠϧΛ࡞͢Δ ‣ σϓϩΠλεΫϥϯφʔཧ༻ϑΝΠϧΛ࡞͢Δ GitLab CIಋೖखॱ
(1)PUSH (2)GitLab CI࣮ߦ (3)ίϯςφىಈ Gitlab (6)Envoy࣮ߦ ςετ࣮ߦ ίϯςφ σϓϩΠ࣮ߦ ίϯςφ
(5)ίϯςφىಈ (4)UnitTest࣮ߦ (7)Pull ຊ൪ڥ or εςʔδϯάڥ ϦϙδτϦ ςετɾσϓϩΠͷ࣮ߦΛߦ͏ ίϯςφͷݩͱͳΔ DockerΠϝʔδ͕ඞཁ ϩʔΧϧͰ࡞ͨ͠DockerΠϝʔδΛ GitLab Container Registryʹొ
‣ SSHଓ༻ͷ伴Λ࡞ɾొ͢Δ ‣ DockerΠϝʔδΛ࡞ɾొ͢Δ ‣GitLabϥϯφʔཧ༻ϑΝΠϧΛ࡞͢Δ ‣ σϓϩΠλεΫϥϯφʔཧ༻ϑΝΠϧΛ࡞͢Δ GitLab CIಋೖखॱ
(1)PUSH (2)GitLab CI࣮ߦ (3)ίϯςφىಈ Gitlab (6)Envoy࣮ߦ ςετ࣮ߦ ίϯςφ σϓϩΠ࣮ߦ ίϯςφ
(5)ίϯςφىಈ (4)UnitTest࣮ߦ (7)Pull ຊ൪ڥ or εςʔδϯάڥ ϦϙδτϦ Push͞ΕͨλΠϛϯάͰϦϙδτϦʹ .gitlab-ci.ymlͱ͍͏ϑΝΠϧ͕͋Ε ͦͷதʹهࡌ͞Εͨδϣϒ͕࣮ߦ͞ΕΔ .gitlab-ci.ymlΛ࡞
.gitlab-ci.yml σϓϩΠ࣮ߦίϯςφ ͷॲཧ༰Λهड़ ςετ࣮ߦίϯςφͰ ༻͢ΔαʔϏε ॲཧ༰Λهड़ ༻͢ΔDockerΠϝʔδ envoyίϚϯυʂ
‣ SSHଓ༻ͷ伴Λ࡞ɾొ͢Δ ‣ DockerΠϝʔδΛ࡞ɾొ͢Δ ‣ GitLabϥϯφʔཧ༻ϑΝΠϧΛ࡞͢Δ ‣σϓϩΠλεΫϥϯφʔཧ༻ϑΝΠϧΛ࡞͢Δ GiLlab CIಋೖखॱ
(1)PUSH (2)GitlabCI࣮ߦ (3)ίϯςφىಈ Gitlab (6)Envoy࣮ߦ ςετ࣮ߦ ίϯςφ σϓϩΠ࣮ߦ ίϯςφ (5)ίϯςφىಈ
(4)UnitTest࣮ߦ (7)Pull ຊ൪ڥ or εςʔδϯάڥ ϦϙδτϦ σϓϩΠ࣮ߦίϯςφͰenvoyίϚϯυ ͕࣮ߦ͞ΕɺEnvoy.blade.phpʹهड़ͨ͠ ॲཧ͕࣮ߦ͞ΕΔ Envoy.blade.phpΛ࡞
Envoy.blade.php ෳͷσϓϩΠઌΛهड़Մೳ EnvoyͷதͰ༻͢Δ άϩʔόϧมతͳͷΛఆٛ ۩ମతͳॲཧΛ৭ʑͱهड़ @serversσΟϨΫςΟϒͰࢦఆͨ͠ϗετʹSSHଓ͠ɺ ͦͷ෦Ͱ@storyσΟϨΫςΟϒͷॲཧ͕࣮ߦ͞ΕΔ
͜͜·Ͱͬͯ GitLab CI͕ಈ͖·͢ʢଟʣ
ৄࡉʹ͍ͭͯฐࣾͷϒϩά͔ ՅݸਓͷϒϩάΛࢀর͍ͩ͘͞ ※ࢀߟ ʮגࣜձࣾRe:Buildͷϒϩάʯ ʮ͚͚ͣΜηϧϑϋοΩϯάʯ
Copyright Re:Build.inc All Rights Reserved. -BSBWFM1)16OJUͷϝϦοτ
4 1 LaravelͰςετ͢ΔϝϦοτ Merit ᶃςετ༻ͷget,postϝιου͕͋Δ ᶄϨεϙϯεͷΞαʔτ͕๛ ᶅςετ༻ͷτϨΠτ͕ศར ᶆϞοΫԽͷΈ͕ศར
getϝιουͷྫ
postϝιουͷྫ
ϨεϙϯεͷΞαʔτ͕๛
ςετ༻τϨΠτ͕ศར ‣ RefreshDatabaseɿ - ̍ͭͷςετ͕ऴΘΔͨͼʹDBΛϦϑϨογϡ͢Δ ‣ DatabaseTransactionsɿ - ̍ͭͷςετ͕ऴΘΔͨͼʹDBΛςετ։࢝લͷঢ়ଶ ·ͰϩʔϧόοΫ͢Δ
‣ WithoutMiddlewareɿ - ֻ͚ΒΕ͍ͯΔMiddlewareΛແࢹ
ɾۄͶ͗ͷΑ͏ͳߏͰϦΫΤετͱ Ϩεϙϯεͷؒʹ༷ʑͳॲཧΛڬΈࠐ Έ͍͢ ɾόϦσʔγϣϯͳͲ୯ҰͷΤϯςΟ ςΟʹґଘ͢ΔͷͰͳ͘ɺForm୯ ҐͰ࣮Ͱ͖Δ MiddleWareͷྫ ೝ ূ ν
Σ ο Ϋɺ ό Ϧ σ ʔ γ ϣ ϯɺ CSRFτʔΫϯͷνΣοΫ [ิ] Middlewareͱʁ
ϞοΫԽͷΈ͕ศར
ϞοΫԽ͢Δલ Mail Class Router Controller SMTPαʔόʔ
ϞοΫԽͨ͋͠ͱ Router Controller SMTPαʔόʔ Mail Class SMTPαʔόʔʹϝʔϧΛૹ৴ͨ͜͠ͱ ʹͯ͘͠ΕΔʢ࣮ࡍʹૹ৴͠ͳ͍ʣ
Copyright Re:Build.inc All Rights Reserved. ·ͱΊ
5 1 ·ͱΊ ᶃ GitLab CIͰςετٴͼσϓϩΠॲཧΛࣗಈԽ͢Δ͜ ͱʹΑΓɺ࡞ۀΛޮԽ࣭ͭͭ͠ͷ୲อ͕Ͱ͖Δ ᶄ LaravelͷPHPUnitʹศརͳΞαʔττϨΠτ͕ ༻ҙ͞Ε͍ͯΔͨΊɺՄಡੑɾอकੑͷߴ͍ςετ͕
ॻ͚Δ