Upgrade to Pro — share decks privately, control downloads, hide ads and more …

レンサバけもの道

uzulla
February 10, 2020

 レンサバけもの道

uzulla
2020-02-10 PHPerKaigi 2020 day 1

uzulla

February 10, 2020
Tweet

More Decks by uzulla

Other Decks in Technology

Transcript

  1. Ͱ΋ίϚϯυ͕ແ͍orݹ͍ • ͨͱ͑͹git 1.8.3ͱ͔… • ݹ͍ͳΒɺϏϧυͪ͠Ό͓͏ϗττΪε • ͳΜͱେ఍ϏϧυͰ͖Δ؀ڥ͸͋Δ $ wget

    https://ʙ/git-2.9.5.tar.gz $ tar xvzf gitʙ; cd gitʙ $ configure --prefix=$HOME/local/bin $ make -i install # -i is ignore $ echo "PATH=$PATH:~/local/bin/" >> ~/.bashrc
  2. • ී௨ʹ • ʢsshͯ͠ʣgit pull • Shell Script/Makefile • ansible(౳

    sshࣗಈԽ) • Deployer • ͔ͭ͑͹͍͍ΜͰ͢Α
  3. ͨͱ͑͹ྫ # Ϩϯαόͷઃఆ͸লུ $ mkdir ~/repo; cd ~/repo $ git

    clone [email protected]:uzulla/Mizam.git $ cd Mizam $ make dev-setup # composer instlal౳ $ ln -s ~/repo/Mizam/public/ \ ~/www/pktest.8oji.tokyo/public_html
  4. ΫϨσϯγϟϧ • Tokenͱ͔ΛͲ͜ʹ࢓ࠐΉ͔ʁ • VPSಉ༷ʹ dotenv • ʮ্Ґʯͷ.htaccess׆༻ # (publicͷΈɺwwwҎԼʹln

    -sͨ͠؀ڥͰʣ # ~/www/pktest.8oji.tokyo/.htaccess SetEnv TOKEN xxxxxx # $_ENVͰͳ͘getenv()Ͱऔಘ͢Δ΄͏͕ແ೉ # symlinkΛͨͲΒͳ͍ͷͰɺ஫ҙ # cli͋ΔͳΒແཧ͔ͳʔw
  5. ͭ·Γ # Appͷ git cloneઌ ~/repo/Mizam/ # ຊ෺ͷhtdocs ~/repo/Mizam/public #

    Ϩϯαόઃఆͷhtdocsʢln -s͢Δʣ ~/www/pktest.8oji.tokyo/public_html # App dirͷʮ֎ʯʹɺenv༻ͷ.htaccessΛͭ͘ΔʢOPʣ ~/www/pktest.8oji.tokyo/.htaccess
  6. $ dig pktest.8oji.tokyo @ns1.dns.ne.jp # ུ ;; ANSWER SECTION: pktest.8oji.tokyo.

    3600 IN A 59.106.19.66 # ;; AUTHORITY SECTION: pktest.8oji.tokyo. 3600 IN NS ns1.dns.ne.jp. pktest.8oji.tokyo. 3600 IN NS ns2.dns.ne.jp.
  7. $ dig www.example.com @ns.example.com # ུ ;; ANSWER SECTION: www.example.com.

    3534 IN A XXX.XXX.XXX.XXX ʔʔʔ www.example.com. 3534 IN CNAME www1234.example.jp
  8. Tips:FTPͷREST # REST → RESTART # lftp ίϚϯυͷ৔߹ $lftp [email protected]

    # ॳճDL > get large.log # ࠩ෼DL > reget large.log
  9. s"pʹ΋͋ΔΑ $ sftp [email protected] sftp> get large.log Fetching /path/to/large.log to

    large.log sftp> reget large.log Resuming /path/to/large.log to large.log
  10. ϛϥʔతʹखݩʹམͱ͍ͨ͠ͱ͖͸ • FTPͤͣɺrsync͕͍͍ͧ • (ssh+rsyncͬͯຊ౰ʹศརͩΑͶ…) $ rsync -auz -e "ssh"

    --progress \ [email protected]:app app_copy # ͓޷ΈͰauvzͰ΋Α͍͔ͱ • ໪࿦ٯ΋Ͱ͖·͕͢ɺrsyncʢʹݶΒͣϛϥʔΞο ϓϩʔυʣ͸ࣄނΓ΍͍͢ͷͰɺdry-runͯ֬͠ೝ ͔ͯ͠Βʹ͠Α͏Ͷɻ
  11. PHPόΠφϦͷ৔ॴ • whichͰ୳ͤͳ͍ɺ֤ࣾͰόϥόϥͰ͢ • Un-documentͳ͜ͱ͕ଟ͍ͷͰɺphpinfo()ݟΔ ౳ ͨͱ͑͹खݩͷ͘͞Βͷ৔߹ $ /usr/local/php/7.3/bin/php -v

    PHP 7.3.12 (cli) (built: Dec 5 2019 10:06:07) ( NTS ) $ /usr/local/php/4.4/bin/php -v PHP 4.4.9 (cli) (built: Dec 4 2019 14:37:37) • UnitTest࣌ʹ͸ඞͣόΠφϦͷύεΛࢦఆ͢Δ͜ͱ