WordPress用ローカル環境構築ツール 「Local by Flywheel」を使ってみて

25af5d057e0359289c9a8eca5be0c455?s=47 kassy
February 11, 2017

WordPress用ローカル環境構築ツール 「Local by Flywheel」を使ってみて

25af5d057e0359289c9a8eca5be0c455?s=128

kassy

February 11, 2017
Tweet

Transcript

  1. WordPress༻ϩʔΧϧ؀ڥߏஙπʔϧ ʮLocal by FlywheelʯΛ࢖ͬͯΈͯ ୈ62ճ WordBenchେࡕ ദݪɹ߶(Χογʔ)

  2. ࣗݾ঺հ ദݪɹ߶ʢΧογʔʣ WebσβΠφʔʗϑϩϯτΤϯυΤϯδχΞʗ3DCGσβΠφʔ Digistry ୅ද େֶɾઐ໳ֶߍͷߨࢣ WordBenchେࡕϞσϨʔλʔʗWordCamp Kansai2016࣮ߦҕһ WordPressςʔϚʮBG Photo

    Frameʯ 3DΘ΀ʔ WordCamp Kansai2016࣮ߦҕһ
  3. Έͳ͞ΜɺWordPressͰαΠτߏங͢Δͱ͖ʹ ϩʔΧϧ؀ڥ͸࢖͍ͬͯ·͔͢ʁ

  4. ͲΜͳϩʔΧϧ؀ڥߏஙπʔϧΛ࢖͍ͬͯ·͔͢ʁ VCCW Wocker MAMP VVV XAMPP ͲΕ΋ศརͳ΋ͷ͹͔Γɻ

  5. Local By Flywheel ͦ͜ʹ৽ͨͳπʔϧ͕ొ৔ɻ https://local.getflywheel.com/

  6. Local by Flywheelͱ͸ • DockerϕʔεͷWordPress༻ϩʔΧϧ։ൃ؀ڥπʔϧɻ • ݩʑ͸Pressmaticͱ͍͏໊લͰ2016೥7݄ʹ$129ͰϦϦʔεɻ • ͦͷޙɺFlywheelͱ͍͏σβΠφʔ΍αΠτ੍࡞ձࣾ޲͚ͷϗεςΟϯά ձࣾʹങऩʹങऩ͞Εɺݱࡏͷ໊લʹͳͬͯϑϦʔιϑτ΢ΣΞʹɻ

    • ݱࡏ͸Mac൛ͷΈɻ
  7. ਐߦதͷϓϩδΣΫτΛLocal by FlyWheelʹҠߦͯ͠ ͠͹Β͘࢖ͬͯΈ·ͨ͠ɻ Local by Flywheel΁ͷҠߦ http://www.u-arts.jp https://light-accessory.shop U-ARTS

    Light
  8. ࠓճ͸MacͰͷखॱͷΈ͓࿩͠·͢ɻ

  9. Local by Flywheelͷಛ௃ • GUIͰΒ͘Β͘ૢ࡞ɻ • ઃఆΛೖྗ͢Δ͚ͩͰɺWordPress͕Πϯετʔϧ͞Ε͙ͯ͢ʹ࢖͑ΔΑ͏ʹɻ • ։ൃʹศརͳπʔϧ͕ͨ͘͞Μಉࠝɻ

  10. Πϯετʔϧ VirtualBox΋ඞཁͰ͕͢ɺແ͚Ε͹ࣗಈͰΠϯετʔϧͯ͘͠Ε·͢ɻ Let's GoʂϘλϯΛԡ͚ͩ͢ɻ

  11. ϩʔΧϧ؀ڥΛҰׅ؅ཧ αʔόʔɺPHPͷόʔδϣϯ੾Γସ͑ SSL SSH BluePrints ΤΫεϙʔτɺΠϯϙʔτ Xdebug Local by Flywheelͷػೳ

    ෳ਺ͷϩʔΧϧ؀ڥΛಉ࣌ʹىಈɺγϟοτμ΢ϯ ApacheͱnginxΛ੾Γସ͑ɻPHP5.6ɺ7.03ͳͲɺෳ਺ͷPHPόʔδϣϯΛ੾Γସ͑ httpsͰͷঢ়ଶΛϓϨϏϡʔ rootΞΫηε΋Մ ηοτΞοϓͨ͠WordPressͷঢ়ଶΛςϯϓϨʔτԽɻαΠτͷΫϩʔϯΛ࡞੒ɻ σʔλϕʔε͝ͱσʔλΛzipΞʔΧΠϒԽɻΠϯϙʔτ͢Ε͹͙͢ʹ෮׆ɻ PHPStormͰͷσόοΫઃఆΛϘλϯͻͱͭͰɻ
  12. WP-CLI adminer ngrok Mailcatcher WordPress༻ίϚϯυϥΠϯπʔϧ σʔλϕʔε؅ཧπʔϧ Ұ࣌తʹϩʔΧϧ؀ڥΛ֎෦ʹެ։Ͱ͖Δπʔϧ ϝʔϧૹ৴ͷςετπʔϧ ಉࠝπʔϧ

  13. αΠτͷϑΝΠϧߏ੒ app public sql conf log WordPressຊମ σʔλϕʔεؔ࿈ϑΝΠϧ αʔόʔɺPHPͳͲͷઃఆϑΝΠϧ ϩάϑΝΠϧ

    site ϧʔτϑΥϧμ
  14. ؔ࿈ϑΝΠϧͷ৔ॴ ϗʔϜσΟϨΫτϦ/.docker/machine/machines/local-by-flywheel Ծ૝ϚγϯϑΝΠϧ ઃఆϑΝΠϧ ϗʔϜσΟϨΫτϦ/Library/Application Support/Local by Flywheel Ծ૝Ϛγϯ͕ىಈ͠ͳ͘ͳΔ͜ͱ͕Կճ͕ى͜Γ·ͨ͠ɻ όοΫΞοϓ͍ͯͨؔ͠࿈ϑΝΠϧΛ্ॻ͖ίϐʔͨ͠ΒىಈͰ͖ΔΑ͏ʹɻ

    ※.dockerͱLibrary͸Ӆ͠ϑΥϧμʹͳ͍ͬͯ·͢ɻ Ӆ͠ϑΥϧμΛදࣔͤ͞ΔΞϓϦΛ࢖͏͔ɺλʔϛφϧͰҎԼͷίϚϯυΛଧͭͱදࣔͰ͖·͢ɻ defaults write com.apple.finder AppleShowAllFiles TRUE killall Finder όοΫΞοϓ͸͜·Ίʹ…
  15. ଞͷϩʔΧϧ؀ڥ͔ΒͷҠߦ

  16. • wp-contentϑΥϧμ • σʔλϕʔε(WP-CLIɺphpMyAdminͳͲͰ.sqlϑΝΠϧΛΤΫεϙʔτ) Local by FlywheelͰ࡞੒ͨ͠αΠτʹΠϯϙʔτ ଞͷϩʔΧϧ؀ڥ͔ΒσʔλΛΤΫεϙʔτ σʔλͷҠߦ •

    wp-contentϑΥϧμ • σʔλϕʔε(WP-CLIɺadminerͳͲͰ.sqlϑΝΠϧΛΠϯϙʔτ) σʔλϕʔεͷυϝΠϯ໊Λॻ͖׵͑ WP-CLIͷwp search-replaceɺDATABASE SEARCH AND REPLACE SCRIPT IN PHPͳͲΛ࢖༻ old-site.dev → new-site.dev HOSTSϑΝΠϧΛฤू(ඞཁͳ৔߹ͷΈ) /private/etc/hosts Ҏલͱಉ͡υϝΠϯ໊Λ࢖༻͢Δ৔߹͸چϩʔΧϧ؀ڥͷهड़෦෼Λ࡟আ
  17. ΋ͬͱշదʹ࢖͏ͨΊʹ

  18. σϓϩΠπʔϧͷಋೖ ͜Ε͚ͩͷػೳ͕ἧ͍ͬͯ·͕͢ɺݱࡏͷόʔδϣϯ(1.4.2)Ͱ͸ɺ WordMoveͳͲͷσϓϩΠπʔϧ͸ಉࠝ͞Ε͍ͯ·ͤΜɻ ͜ͷ··ͩͱϦϞʔταʔόʔͱͷಉظ͕গ͠໘౗Ͱ͢ɻ ͦ͜Ͱ…

  19. WordMoveΛΠϯετʔϧ ϗετϚγϯʹWordMoveΛΠϯετʔϧ͢Δ͜ͱͰ σϓϩΠ͕؆୯ʹग़དྷΔΑ͏ʹͳΓ·͢ɻ λʔϛφϧͰΠϯετʔϧ gem install wordmove

  20. Movefileͷ࡞੒ WordPressຊମ௚ԼʹςΩετΤσΟοτͳͲͰ ʮMovefileʯͱ͍͏໊শͰςΩετϑΝΠϧΛ࡞੒

  21. https://github.com/welaika/wordmove Movefileͷฤू local: vhost: "http://wordpress.dev" wordpress_path: "~/Local Sites/ wordpress database:

    name: "local" user: "root" password: "root" ؅ཧը໘ͰDBͷ৘ใΛࢀরɻϙʔτ΋هड़͢Δɻ ϦϞʔταʔόʔͷ৘ใ΋هड़͢Δɻ αϯϓϧΛݩʹlocalͷMovefileͷ֤߲໨Λهड़ɻ
  22. WordMoveͷ࣮ߦ ϦϞʔτ͔ΒσʔλϕʔεɺίϯςϯπΛऔಘ wordmove pull -d -u ϩʔΧϧ͔Β͔ΒςʔϚΛΞοϓϩʔυ wordmove push -t

    WordPressຊମͷσΟϨΫτϦʹҠಈ WordMoveίϚϯυ cd /Users/Ϣʔβʔ໊/Local\ Sites/αΠτͷϧʔτσΟϨΫτϦ/app/public
  23. όονϑΝΠϧͰWordMoveͷ࣮ߦ ϑΝΠϧͷμϒϧΫϦοΫͰσϓϩΠ ςΩετΤσΟοτͳͲͰɺϑΝΠϧ໊.command ͱ͍͏ϑΝΠϧΛ࡞੒ อଘޙɺλʔϛφϧͰ࣮ߦݖݶΛ௥Ճ chmod u+x ϑΝΠϧ໊.command ίϚϯυΛهड़ ςʔϚͷpush

    DBɺϝσΟΞͷpull ϑΝΠϧͷμϒϧΫϦοΫͰ࣮ߦ cd [αΠτύε]/app/public/ wordmove push -t cd [αΠτύε]/app/public/ wordmove pull -d -u
  24. ͦͷଞ

  25. ΄͔ͷCMSͷΠϯετʔϧɺಈ࡞ɺ؅ཧ 1. publicϑΥϧμ಺ͷWordPressͷຊମϑΝΠϧΛ࡟আɻ 2. Πϯετʔϧ͍ͨ͠CMSͷຊମϑΝΠϧΛpublicϑΥϧμʹίϐʔɻ 3. σʔλϕʔεͷશςʔϒϧΛ࡟আɻ 4. ֤CMSͷํ๏ʹैͬͯΠϯετʔϧɻ EC-CUBE

    EC-CUBE΍concrete5͕ΠϯετʔϧͰ͖Δ͜ͱΛ֬ೝɻ concrete5
  26. ࠓޙͷ։ൃ༧ఆ • Windows൛΋ϦϦʔε༧ఆ • σϓϩΠπʔϧ(Flywheelαʔόʔ΁ͷΈରԠ?) • ϦϞʔταΠτΛΠϯϙʔτ • ϓϨϛΞϜαϙʔτ •

    Pro൛΋։ൃத
  27. ͝ਗ਼ௌ͋Γ͕ͱ͏͍͟͝·ͨ͠ɻ շదͳϩʔΧϧ؀ڥΛ࡞Δʹྑ͍αΠτΛ࡞Δ͜ͱͰ͢ɻ