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
DUSt3R, MASt3R, MASt3R-SfM にみる3D基盤モデル
spatial_ai_network
2
180
組織に自動テストを書く文化を根付かせる戦略(2024冬版) / Building Automated Test Culture 2024 Winter Edition
twada
PRO
17
4.6k
PHPerのための計算量入門/Complexity101 for PHPer
hanhan1978
5
180
生成AIをより賢く エンジニアのための RAG入門 - Oracle AI Jam Session #20
kutsushitaneko
4
260
普通のエンジニアがLaravelコアチームメンバーになるまで
avosalmon
0
110
スタートアップで取り組んでいるAzureとMicrosoft 365のセキュリティ対策/How to Improve Azure and Microsoft 365 Security at Startup
yuj1osm
0
230
Amazon VPC Lattice 最新アップデート紹介 - PrivateLink も似たようなアップデートあったけど違いとは
bigmuramura
0
200
NW-JAWS #14 re:Invent 2024(予選落ち含)で 発表された推しアップデートについて
nagisa53
0
270
事業貢献を考えるための技術改善の目標設計と改善実績 / Targeted design of technical improvements to consider business contribution and improvement performance
oomatomo
0
100
UI State設計とテスト方針
rmakiyama
2
620
Oracle Cloudの生成AIサービスって実際どこまで使えるの? エンジニア目線で試してみた
minorun365
PRO
4
290
非機能品質を作り込むための実践アーキテクチャ
knih
5
1.5k
Featured
See All Featured
Why You Should Never Use an ORM
jnunemaker
PRO
54
9.1k
Fireside Chat
paigeccino
34
3.1k
Unsuck your backbone
ammeep
669
57k
個人開発の失敗を避けるイケてる考え方 / tips for indie hackers
panda_program
95
17k
No one is an island. Learnings from fostering a developers community.
thoeni
19
3k
GraphQLの誤解/rethinking-graphql
sonatard
67
10k
Imperfection Machines: The Place of Print at Facebook
scottboms
266
13k
How GitHub (no longer) Works
holman
311
140k
A designer walks into a library…
pauljervisheath
204
24k
The Language of Interfaces
destraynor
154
24k
Docker and Python
trallard
42
3.1k
Practical Orchestrator
shlominoach
186
10k
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 ΤϯδχΞɺืूதͰ͢ʂʂ
͋Γ͕ͱ͏͍͟͝·ͨ͠ɻ