レンサバでねっとりとしたプアマンズ継続的デプロイ

271fad8d53cd1f12f2b4b6d38e3d7bd3?s=47 uzulla
November 09, 2019

 レンサバでねっとりとしたプアマンズ継続的デプロイ

271fad8d53cd1f12f2b4b6d38e3d7bd3?s=128

uzulla

November 09, 2019
Tweet

Transcript

  1. ϨϯαόͰ ͶͬͱΓͱͨ͠ ϓΞϚϯζ ܧଓతσϓϩΠ

  2. uzulla PHPer Hachioji.pm ʮϝʔϧϑΥʔϜ౳Λॻ͍ͯ฻Β͍ͯͨ͠ʯ

  3. (WebαΠτͷ)ܧଓతσϓϩΠͱ͸ʁʁ w $POUJOVPVT%FQMPZNFOU $% w (JU)VCͱ͔ʹQVTIʢΞοϓϩʔυʣ͢Δͱɺ΢Σϒαʔ όʔʹEFQMPZʢΞοϓϩʔυʣͯ͘͠ΕΔ w ҙ༁ɿͲΜͲΜָʹΞοϓϩʔυ͍ͯ͜͠͏΍ʂ w

    ʢָɺ͸ΤϯδχΞతͳओ؍Ͱ͢ʣ w ʢ࣮ࡍ͸΋ͬͱߴঘͰ͢ʣ
  4. ʮ௚઀UL͢Ε͹͍͍ͷͰ͸ʁʯ w ࢲʮྲྀߦ͍ͬͯΔ͔ΒͳʂԶ΋΍Ζ͏ʂʯ w ྲྀߦ͍ͬͯΔ͜ͱ͕Ͱ͖ΔͱͳΜ͔ΠΠΑͶ w ʮ'51ͰΞοϓϩʔυʁͦΜͳͷݹ͍Ͱ͢Ͷɺ࣌୅͸QVTI ͢Ε͹σϓϩΠͰ͢Αʢϑοʣʯ w ͍͍͍ͨʜ͍͍ͨ͘ͳ͍ʁ

  5. ͱ͜ΖͰgitͱ͸ʁ w ϓϩδΣΫτ ΍αΠτ ౳ͷ୯ҐͰ w ϑΝΠϧͷߋ৽ཤྺΛอଘͰ͖ w ͦͷཤྺͷࠩ෼Λݫ֨ʹ؅ཧͰ͖ w

    (JU)VC౳Λ࢖͑͹ߋ৽ΛνʔϜʹڞ༗Ͱ͖Δ w ͱ͍͏ײ͡ͷπʔϧ w ଟ͘ͷ$%Ͱ͸HJUΛ׆༻͠ɺαΠτʹ൓ө͢Δ
  6. git؅ཧ͞ΕΕ͹… w ൓ө࿙Ε΍ɺઌ૆ฦΓʢר͖໭Γʣɺ͓͔͍ࠩ͠෼͕ͳ͍ w ࡞ۀऀ͕ಛఆͰ͖Δ w ר͖໭ͤΔʢHJUͰ؅ཧ͍ͯ͠ΔϑΝΠϧʹݶΔʣ w ΢ΣϒαΠτ੍࡞ͷࣄނ͕ݮΔʂ w

    ୠ͠ɺօେ޷͖ʮ͍͖ͳΓ'51मਖ਼ʯ͸Ͱ͖ͳ͘ͳΔ w ࣮ࡍ͸Ͱ͖Δ͚Ͳɺී௨͠ͳ͍Α͏ʹ͢Δ
  7. CD͕Ͱ͖ΔPaaS౳αʔϏεྫ w /FUMJGZIUUQTXXXOFUMJGZDPN w (JU)VCQBHFTIUUQTQBHFTHJUIVCDPN w )FSPLVIUUQTKQIFSPLVDPN w "[VSF8FC"QQTIUUQTB[VSFNJDSPTPGUDPNKBKQTFSWJDFTBQQ TFSWJDFXFC

    w ϩϦϙοϓʂϚωʔδυΫϥ΢υIUUQTNDMPMJQPQKQ
  8. ͔͠͠… w 1)1͕ಈ͔ͳ͍ ! ʢ(JU)VCQBHFTɺ/FUMJGZͷ৔߹ʣ w ૉੑ͕-JOVYͰͳ͍ " ʢ"[VSFͷ͍҆ϓϥϯͷ৔߹ʣ w

    ػೳ͸จ۟ແ͍͕ߴ͍ # ʢओ؍ʣʢ)FSPLVɺϚωΫϥͷ ৔߹ʣ w ̍υϝΠϯͳΒແྉͷࣄ΋ଟ͍ w ̍ͭͰ͸ෆศɺԶ͸ؾܰʹ৭ʑͳ΋ͷΛ࡞Γ͍ͨʂ w ʢʜͰ͖Ε͹҆͘ʂʣ
  9. ʮ͍҆ͨ͘͠ͳΒVPSͰ͠ΐʁʯ w 714Λʮ͖ͪΜͱ؅ཧ͍ͯ͘͠ʯ࿑ ྗΛແࢹͯ͠͸͍͚ͳ͍ w ͪΌΜͱόʔδϣϯΞοϓͯ͠·͢ ͔ʁ w ͪΌΜͱઃఆͰ͖ͯ·͔͢ʁ w

    ͪΌΜͱ؂ࢹ͍ͯ͠·͔͢ʁ w ೚ͤΒΕΔͳΒ೚ͤΔํ͕ྑ͍
  10. ͦ͏͍͑͹… w ϨϯαόͬͯυϝΠϯ਺͕ແ੍ݶ ʢܖ໿ʹΑΔʣͰɺαΠτΛͭ͘Ε Δͳʁ w Ͱ΋ɺ'51΍4'51Ͱຖճ6-ͨ͠ ΓɺόοΫΞοϓͨ͠Γͷ؅ཧ͸΋ ͏໘౗ͩͳʜ w

    ϨϯαόͰ$%Ͱ͖Ε͹͍͍ͷʹ ͳʁ
  11. ͱ͍͏͜ͱͰ ϨϯαόͰ CD ͢Δͧʂ

  12. w ʢ܁Γฦ͠ʹͳΓ·͕͢ɿ͔͜͜Β ઌͷ͜ͱ͸ͨͱ͑͹/FUMJGZ΍ϩϦ ϙοϓϚωʔδυΫϥ΢υͬͯ΍ͭ Λ࢖͏খݣ͍͕͋Ε͹ɺ΄΅ແ༻Ͱ ͢͠ɺ਺ݸͳΒϚωΫϥ΋͍͍ͳͱ ͓΋͍·ͨ͠ʣ w ʢ͕ɺ๻͸ࡒ෍ͱ૬ஊͳ͠ʹϓϩ δΣΫτΛͨ͘͞Μͭ͘Γ͍ͨ͠ɺ

    Ϩϯλϧαʔόʔͬͯ΍͕ͭ޷͖ͳ ͷͰɺ͜͜Ͱ͸ϨϯαόΛ͕Μ͹ͬ ͯ࢖͏ಓΛબͼ·ͨ͠ɻʣ
  13. ༻ҙ͢Δ΋ͷ w (JU)VC w Ϩϯαόʢࠓճ͸TTIͰ͖Δ΍ͭʣ

  14. ௥ՃͷVHΛ࡞੒ w ίϯύω͔Β௥ՃͷόʔνϟϧϗετΛͭ͘Δ w ʢৄࡉ͸লུɺαϙʔτ͞Μʹฉ͜͏ʂʣ  ॳظυϝ΋7)ͩΖͬͯʁ·͋ͦ͏ͳΜ͚ͩͲ

  15. ྫ Domain : http://lop.8oji.tokyo/ DocmentRoot : {ॳظυϝΠϯDir}/lop.8oji.tokyo/public w ެ։σΟϨΫτϦʢ%PD3PPUʣʹ͸ w

    ϓϩδΣΫτ໊ʢ΍ϑϧͳυϝΠϯ໊ʣΛ͚ͭ w ΋͏ҰஈԼ͛Δ public΍webroot΍htdocsʣ͜ͱΛ w ڧ͘ਪ঑͢Δ ͜ͷ͋ͨΓ͸ޙड़
  16. ద౰ʹGithubʹrepoΛͭ͘Δ w ʢলུʣ w SFQP໊ʹ͸%PD3PPUͰࢦఆͨ͠ϓϩδΣΫτ໊ʢ΍ϑϧ ͳυϝΠϯ໊ʣʹ͓ͯ͘͠ʢͱɺࠓճ͸͠·͢ʣ w QSJWBUFSFQPͰ΋Α͍Ͱ͢ w public/index.htmlΛͭͬͯ͘DPNNJU

    QVTI͓ͯ͘͠
  17. SSH४උ w ʢϩϦϙͳΒʣίϯύω͔Β44)Λ ༗ޮԽ

  18. Ωʔੜ੒(࢖͍·Θ͠ෆՄ) $ ssh-keygen -t rsa -b 4096 \ -C "lop.8oji.tokyo"

    -f ~/.ssh/lop.8oji.tokyo.key w ϨϯαόʹTTIͯ͠΍Δͱָ w ੜ੒͞Εͨެ։伴lop.8oji.tokyo.key.pubΛ(JU)VC ͷEFQMPZLFZʹొ࿥ w "MMPXXSJUFBDDFTT͸ෆཁ
  19. ॳճσϓϩΠ # (ʙ/lop.8oji.tokyo/public౳Ͱ͸ͳ͍ʣ $ cd ~/web/ # طଘϑΝΠϧ͕͋Ε͹ফ͢ $ rm

    -ir ~/web/lop.8oji.tokyo # cloneɺlop.8oji.tokyo͕࡞੒͞ΕΔ $ git clone git@github.com:uzulla/lop.8oji.tokyo.git w ޙड़ͷʮయܕతͳηΩϡϦςΟϦεΫʯΛΑΜͰͶ w ϩϦϙͰ͸ɺBHFOUసૹΛ͢Δ͔ɺޙड़ͷ.git/config मਖ਼
  20. ͜ΕͰͱΓ͋͑ͣσϓϩΠͰ͖ͨ w αΠτʹ͸(JU)VCʹQVTI͍ͯͨ͠public/index.html ͕ݟ͍͑ͯΔ͸ͣ w ʢຖճTTIͰϩάΠϯͯ͠HJUQVMM͢ΔͳΒɺ͜͜·ͰͰ΋ 0,ʣ

  21. Α͠CDͩʂࣗಈԽͩʂ

  22. CronͰpull͢Δ(͑ͬ) */30 * * * * git -c core.sshCommand="ssh -i

    ~/.ssh/deploy.key" \ -C ~/web/lop.8oji.tokyo/ >> ~/lop.8oji.tokyo.pull.log 2>&1 w ҙ༁ɿ෼ʹҰ౓ɺDSPOͰHJUIVC͔ΒϑΝΠϧΛ%-ͯ͠ ͍Δ w ॳΊͯݟͨࢲͷײ૝ʮʜΊͪΌΊͪΌݡ͍ͳ͜Εʯ w ౜ಥͰ͕͢ɺ্͸ϩϦϙͰ͸ବ໨
  23. # ϩϦϙͰ͸… `~/.ssh/config` Λमਖ਼ Host lop.8oji.tokyo.github.com # ద౰ͳΤΠϦΞεతͳ Hostname github.com

    User git IdentityFile ~/.ssh/lop.8oji.tokyo.key ˞ͦͯ͠ɺHJU࣌͸ҎԼͷΑ͏ʹϗετ໊ΛDPOpHʹࢦఆ͠ ͨ΋ͷʹஔ͖׵͑Δ git clone git@lop.8oji.tokyo.github.com:uzulla/lop.8oji.tokyo.git
  24. ͦͯ͜͠͏ # cron */30 * * * * git --git-dir=${HOME}/web/lop.8oji.tokyo/.git

    \ --work-tree=${HOME}/web/lop.8oji.tokyo/ \ >> ${HOME}/lop.8oji.tokyo.pull.log 2>&1 伴͸ɺ.ssh/config಺Ͱࢦఆͱ͍͏͜ͱʹͳΔ
  25. ༨ஊ $ git -C ~/web/lop.8oji.tokyo/ Unknown option: -C ## ??

    $ git --version git version 1.8.3.1 ## ?????? `-c core.sshCommand`΋͔ͭ͑ͳ͍… $ git --git-dir=<snip> --work-tree=~/web/lop.8oji.tokyo status fatal: Could not switch to '~/web/': ?????????????????????? ## ??????????????????????
  26. ʢͳΜͱ͔ͳͬͯ΄͍͠ͳ͊ʜʢνϥονϥο

  27. ʢ࿩Λ໭ͯ͠ʣͰ΋͜Εͬͯ… w ୯७ͰָͰ͸͋Δ͕ʜ ѹ౗తͳʮےྗͰղܾʯײ w ϋΠύʔແବ͕ଟ͍ɺϊοτΤί w ͍͔ʹ΋ౖΒΕͦ͏ʢཁग़యʣ w ஍ٿ؀ڥ΍ྙཧʹ͍ͭͯཧੑతʹߟ͑ͨ݁Ռɺ

    $SPOִؒΛ޿͛Δͱ൓өʹ͕͔͔࣌ؒͬͯετϨε w ͲΜͲΜͱ΋ͷͮ͘ΓΛ͍͖͍ͯͨ͠ͷʹʂ
  28. ͍͞͠Ύ͏͖ͯͳΓΖΜ w (JU)VCʹQVTI͞ΕͨΒ w ͦͷλΠϛϯάͰϨϯαό͔ΒHJUQVMM͍ͨ͠

  29. ͱ͍͏͜ͱͰɺCIͷྗΛआΓΔ w (JUIVC"DUJPOT w IUUQTHJUIVCDPNGFBUVSFTBDUJPOT w (JU)VC͕ఏڙ͢Δ$*πʔϧ w ·ͩϕʔλ͚ͩͲɺ΋͏࢖͑Δɺ΋͏ͦΖͦΖຊαʔϏε w

    1VCMJDSFQPͳΒແྉɺ 1SJWBUFͰ΋ճ਺͕গͳ͚Ε͹ແྉʢͬΆ͍ʣ
  30. CIͱ͸ʁ w ܧଓతΠϯςάͳΜͱ͔ɺΠϚυΩ͸Ͱ͖ͳ͍ͱͩΊΒ͠ ͍ w (JUIVCʹQVTI ౳ ͢ΔͱΫϥ΢υͰ޷͖ͳॲཧ͕Ͱ͖Δ w ྫɿunit

    testɺcomposerɺdeployer w ʢ͕Μ͹Ε͹େମͳΜͰ΋Ͱ͖Δʣ w ʢͭ·Γɺ$%΋౰વͰ͖Δʣ w ࣮ࡍͷॴɺ'51ͰΞοϓϩʔυͩͬͯͰ͖Δ͆
  31. # Github actions ઃఆ(workflow)ྫ name: sample action on: [push] #

    Push͞Εͨͱ͖ʹ jobs: build: runs-on: ubuntu-latest steps: - name: kick git pull.php # ͳΜ͔͢Δ run: curl https://my-server.example.jp/git_pull.php
  32. ΋͏Ұखඞཁ w (JU)VCʹQVTI͞ΕͨΒ w 1VTI͞ΕͨΒˠ()"DUJPOTͰͳʹ͔Ͱ͖Δ w ͦͷλΠϛϯάͰϨϯαό͔ΒHJUQVMM͍ͨ͠ w QVMM͸αʔόʔ಺͔Βૢ࡞͕ඞཁɺ۩ମతʹͲ͏͢ Δʜʁ

    w curl http://XXX/gitpull.phpʁˠා͍ w ࠓճ͸TTIࣗಈԽ͠·͢
  33. sshͰΩοΫ͢Δ $ ssh {ུ} "~/lop.8oji.tokyo/pull_for_lolipop.bash" w γΣϧૢ࡞͠ͳͯ͘΋ɺίϚϯυͰ͏͘͝Α͏ʹ४උ w खݩͷ1$͔Β࣮ߦͰ͖Δ͜ͱΛ֬ೝ͢Δ͜ͱ w

    खݩ1$ͷTTIBHFOU͕͖͍ͪΌͬͯΔͱɺ伴͕ͪΌΜ ͱͰ͖ͯͳͯ͘΋ಈ͍ͪΌ͏ͷͰ஫ҙ
  34. pull_for_lolipop.bash #!/usr/bin/env bash SCRIPT_DIR=$(cd $(dirname $0); pwd) git \ --git-dir=${SCRIPT_DIR}/.git

    \ --work-tree=${SCRIPT_DIR} \ pull # ͜Ε͸ʮϩϦϙ༻ʯɺଞͳΒ·ͨॻ͖ํ΋͋Δ
  35. GitHub Ac*ons͔Βssh࣮ߦ͢Δʹ͸ʁ w ී௨ʹrunॻ͍ͯ΋Ͱ͖Δ͕ɺTTIൿີ伴ͷѻَ͍͕໳ w ύεϫʔυΛHJUʹίϛοτʢຒΊࠐΈʣˠ࿙ΕΔˠࢮ w ൿີ伴Λίϛοτˠ࿙ΕΔˠࢮ

  36. ac#ons/remote-ssh-commands w "DUJPOT͸4FDSFUͰ࣮ߦ͚࣌ͩऔΓग़ͤΔྖҬ͕͋Δ w 4FDSFUʹ͍ΕͨΩʔΛ͔ͭͬͯTTIͰ͖Δ w IUUQTHJUIVCDPNNBSLFUQMBDFBDUJPOTSFNPUFTTI DPNNBOET w ͜Εܥ୔ࢁ͋ΓɺͲΕ͕͍͍͔͸ਖ਼௚Θ͔Βͳ͍ʣ

    w ࠷ߴศརʂ
  37. Secretʹൿີ৘ใΛอଘ w SFQPTFUUJOHT4FDSFUTͰϗε τɺϙʔτɺϢʔβʔɺ伴Λઃఆ w ࡉ͔͍͜ͱ͸লུɺϙνϙνͰ͢

  38. ͱ͍͏͜ͱͰac#onsͷ࣮ྫ name: continuous deploy on: push: branches: - master jobs:

    build: runs-on: ubuntu-latest # ଓ͘
  39. # ଓ͖ steps: - uses: actions/checkout@v1 - name: pull from

    deloy target uses: fifsky/ssh-action@master with: command: ~/web/lop.8oji.tokyo/pull_for_lolipop.bash port: ${{ secrets.SSH_PORT }} host: ${{ secrets.SSH_HOST }} user: ${{ secrets.SSH_USER }} key: ${{ secrets.PRIVATE_KEY}}
  40. σϞ͔͚ͨͬͨ͠Ͳ ࠓ೔͸ձ৔౎߹Ͱ Ͱ͖ͳ͍Β͍͠ͷͰলུ

  41. None
  42. IUUQTHJUIVCDPNV[VMMBMPQPKJUPLZP

  43. ·ͱΊ w (JU)VCͱϨϯαόͰࡶͳ$%Ͱ͖Δʂ w Ϩϯαό͸1)1͕͏͘͝ʂʂʂʂ w ͔͠΋͍҆ʂ w ʮϫΠͷՈʹ͸΋͏)FSPLV͸͍Βͳ͍Μ΍ʂʂʯ ͍͍͗͢

    w ةݥͳ'51ΞΧ΢ϯτڞ༗΍؅ཧ͕(JU)VCͷDPNNJUݖݶ ؅ཧʹͳΓɺҰཡͰ͖ͯ҆શ໌֬؆ศ
  44. ൃలܕ w /VYUͱ͔+4ͷϓϩδΣΫτͳΒී௨ʹ"DUJPOTͰϏϧυ͢ Ε͹0, w ੩తαΠτδΣωϨʔλ΋΋ͪΖΜ0, w ·ͱ΋ʹ΍ΔͳΒ%FQMPZFSΛʢ1)1FSͷ࿩Ͱ͢ʣ w εέʔϧΞ΢τʁී௨ʹϚωΫϥ΍)FSPLVआΓͯͩ͘͞

    ͍ʜ
  45. ׬ʂ w ϓΞϚϯζͳϨϯαόಓ͸ଓ͘ʜ w ʢࢼ࣌͢͸࣍ϖʔδҎ߱΋ݟ͍ͯͩ͘͞ʣ

  46. Ϩϯαόʹ͓͚ΔయܕతͳηΩϡϦςΟϦεΫ w HJUDMPOF͢Δͱ.git͕Ͱ͖Δ w SFQP௚ԼʹJOEFYIUNMΛஔ͘ͳΒ ͜ΕͷΞΫηε੍ݶΛ ͠ͳ͍ͱବ໨ /index.html /.git/ ←

    ΞΫηε͞Εͨ͘ͳ͍ʂ http://my.example.jp/.git/ ͰΞΫηεͰ͖Δʢʁʣ ͷͰΞΫηε੍ݶ͕ඞཁ
  47. ͦ΋ͦ΋௚Լʹindex.htmlஔ͘ͷ͸Ͳ͏ͳͷʁ w ৗࣝత ʹߟ͑ͯɺpublicͱ͔htdocsͱ͔ҰݸσΟϨ ΫτϦΛ࡞Δ w όʔνϟϧϗετʢ7)ʣઃఆͰʙ/public/ʹ͘ΔΑ͏ ʹઃఆ͢Ε͹͍͍ΑͶ /public/index.html /.git

    # …ͱࢥ͍͖΍ɺ͜Ε͚ͩͰ͸ବ໨ʂʂ
  48. w ʮଟ͘ͷʯϨϯαόͷ7)ػೳ͸ॳظυϝΠϯͷ%PD3PPU ҎԼʹ͔͠7)ͷ%PD3PPU͕ͭ͘Εͳ͍ w ྫɿ/home/hoge/www/virtual.host.example w ͢ΔͱҎԼͷ63-Ͱ΋ΞΫηε͕Ͱ͖Δ ࣄ͕ଟ͍ w http://{ॳظυϝ}/virtual.host.example/.git

    w ͳͷͰɺʢͨͱ͑͹ʣ)PTUϔομΛݟͯʮਖ਼͍͠ʯ)PTU Ͱ͜ͳ͍ͳΒɺ஄͘ඞཁ͕͋Δ
  49. # .htaccess # VH಺ʹઃஔ # your.domain.testҎ֎ͷhost #ʢͭ·Γॳظυϝͱ͔ʣ͕͖ͨΒ஄͘ SetEnvIf Host "^your.domain.example$"

    allow_host <RequireAll> Require env allow_host </RequireAll>
  50. ͜ΕͰ΋ෆ҆ w ͳͷͰɺࣗ෼͸ॳظυϝΠϯΛઌʹ௵͍ͯ͠Δɻ # .htaccess # ॳظυϝͷhtdocsʹઃஔ SetEnvIfNoCase Host "^default.domain.example$"

    deny_host <RequireAll> Require all granted Require not env deny_host </RequireAll>
  51. w ʢ౰વʣॳظυϝΠϯ͕࢖͑ͳ͘ͳΓ·͢ w ͍͍ͪͪ)PTUࢦఆͯ͠Δͷ͸શEFOZͰ͸ࢠσΟϨΫτϦ ʹଘࡏ͢Δ7)ʹӨڹ͢Δ͔Β w IUBDDFTT͸্ҐσΟϨΫτϦΛࢀর͢ΔͷͰɺ਌σΟ ϨΫτϦͰ%FOZ͍ͯ͠Δͱɺࢠ΋ʢ௨ৗʣEFOZ͞Εͯ ͠·͏

  52. w ͜Ε΄Μͱ͏ʹͲ͏ʹ͔ͯ͠΄͍͠ʢҰ෦ۀऀ͸͜͏ͳͬ ͍ͯͳ͍ʣ w ࣮ࡍ͜ͷ໰୊͕ܰࢹ͞Ε͕ͪ w ςετ؀ڥͱ͔͍ͬͯtest.example.jp͕ www.example.jp/test/ʹͭͳ͕ͬͯͨΓ w ͔͠΋ɺΞΫηε੍ݶ͕ͳ͔ͬͨΓ

  53. w ͜Μͳͤͤ͜·͍͜͠ͱΛ͠ͳͯ͘ྑ͍ੈͷதΛئ͍ͬͯ ·͢ɻ w ֤ࣾؤுͬͯ΄͍͠ w ͜ͷ໰୊͕ͳ͍ۀऀ΋͋Γ·͢

  54. ༨ஊɿͱ͜ΖͰ… w ϩϦϙͷϋΠεϐʔυϓϥϯʢͷMJHIUTQFFEʣ Require envରԠͯ͠ͳ͍ʜͷͰ͸ʁ w ʢ͍·͍ͪެࣜ%PD͕ॆ࣮ͯ͠ͳ͍ʜʣ w ʮʢ3FXSJUF͸ʣ"QBDIFͷ%PDΛΈͯͶʂʯ΢έΔ͆ w

    ͱ͓΋ͬͨΒ
  55. w ௒ɺ࠷ۙ௥Ճ͞Ε͍ͯͨ͆ w ʢ͔͠͠ɺରԠͯ͠ͳ͍࣌ʹɺΤ ϥʔͰͳ͍ͷ͸ͭΒΈʣ

  56. ผͷ༨ஊ ͳΜͰ΋Ͱ͖Δssh伴͸ා͍ͷͰ… w TFDSFUͷதͰ͋ͬͯ΋ɺTTIͷ伴͕Ͳ͔ͬʹ࿙ΕΔͱͳΜ Ͱ΋Ͱ͖ͪΌ͏ͳʁʢ౰ͨΓલʣ w γΣϧϩάΠϯʢͳΜͰ΋ʣͰ͖ΔTTILFZͷଘࡏ͸࠷খ ݶʹ͍ͨ͠ɺ૿΍ͨ͘͠ͳ͍ w ͜͜Ͱ͓͡͞Μྗ͕ΠΩΔʢݪจϚϚʣʜʂ

  57. ~/.ssh/authorized_keys ͷcommand command="path/to/pull.bash", \ no-port-forwarding, \ no-agent-forwarding, \ no-X11-forwarding,no-pty \

    ssh-rsa AA{ެ։伴}== hoge_deploy w a\վߦ^͸ศٓతͳ΋ͷɺҰߦʹ͍ͯͩ͘͠͞
  58. w ~/.ssh/authorized_keysʹcommand=ʙΛهड़ w TTI࣌ʹࢦఆͷίϚϯυ࣮ߦʹʮݶΔʯˠͪΐͬͱ҆৺ w ʢΩʔ͸ઐ༻ʹ࡞Δ΂͖ɺੜ੒ํ๏͸લड़ͱಉ༷ʣ w ͜ΕͰʮಛఆίϚϯυ͚ͩୟ͚ΔTTIʯ͕ൃੜ͠ɺ ੈքʹฏ࿨͕๚ΕͨͷͰ͋ͬͨʜɻ

  59. ͱɺ͓΋͍ͬͯͨΜ͚ͩͲ w Ͳ͏΋ϩϦϙͷTTIͰ͸command=͕͖͔ͳ͍ͬΆ͍ w ผͷۀऀͰ͸ಈ͘ͷͰʜʁ w ݟͳ͔ͬͨ͜ͱʹ͠·ͨ͠

  60. ผͷߴ౓ͳ༨ஊʢ஫ҙ఺ʣ w ssh-agent͕͏͍͍ͯ͝Δͱɺ-iࢦఆͯ͠΋͕ͦͬͪ༏ ઌ͞ΕͯγΣϧ্͕͕Δ͜ͱ͕͋Δʢςετ࣌ʹϋϚΔʣ w unset SSH_AUTH_SOCK w DPNNBOE͸ʮϩάΠϯγΣϧ্Ͱ࣮ߦ͞ΕΔʯΑʂ w

    ྫ͑͹chsh͢Δͷ͕͜Θͯ͘.***rcͱ͔Ͱbashͱ͔ ΍ͬͯγΣϧ੾Γସ͑ͯ͠ΔͱɺγΣϧʹ΋ͲͬͪΌ͏ ͷͰ஫ҙɻ ͪΌΜͱ੍ݶ͞Ε͍ͯΔ͜ͱ͸֬ೝ͠·͠ΐ͏ʂ