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

Amazon S3でWordPressを動かす

Amazon S3でWordPressを動かす

【WordPress特別セミナー】StaticPress × S3 × Vagrant 勉強会
の講演資料
http://atnd.org/events/43607

Twitterまとめ
http://togetter.com/li/576298

■共演の方々の資料
WordPress サイトの 長期的メンテナンス
http://www.slideshare.net/naokomc/wordpress-27138322

現場視点で語るstaticpress開発の背景と事例
http://www.slideshare.net/megumithemes/staticpress-27139158

StaticPress
http://www.slideshare.net/wokamoto1973/staticpress

Amazon S3による静的Webサイトホスティング
http://www.slideshare.net/horiyasu/amazon-s3web-27138902

仮想マシンざっくり解説と実践Vagrant
http://www.slideshare.net/YukihikoSawanobori/staticpress-seminor-vagrantpublic

Yuichiro MASUI

October 13, 2013
Tweet

More Decks by Yuichiro MASUI

Other Decks in Technology

Transcript

  1. Amazon S3Ͱ
    WordPressΛಈ͔͢
    Yuichiro MASUI
    @masuidrive
    Sunday, October 13, 13

    View full-size slide

  2. @masuidrive
    • Yuichiro MASUI - Ichi
    • Open source developer, Ruby fun
    • Pukiwiki, Ruby on Rails tutorial movie in
    Japanese, IKEA hacker
    • Furo-grammer (Coding in hot tub)
    • FrogApps / Toreta. CTO // ex-Appcelerati
    Sunday, October 13, 13

    View full-size slide

  3. Sunday, October 13, 13

    View full-size slide

  4. Hi! I’m @masuidrive.
    • Yuichiro MASUI - Ichi
    • Open source developer, Ruby fun
    • Pukiwiki, Ruby on Rails tutorial movie in
    Japanese, IKEA hacker
    • Furo-grammer (Coding in hot tub)
    • FrogApps, Inc. CTO // ex-Appcelerati
    Sunday, October 13, 13

    View full-size slide

  5. Hi! I’m @masuidrive.
    • Yuichiro MASUI - Ichi
    • Open source developer, Ruby fun
    • Pukiwiki, Ruby on Rails tutorial movie in
    Japanese, IKEA hacker
    • Furo-grammer (Coding in hot tub)
    • FrogApps, Inc. CTO // ex-Appcelerati
    ϛΠϧ
    Sunday, October 13, 13

    View full-size slide

  6. Hi! I’m @masuidrive.
    • Yuichiro MASUI - Ichi
    • Open source developer, Ruby fun
    • Pukiwiki, Ruby on Rails tutorial movie in
    Japanese, IKEA hacker
    • Furo-grammer (Coding in hot tub)
    • FrogApps, Inc. CTO // ex-Appcelerati
    Sunday, October 13, 13

    View full-size slide

  7. Sunday, October 13, 13

    View full-size slide

  8. Sunday, October 13, 13

    View full-size slide

  9. Sunday, October 13, 13

    View full-size slide

  10. Sunday, October 13, 13

    View full-size slide

  11. Sunday, October 13, 13

    View full-size slide

  12. Sunday, October 13, 13

    View full-size slide

  13. blog.masuidrive.jp
    • ॻ͘ͷ͸ࢲҰਓ
    • ίϝϯτ͸ͦΕ΄Ͳ࢖͍ͬͯͳ͍
    • WordPressͳͲͷόʔδϣϯ͸೥1͙Β
    ͍Ͱؾ͕޲͍ͨͱ͖ʹVer. up!
    Sunday, October 13, 13

    View full-size slide

  14. αʔό৐ͬऔΓ
    • ੲ͔Βྑ͋͘Δ
    • ఆظతʹ࿩୊ʹ
    • ϝϯςΛ͍ͯ͠ͳ͍͜ͱ͕ݪҼ
    Sunday, October 13, 13

    View full-size slide

  15. αʔόͷӡ༻͸େม
    • ΞϓϦɺϛυϧ΢ΤΞɺOSͷόʔδϣ
    ϯΞοϓ
    • σΟεΫͳͲͷো֐
    • αʔόͷঢ়ଶ΍ॻ͖ࠐΈͷ؂ࢹ
    Sunday, October 13, 13

    View full-size slide

  16. खؒΛݮΒ͍ͨ͠
    • Ϩϯλϧϒϩά
    • PaaSɹ
    Sunday, October 13, 13

    View full-size slide

  17. ಈతͷඞཁੑ͸ʁ
    • هࣄ͸੩తͳHTMLͰ͍͍ͷͰ͸ʁ
    • ίϝϯτ͸͋·Γ͔ͭͳ͍͠
    • τϥοΫόοΫ͸εύϜଟ͍
    Sunday, October 13, 13

    View full-size slide

  18. Sunday, October 13, 13

    View full-size slide

  19. PHPͱMySQLΛ࢖ͬͨಈతੜ੒
    Sunday, October 13, 13

    View full-size slide

  20. HTMLੜ੒ܕϒϩά
    • Jekyll
    • Octopress
    Sunday, October 13, 13

    View full-size slide

  21. WordPress͔ΒҠߦ
    • طଘͷσʔλΛΠϯϙʔτ͸೉͍͠
    • WPͷσʔλ͸HTMLʹͯ͠ઃஔʁ
    Sunday, October 13, 13

    View full-size slide

  22. WordPressΛHTMLԽ
    • wgetͱ͔curl࢖ͬͨΒWP͔ΒHTMLੜ੒
    Ͱ͖Δ
    • ϒϩάຊମ͸ύεϫʔυͳͲΛ͔͚ͯ
    ੜ੒ͨ͠HTML͚ͩϢʔβʹެ։
    Sunday, October 13, 13

    View full-size slide

  23. ੜ੒ͨ͠HTMLΛެ։
    • ಉ͡αΠτ্Ͱެ։͢Δͱϛυϧ΢Τ
    Ξͷ؅ཧΛ͠ͳ͚Ε͹͍͚ͳ͍
    • WebͷϗεςΟϯάαʔϏεʹஔ͜͏
    • ͦ͏ͳΕ͹Amazon S3
    Sunday, October 13, 13

    View full-size slide

  24. Amazon S3
    • ੈք࠷ߴ඼࣭ͷWebαʔό
    • Քಇ཰ 99.99% SLA(99.9%)
    • ࣗ෼ͷυϝΠϯΛ࢖༻Մೳ
    Sunday, October 13, 13

    View full-size slide

  25. Amazon S3
    • Ξοϓϩʔυ͸ઐ༻ϓϩτίϧ
    • ༰ྔʴసૹྉ՝ۚ
    Sunday, October 13, 13

    View full-size slide

  26. WP͸ϓϥάΠϯ͕ॆ࣮
    • wgetͱ͔࢖Θͳͯ͘΋ϓϥάΠϯͰ
    HTMLੜ੒Ͱ͖Δ෺͋ΔΜ͡Όແ͍ʁ
    Sunday, October 13, 13

    View full-size slide

  27. Sunday, October 13, 13

    View full-size slide

  28. ReallyStatic
    Sunday, October 13, 13

    View full-size slide

  29. StaticPress
    Sunday, October 13, 13

    View full-size slide

  30. ྆ϓϥάΠϯ
    • StaticPress / ReallyStatic
    • ϩʔΧϧʹ੩తHTMLΛੜ੒
    • ReallyStatic
    • FTP/Amazon S3΁Ξοϓϩʔυ
    Sunday, October 13, 13

    View full-size slide

  31. StaticPressͷS3ରԠ
    Sunday, October 13, 13

    View full-size slide

  32. StaticPressͷS3ରԠ
    Sunday, October 13, 13

    View full-size slide

  33. Sunday, October 13, 13

    View full-size slide

  34. Sunday, October 13, 13

    View full-size slide

  35. ߟ͑ಘΔ໰୊఺
    • ಈతͳॻ͖ࠐΈ
    • ಈతͳϓϥάΠϯ
    • ςʔϚ
    • ΞΫηεղੳ
    Sunday, October 13, 13

    View full-size slide

  36. ಈతͳॻ͖ࠐΈ
    • τϥοΫόοΫ
    • ίϝϯτ
    Sunday, October 13, 13

    View full-size slide

  37. ಈతͳϓϥάΠϯ
    • ౤ථ
    • A/Bςετ
    • SEOɹ
    • εϚʔτϑΥϯରԠ
    • ໰͍߹ΘͤϑΥʔϜ
    Sunday, October 13, 13

    View full-size slide

  38. ςʔϚ
    • User AgentΈͯ੾Γସ͍͑ͯΔ
    Sunday, October 13, 13

    View full-size slide

  39. ΞΫηεղੳ
    • ϓϥάΠϯͳͲͰຒΊࠐΉܗࣜ
    Sunday, October 13, 13

    View full-size slide

  40. ରԠํ๏
    • ಈతͳॻ͖ࠐΈ
    • ಈతͳϓϥάΠϯ
    • ςʔϚ
    • ΞΫηεղੳ
    Sunday, October 13, 13

    View full-size slide

  41. ಈతͳॻ͖ࠐΈ
    • JavascriptͰຒΊࠐΉίϝϯτཝ
    • Facebook Comments
    • Disqus
    • Trackback͸࢖Θͳ͍
    Sunday, October 13, 13

    View full-size slide

  42. ಈతͳϓϥάΠϯ
    • ͖͋ΒΊΔ
    • Javascriptϕʔεʹॻ͖׵͑Δ
    • ରԠग़དྷΔΑ͏ʹؤுΔ
    Sunday, October 13, 13

    View full-size slide

  43. ςʔϚ
    • URLͷม׵Λߦ͏෦෼
    • ਖ਼͘͠ॻ͖׵͑Δ
    • User AgentͳͲͰ੾Γସ͑Δ෦෼
    • Javascript΋͘͠͸responsiveʹ
    Sunday, October 13, 13

    View full-size slide

  44. ΞΫηεղੳ
    • Google AnalyticsͱΞΫηεϩάͰ
    Sunday, October 13, 13

    View full-size slide

  45. Sunday, October 13, 13

    View full-size slide

  46. Amazon S3
    • URL rewriting΋αϙʔτ
    • ෳ਺ΞΧ΢ϯτൃߦ
    Sunday, October 13, 13

    View full-size slide

  47. Amazon S3
    http://blog.masuidrive.jp/index.php/2013/08/09/toreta/

    http://blog.masuidrive.jp/2013/08/09/toreta/
    Sunday, October 13, 13

    View full-size slide

  48. Sunday, October 13, 13

    View full-size slide

  49. ࢓্͛
    • DNSΛมߋ
    • 1-2࣌ؒ଴ͭͱมߋ׬ྃ
    Sunday, October 13, 13

    View full-size slide

  50. αʔό͸Ͳ͏͢Δʁ
    • BasicೝূΛ͔͚͓ͯ͘
    • ϩʔΧϧʹҠઃ͢Δ
    Sunday, October 13, 13

    View full-size slide

  51. BasicೝূΛ͔͚Δ
    • ݩͷαʔόΛઃஔͨ͠··શମʹBasic
    ೝূΛ͔͚Δ
    • Basicೝূͷಥഁ͸ࠔ೉
    • ϗετ໊Λద੾ʹ͢Ε͹ਪଌ͸ࠔ೉
    Sunday, October 13, 13

    View full-size slide

  52. ϩʔΧϧʹҠઃ͢Δ
    • αʔόΛެ։͢Δඞཁ͸ͳ͍ͷͰϩʔ
    ΧϧʹҠઃ͢Δ
    • Ոαʔό͔ϥοϓτοϓ
    • ࣗ෼͔͠ॻ͔ͳ͍ͷͰϥοϓτοϓʹ
    ઃஔ
    Sunday, October 13, 13

    View full-size slide

  53. ϥοϓτοϓͰWP
    • OSXʹ͸ඪ४ͰApache+PHP͕ೖͬͯΔ
    • MySQLΛϩʔΧϧʹಋೖ
    • XAMPPͳͲͷύοέʔδ
    Sunday, October 13, 13

    View full-size slide

  54. Sunday, October 13, 13

    View full-size slide

  55. Vagrant
    • Virtual MachineΛ؆୯ʹѻ͏ͨΊͷπʔ
    ϧ
    • VirtualBox΍VMwareͷϑϩϯτΤϯυ
    • ϗετͱͷϑΥϧμڞ༗ɺϙʔτϑΥ
    ϫʔυΛखܰʹͰ͖Δ
    Sunday, October 13, 13

    View full-size slide

  56. Vagrantfile
    Vagrant.configure("2") do |config|
    config.vm.box = "precise32"
    config.vm.box_url =
    "http://files.vagrantup.com/precise32.box"
    config.vm.network \
    :forwarded_port, guest: 8080, host: 8080
    config.vm.synced_folder "www", "/var/www/"
    end
    Sunday, October 13, 13

    View full-size slide

  57. VagrantͰUbuntuΛىಈ
    • vagrant up
    • vagrant ssh
    • vagrant halt
    • vagrant destroy
    Sunday, October 13, 13

    View full-size slide

  58. Vagrant্ʹ؀ڥߏங
    • Apache, PHP, MySQLΛΠϯετʔϧ
    • ApacheͷىಈϙʔτΛ8080ʹมߋ
    • DocumentRoot͸/var/wwwͷ··
    Sunday, October 13, 13

    View full-size slide

  59. WPΛҠઃ
    • ϓϥάΠϯΛ࢖͍export
    • wordpressͷϑΥϧμΛϩʔΧϧͷwww
    ϑΥϧμʹμ΢ϯϩʔυ
    • Ubuntuͷ/var/www͔ΒΞΫηεՄೳ
    Sunday, October 13, 13

    View full-size slide

  60. WPىಈ
    • http://localhost:8080ɹ
    • Wordpressͷॳظઃఆ
    • exportͨ͠σʔλΛಡΈࠐΈ
    Sunday, October 13, 13

    View full-size slide

  61. ϒϩάΛॻ͘ʹ͸
    • vagrant upɹ
    • http://localhost:8080/wp-adminɹ
    • ॻ͖ऴΘͬͨΒStaticPressͰbuild
    • vagrant halt
    Sunday, October 13, 13

    View full-size slide

  62. ͜Ε͔Β
    • StaticPressͰbuildͨ͠ΒMySQLͷσʔλ
    Λdump͢ΔΑ͏ʹ͍ͨ͠
    • rebuild͕΋͏গ͠ૣ͘ͳΔ͏Ε͍͠
    Sunday, October 13, 13

    View full-size slide