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
2024-10-30-reInventStandby_StudyGroup_Intro
shinichirokawano
1
610
CyberAgent 生成AI Deep Dive with Amazon Web Services / genai-aws
cyberagentdevelopers
PRO
1
480
AIを駆使したゲーム開発戦略: 新設AI組織の取り組み / sge-ai-strategy
cyberagentdevelopers
PRO
1
130
ガバメントクラウド単独利用方式におけるIaC活用
techniczna
3
270
Java x Spring Boot Warm up
kazu_kichi_67
2
490
Aurora_BlueGreenDeploymentsやってみた
tsukasa_ishimaru
1
120
ネット広告に未来はあるか?「3rd Party Cookie廃止とPrivacy Sandboxの効果検証の裏側」 / third-party-cookie-privacy
cyberagentdevelopers
PRO
1
120
物価高なラスベガスでの過ごし方
zakky
0
350
現地でMeet Upをやる場合の注意点〜反省点を添えて〜
shotashiratori
0
500
【技術書典17】OpenFOAM(自宅で極める流体解析)2次元円柱まわりの流れ
kamakiri1225
0
210
GitHub Universe: Evaluating RAG apps in GitHub Actions
pamelafox
0
170
オーティファイ会社紹介資料 / Autify Company Deck
autifyhq
9
120k
Featured
See All Featured
5 minutes of I Can Smell Your CMS
philhawksworth
202
19k
Learning to Love Humans: Emotional Interface Design
aarron
272
40k
Keith and Marios Guide to Fast Websites
keithpitt
408
22k
Performance Is Good for Brains [We Love Speed 2024]
tammyeverts
3
370
Typedesign – Prime Four
hannesfritz
39
2.4k
Practical Orchestrator
shlominoach
186
10k
Building Better People: How to give real-time feedback that sticks.
wjessup
363
19k
Code Reviewing Like a Champion
maltzj
519
39k
Happy Clients
brianwarren
97
6.7k
Docker and Python
trallard
40
3.1k
Designing Experiences People Love
moore
138
23k
For a Future-Friendly Web
brad_frost
175
9.4k
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 ΤϯδχΞɺืूதͰ͢ʂʂ
͋Γ͕ͱ͏͍͟͝·ͨ͠ɻ