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
AGIについてChatGPTに聞いてみた
blueb
0
130
Lambdaと地方とコミュニティ
miu_crescent
2
370
TypeScriptの次なる大進化なるか!? 条件型を返り値とする関数の型推論
uhyo
2
1.6k
iOSチームとAndroidチームでブランチ運用が違ったので整理してます
sansantech
PRO
0
130
なぜ今 AI Agent なのか _近藤憲児
kenjikondobai
4
1.4k
Amplify Gen2 Deep Dive / バックエンドの型をいかにしてフロントエンドへ伝えるか #TSKaigi #TSKaigiKansai #AWSAmplifyJP
tacck
PRO
0
370
20241120_JAWS_東京_ランチタイムLT#17_AWS認定全冠の先へ
tsumita
2
250
信頼性に挑む中で拡張できる・得られる1人のスキルセットとは?
ken5scal
2
530
Taming you application's environments
salaboy
0
180
ハイパーパラメータチューニングって何をしているの
toridori_dev
0
140
初心者向けAWS Securityの勉強会mini Security-JAWSを9ヶ月ぐらい実施してきての近況
cmusudakeisuke
0
120
BLADE: An Attempt to Automate Penetration Testing Using Autonomous AI Agents
bbrbbq
0
300
Featured
See All Featured
The Art of Delivering Value - GDevCon NA Keynote
reverentgeek
8
860
Building Adaptive Systems
keathley
38
2.3k
Done Done
chrislema
181
16k
How to Ace a Technical Interview
jacobian
276
23k
Writing Fast Ruby
sferik
627
61k
Happy Clients
brianwarren
98
6.7k
Teambox: Starting and Learning
jrom
133
8.8k
[RailsConf 2023] Rails as a piece of cake
palkan
52
4.9k
How To Stay Up To Date on Web Technology
chriscoyier
788
250k
Agile that works and the tools we love
rasmusluckow
327
21k
RailsConf 2023
tenderlove
29
900
Site-Speed That Sticks
csswizardry
0
23
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 ΤϯδχΞɺืूதͰ͢ʂʂ
͋Γ͕ͱ͏͍͟͝·ͨ͠ɻ