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
The Web Performance Landscape in 2024 [PerfNow 2024]
tammyeverts
0
100
アプリエンジニアのためのGraphQL入門.pdf
spycwolf
0
100
Adopting Jetpack Compose in Your Existing Project - GDG DevFest Bangkok 2024
akexorcist
0
110
アジャイルでの品質の進化 Agile in Motion vol.1/20241118 Hiroyuki Sato
shift_evolve
0
170
Python(PYNQ)がテーマのAMD主催のFPGAコンテストに参加してきた
iotengineer22
0
510
EventHub Startup CTO of the year 2024 ピッチ資料
eventhub
0
120
SSMRunbook作成の勘所_20241120
koichiotomo
3
160
Lexical Analysis
shigashiyama
1
150
The Rise of LLMOps
asei
7
1.7k
iOS/Androidで同じUI体験をネ イティブで作成する際に気をつ けたい落とし穴
fumiyasac0921
1
110
なぜ今 AI Agent なのか _近藤憲児
kenjikondobai
4
1.4k
AI前提のサービス運用ってなんだろう?
ryuichi1208
8
1.4k
Featured
See All Featured
GraphQLの誤解/rethinking-graphql
sonatard
67
10k
Put a Button on it: Removing Barriers to Going Fast.
kastner
59
3.5k
Faster Mobile Websites
deanohume
305
30k
The World Runs on Bad Software
bkeepers
PRO
65
11k
[Rails World 2023 - Day 1 Closing Keynote] - The Magic of Rails
eileencodes
33
1.9k
Code Review Best Practice
trishagee
64
17k
The Language of Interfaces
destraynor
154
24k
Build your cross-platform service in a week with App Engine
jlugia
229
18k
Building Applications with DynamoDB
mza
90
6.1k
A Tale of Four Properties
chriscoyier
156
23k
Build The Right Thing And Hit Your Dates
maggiecrowley
33
2.4k
Into the Great Unknown - MozCon
thekraken
32
1.5k
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 ΤϯδχΞɺืूதͰ͢ʂʂ
͋Γ͕ͱ͏͍͟͝·ͨ͠ɻ