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

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

kassy
February 11, 2017

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

kassy

February 11, 2017
Tweet

More Decks by kassy

Other Decks in Technology

Transcript

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

    View full-size slide

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

    View full-size slide

  3. Έͳ͞ΜɺWordPressͰαΠτߏங͢Δͱ͖ʹ
    ϩʔΧϧ؀ڥ͸࢖͍ͬͯ·͔͢ʁ

    View full-size slide

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

    View full-size slide

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

    View full-size slide

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

    View full-size slide

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

    View full-size slide

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

    View full-size slide

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

    View full-size slide

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

    View full-size slide

  11. ϩʔΧϧ؀ڥΛҰׅ؅ཧ
    αʔόʔɺPHPͷόʔδϣϯ੾Γସ͑
    SSL
    SSH
    BluePrints
    ΤΫεϙʔτɺΠϯϙʔτ
    Xdebug
    Local by Flywheelͷػೳ
    ෳ਺ͷϩʔΧϧ؀ڥΛಉ࣌ʹىಈɺγϟοτμ΢ϯ
    ApacheͱnginxΛ੾Γସ͑ɻPHP5.6ɺ7.03ͳͲɺෳ਺ͷPHPόʔδϣϯΛ੾Γସ͑
    httpsͰͷঢ়ଶΛϓϨϏϡʔ
    rootΞΫηε΋Մ
    ηοτΞοϓͨ͠WordPressͷঢ়ଶΛςϯϓϨʔτԽɻαΠτͷΫϩʔϯΛ࡞੒ɻ
    σʔλϕʔε͝ͱσʔλΛzipΞʔΧΠϒԽɻΠϯϙʔτ͢Ε͹͙͢ʹ෮׆ɻ
    PHPStormͰͷσόοΫઃఆΛϘλϯͻͱͭͰɻ

    View full-size slide

  12. WP-CLI
    adminer
    ngrok
    Mailcatcher
    WordPress༻ίϚϯυϥΠϯπʔϧ
    σʔλϕʔε؅ཧπʔϧ
    Ұ࣌తʹϩʔΧϧ؀ڥΛ֎෦ʹެ։Ͱ͖Δπʔϧ
    ϝʔϧૹ৴ͷςετπʔϧ
    ಉࠝπʔϧ

    View full-size slide

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

    View full-size slide

  14. ؔ࿈ϑΝΠϧͷ৔ॴ
    ϗʔϜσΟϨΫτϦ/.docker/machine/machines/local-by-flywheel
    Ծ૝ϚγϯϑΝΠϧ
    ઃఆϑΝΠϧ
    ϗʔϜσΟϨΫτϦ/Library/Application Support/Local by Flywheel
    Ծ૝Ϛγϯ͕ىಈ͠ͳ͘ͳΔ͜ͱ͕Կճ͕ى͜Γ·ͨ͠ɻ
    όοΫΞοϓ͍ͯͨؔ͠࿈ϑΝΠϧΛ্ॻ͖ίϐʔͨ͠ΒىಈͰ͖ΔΑ͏ʹɻ
    ※.dockerͱLibrary͸Ӆ͠ϑΥϧμʹͳ͍ͬͯ·͢ɻ
    Ӆ͠ϑΥϧμΛදࣔͤ͞ΔΞϓϦΛ࢖͏͔ɺλʔϛφϧͰҎԼͷίϚϯυΛଧͭͱදࣔͰ͖·͢ɻ
    defaults write com.apple.finder AppleShowAllFiles TRUE
    killall Finder
    όοΫΞοϓ͸͜·Ίʹ…

    View full-size slide

  15. ଞͷϩʔΧϧ؀ڥ͔ΒͷҠߦ

    View full-size slide

  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
    Ҏલͱಉ͡υϝΠϯ໊Λ࢖༻͢Δ৔߹͸چϩʔΧϧ؀ڥͷهड़෦෼Λ࡟আ

    View full-size slide

  17. ΋ͬͱշదʹ࢖͏ͨΊʹ

    View full-size slide

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

    View full-size slide

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

    View full-size slide

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

    View full-size slide

  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ͷ֤߲໨Λهड़ɻ

    View full-size slide

  22. WordMoveͷ࣮ߦ
    ϦϞʔτ͔ΒσʔλϕʔεɺίϯςϯπΛऔಘ
    wordmove pull -d -u
    ϩʔΧϧ͔Β͔ΒςʔϚΛΞοϓϩʔυ
    wordmove push -t
    WordPressຊମͷσΟϨΫτϦʹҠಈ
    WordMoveίϚϯυ
    cd /Users/Ϣʔβʔ໊/Local\ Sites/αΠτͷϧʔτσΟϨΫτϦ/app/public

    View full-size slide

  23. όονϑΝΠϧͰWordMoveͷ࣮ߦ
    ϑΝΠϧͷμϒϧΫϦοΫͰσϓϩΠ
    ςΩετΤσΟοτͳͲͰɺϑΝΠϧ໊.command
    ͱ͍͏ϑΝΠϧΛ࡞੒
    อଘޙɺλʔϛφϧͰ࣮ߦݖݶΛ௥Ճ
    chmod u+x ϑΝΠϧ໊.command
    ίϚϯυΛهड़
    ςʔϚͷpush
    DBɺϝσΟΞͷpull
    ϑΝΠϧͷμϒϧΫϦοΫͰ࣮ߦ
    cd [αΠτύε]/app/public/
    wordmove push -t
    cd [αΠτύε]/app/public/
    wordmove pull -d -u

    View full-size slide

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

    View full-size slide

  25. ࠓޙͷ։ൃ༧ఆ
    • Windows൛΋ϦϦʔε༧ఆ
    • σϓϩΠπʔϧ(Flywheelαʔόʔ΁ͷΈରԠ?)
    • ϦϞʔταΠτΛΠϯϙʔτ
    • ϓϨϛΞϜαϙʔτ
    • Pro൛΋։ൃத

    View full-size slide

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

    View full-size slide