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
ぼくの考えたさいきょうの開発フロー - PHP編
Search
Yuta Adachi
June 28, 2014
Technology
40
12k
ぼくの考えたさいきょうの開発フロー - PHP編
PHPカンファレンス関西 2014
Yuta Adachi
June 28, 2014
Tweet
Share
More Decks by Yuta Adachi
See All by Yuta Adachi
メルカリ、巨大モノリスにおける複雑性をリリース9年目にしてどう解決するか
adachang
4
3.2k
Other Decks in Technology
See All in Technology
Oracle Cloud Infrastructureデータベース・クラウド:各バージョンのサポート期間
oracle4engineer
PRO
27
12k
「 SharePoint 難しい」ってよく聞くけど、そんなに言うなら8歳の息子に試してもらった
taichinakamura
1
620
IaC運用を楽にするためにCDK Pipelinesを導入したけど、思い通りにいかなかった話
smt7174
1
110
ユーザーの購買行動モデリングとその分析 / dsc-purchase-analysis
cyberagentdevelopers
PRO
2
100
AWSコンテナ本出版から3年経った今、もし改めて執筆し直すなら / If I revise our container book
iselegant
15
4k
分布で見る効果検証入門 / ai-distributional-effect
cyberagentdevelopers
PRO
4
700
Fargateを使った研修の話
takesection
0
120
LeSSに潜む「隠れWF病」とその処方箋
lycorptech_jp
PRO
2
120
物価高なラスベガスでの過ごし方
zakky
0
380
Vueで Webコンポーネントを作って Reactで使う / 20241030-cloudsign-vuefes_after_night
bengo4com
4
2.5k
ABEMA のコンテンツ制作を最適化!生成 AI x クラウド映像編集システム / abema-ai-editor
cyberagentdevelopers
PRO
1
180
Amazon FSx for NetApp ONTAPを利用するにあたっての要件整理と設計のポイント
non97
1
160
Featured
See All Featured
The Psychology of Web Performance [Beyond Tellerrand 2023]
tammyeverts
41
2.1k
Practical Orchestrator
shlominoach
186
10k
A Modern Web Designer's Workflow
chriscoyier
692
190k
Responsive Adventures: Dirty Tricks From The Dark Corners of Front-End
smashingmag
250
21k
[Rails World 2023 - Day 1 Closing Keynote] - The Magic of Rails
eileencodes
32
1.8k
Refactoring Trust on Your Teams (GOTO; Chicago 2020)
rmw
31
2.7k
No one is an island. Learnings from fostering a developers community.
thoeni
19
3k
Visualization
eitanlees
144
15k
The Art of Delivering Value - GDevCon NA Keynote
reverentgeek
7
150
Testing 201, or: Great Expectations
jmmastey
38
7k
Performance Is Good for Brains [We Love Speed 2024]
tammyeverts
3
370
CSS Pre-Processors: Stylus, Less & Sass
bermonpainter
355
29k
Transcript
΅͘ͷߟ͍͖͑ͨ͞ΐ͏ͷ։ൃϑϩʔ PHPฤ Yuta Adachi
ࣗݾհ ҆ୡ ༐ଠ (@UAdachi) ! ग़ɿౡࠜݝদߐࢢ ͓ࣄɿChatWork ΠϯϑϥνʔϜ ! ڵຯ͋Δ͜ͱɿυϝΠϯۦಈઃܭɺScalaɺςχε
(Οϯϒϧυϯ։࠵த) !
IUUQTDJSDMFDJDPN
͓ॻ͖ • ։ൃϑϩʔΛ࠷దԽ͍ͯ͘͠త • ։ൃڥ • ίϛϡχέʔγϣϯ • CI •
σϓϩΠ
త ! • ։ൃͷߴԽ • ΦϖϨʔγϣϯϛεͷ༧ • ϓϩμΫτͷ্࣭ + ՄࢹԽ
։ൃڥ
Ͳ͏ͬͯߏஙͯ͠·͔͢ʁ • Vagrantͬͯͬͯ·͔͢ʁ
ϝϯςφϯε • ։ൃڥͩͬͯߋ৽͞Εଓ͚Δ • ߏஙखॱॻΛ࡞Δͷେม " εΫϦʔϯγϣοτʹҹॻ͍ͯɺઆ໌จΛఴ͑ͯ…
ʮԶͷڥʯ ྫ. Aʮಈ͔Ͷʔʯ BʮԶͷڥͩͱಈ͘ʯ Cʮchown nginx:nginx /var/cache/nginx ʁʯ
։ൃڥ as Code • खॱॻΛίʔυʹஔ͖͑Δ " ߏཧπʔϧ (Ansible, Chef, SaltStack)
• VirtualBox + Vagrant + AnsibleͷΠϯετʔϧ " Brewfile
։ൃڥʹԿΛೖΕ͓ͯ͘ʁ • ։ൃʹඞཁͳϛυϧΣΞ " PHP5.5, MySQL, memcached, redis-server • ศརπʔϧ
" git, tcpdump, netcat, wget, zsh • δϣʔΫπʔϧ " sl
ηοτΞοϓ $ git clone {repos} $ brew bundle $ vagrant
up IUUQTHJUIVCDPNBEBVMBSBWFMQMBUGPSN
։ൃڥͷߋ৽ • νϟοτͰΞφϯε + λεΫԽ
None
ߋ৽खॱ • มߋՕॴ͕ଟ͍߹ $ git pull $ vagrant destroy $
vagrant up
ߋ৽खॱ • ͪΐͬͱͨ͠มߋ $ ./update ࣮ࡍ #ͷΑ͏ͳίϚϯυΛ·ͱΊͯΔ͚ͩ $ git pull
$ ansible-playbook site.yml —tags nginx
։ൃڥͷςετ • ςετ " serverspecͰςετ
։ൃڥͷςετ • ςετ " ࠶ߏங͢Δςετ $ vagrant destroy && vagrant
up && rake spec " ႈੑͷνΣοΫ $ vagrant provision && vagrant provision && rake spec " ਓபνΣοΫ ਓபؾ࣭ͳΤϯδχΞʹ͓ࢼ͠ར༻ͯ͠Β͏
։ൃڥͷCI • ։ൃڥCI͠Α͏ʂ " (ํ๏ޙ΄Ͳ)
ίϛϡχέʔγϣϯ
νϟοτ • ChatWork
ϨϏϡʔ • ϨϏϡΞʔʹλεΫΛৼΔɺݻఆԽͤ͞ͳ͍ " ৄͦ͠͏ͳਓʹґཔ, ෳਓʹґཔ !
௨ • ϓϧϦΫΤετ • CIͰςετʹࣦഊ • τϐοΫϒϥϯν͕Ϛʔδ͞Εͨ • εςʔδϯάڥ͕ߋ৽ •
ϦϦʔε
෦׆ • ݴޠɺΤσΟλɺπʔϧɺOSɺ… ͳΜͰOK • ࠔͬͨͱ͖෦׆Ͱ࣭ " ୭͔ৄ͍͠ਓ͕ڭ͑ͯ͘ΕΔ (ࣾStack Overflow)
• ৽ணใͷڞ༗
෦׆
None
None
None
ܧଓతΠϯςάϨʔγϣϯ
CIαʔϏε͍Ζ͍Ζ • Travis CI • CircleCI • Shippable • wercker
• Codeship
Travis CI • ศརͳͱ͜Ζ " composer.phar͕༻ҙ͞ΕͯΔ " phpenv (5.3ʙ5.6), hiphop
" sudo͕͑Δ
Travis CI • composer͕༧Ί༻ҙ͞Ε͍ͯΔ " Ͱ $ composer self-update ඞཁ
Travis CI • /usr/bin/php —-version " HipHop VM
CircleCI • όʔδϣϯͷબࢶ͕๛ " 5.3.3, 10, 20, 25 " 5.4.4,
5, 6, 7, 8, 9, 10, 11, 12, 13… " 5.5.0, 2, 3, 7, 8, 11 ! • 5.6ɺhiphop༻ҙ͞Ε͍ͯͳ͍ IUUQTDJSDMFDJDPNEPDTFOWJSPONFOUQIQ
CircleCI • ϏϧυޙʹSSHͰϩάΠϯͰ͖Δ • sudoͰ͖ͳ͍
wercker • ࣗલͰboxΛ༻ҙͰ͖Δ • Vagrant + Ansible + serverspecೖΕͨbox "
EC2DigitalOceanʹεϙοτΠϯελϯε " AnsibleͷϓϨΠϒοΫ(ChefͷϨγϐ)ΛCI
CIαʔϏε for PHPer • scrutinizer-ci • SensioLabsInsight
scrutinizer-ci • ΠϯεϖΫγϣϯಛԽ • ςετ&ΧόϨοδ • ιϑτΣΞϝτϦΫεɺॏෳͷଌఆ • ࣭ͷఆྔԽɾՄࢹԽ
scrutinizer-ci • PHPUnit & ΧόϨοδ (xdebug.so) • php-code-sniffer, php-cs-fixer •
phpcpd, phpmd, phploc, pdepend • sensiolabs security checker (ޙ΄Ͳ) " ࣗͰ༻ҙ͠ͳͯ͘ྑ͍!!!
scrutinizer-ci • ͍ " ϫʔΧʔͷੑೳ͕ѱ͍ (༧)
scrutinizer-ci
scrutinizer-ci • ༗ྉϓϥϯͩͱίϯςφ͍ (ʁ) • ϝτϦΫεऩूͷͨΊ͚ͩʹ͏ͷ͋Γ͔ " ςετTravis CIͱ͔werckerͰճ͢
SensioLabsInsight • ΠϯεϖΫγϣϯʹಛԽ • ηΩϡϦςΟνΣοΫॆ࣮͍ͯ͠Δ
SensioLabsInsight • ϓϦϖΞʔυεςʔτϝϯτΛ༻ͯ͠ͳ͍ΫΤϦ • XSS • σόοάϓϦϯτ (var_dump, print_r) •
eval() • …
SensioLabsInsight
ΧόϨοδϨϙʔτ scrutinizer-ci or coveralls
Coveralls
Coveralls ຊޠରԠŵŦƄō?(ɾ㱼ɾ )ͬ/႘˶ˑŧƃ
ґଘϥΠϒϥϦͷཧ • composer.lock͍ͭΞοϓσʔτ͢Δʁ !
ґଘϥΠϒϥϦͷཧ ߋ৽͕ཷ·Δ # composer update # git diff # ා͘ͳͬͯఘΊΔ
# ͞Βʹཷ·Δ
VersionEye IUUQTXXXWFSTJPOFZFDPN
VersionEye • composer.jsonΛνΣοΫ͠ɺߋ৽͕͋Ε௨ " νΣοΫִؒDaily, Weekly, Monthly͔ΒબՄೳ • APIఏڙ͞Ε͍ͯΔ "
CIαʔϏεͰϏϧυ࣌ʹνΣοΫͰ͖Δ
None
VersionEye • ґଘؔΛՄࢹԽͯ͘͠ΕΔ
None
ηΩϡϦςΟΞοϓσʔτ • ੬ऑੑใͷΩϟονΞοϓ " ͜ΕCI࣌ʹͰ͖ͨΒخ͍͠
Security Advisories Checker IUUQTTFDVSJUZTFOTJPMBCTPSHDIFDL
Security Advisories Checker • ੬ऑੑͷ͋ΔϥΠϒϥϦΛ͍ͬͯͳ͍͔νΣοΫ " composer.lockͰஅ • Web /
Cli / API͕༻ҙ͞Ε͍ͯΔ " CIαʔϏεͰϏϧυ࣌ʹνΣοΫͰ͖Δ
None
ηΩϡϦςΟΞοϓσʔτ • Security Advisories Checker " ͋͘·ͰґଘϥΠϒϥϦ͕ର • JVNνΣοΫ͠·͠ΐ͏
CIͷ·ͱΊ
CIͰΓ͍ͨ͜ͱ • ςετ (PHPUnit, phpspec, behat) • ΧόϨοδ (coveralls) •
ηΩϡϦςΟ (Sensiolabs Security Advisories Checker) • ґଘؔ (VersionEye) • ϝτϦΫε (phpmd, phpcpd, pdepend) " scrutinizer-ci
CIαʔϏεͷબͼͷϙΠϯτ • ίϯςφͷੑೳͱฒྻʹ࣮ߦՄೳͳδϣϒ " ։ൃεϐʔυʹӨڹ, {։ൃਓ} / 10 ͘Β͍ฒߦʹಈ͔͍ͨ͠ •
ίʔυΛಈ͔͢ڥ࡞Γ͕େม͔Ͳ͏͔ " sudo͕ඞཁʁ sshͰϩάΠϯ͍ͨ͠ʁ • OS " RHELܥ͍͔ͨͬͨΒ ʮ Vagrant + EC2 | DigitalOcean ʯ
CIαʔϏεͷબͼͷϙΠϯτ • Amazon LinuxREHLΛ͍͍ͨ " werkcker + Vagrant + EC2
͓͢͢ΊͷΈ߹Θͤ • CircleCI • wercker • Travis CI + •
scrutinizer-ci ςετ ΧόϨοδ ΠϯεϖΫγϣϯ
σϓϩΠ
σϓϩΠπʔϧ • Capistrano • Rocketeer (PHPCapistrano) • Magallanes (PHP) •
Altax (PHP) • envoy (PHP)
CIͱσϓϩΠ • CIͷྲྀΕ 1. લॲཧ (git cloneɺcomposer installͳͲ) 2. ςετ
3. ޙॲཧ (ΧόϨοδͷੜ) 4. σϓϩΠ
ᶃςετ σϓϩΠπʔϧͷ४උ
ᶄ৽͍͠ϦϦʔε༻ͷσΟϨΫτϦΛ࡞ SFMFBTFTˡOFX SFMFBTFT DVSSFOUSFMFBTFT
ᶄHJUDMPOF\ϦϙδτϦ^ SFMFBTFTˡOFX
ᶅDPNQPTFSJOTUBMM ࡁ
ᶆᶅΛSTZODѹॖ TDQͳͲͰసૹ SFMFBTFTˡOFX SFMFBTFT DVSSFOUSFMFBTFT
! ·ͱΊ
·ͱΊ • ඇಉظͷίϛϡχέʔγϣϯ׆༻͠Α͏ • CIαʔϏεͰςετҎ֎ͷ͜ͱ৭ʑͰ͖Δ • ༷ʑͳCIαʔϏε͔ΒɺνʔϜʹඞཁͳͷΛબ΅͏ " ෳಉ࣌ʹͬͯྑ͍
αϯϓϧ • ։ൃڥ " https://github.com/ada-u/laravel4-platform ! • ΞϓϦέʔγϣϯ " https://github.com/ada-u/laravel4-sample-
application
ChatWork ΤϯδχΞɺืूதͰ͢ʂʂ
͋Γ͕ͱ͏͍͟͝·ͨ͠ɻ