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

Engine Yard Cloud 入門

Engine Yard Cloud 入門

9b69fbdeb0713def44a8731091ce5885?s=128

Yusuke Ando

April 08, 2013
Tweet

Transcript

  1. &OHJOF:BSE$MPVEೖ໳

  2. Agenda • αϯϓϧͷσϓϩΠ • &OHJOF:BSE$MPVEͷ֓ཁ • σϓϩΠͱϚΠάϨʔγϣϯ • ֤छϩά৘ใͷ֬ೝ •

    όοΫΞοϓͱεφοϓγϣοτ • εέʔϧΞ΢τ • Πϯελϯε΁ͷ44) • &OHJOF:BSE$-* • $IFGΛར༻ͨ͠؀ڥͷΧελϚΠζ
  3. αϯϓϧͷσϓϩΠ

  4. αϯϓϧͷσϓϩΠ • օ͞ΜͷΞΧ΢ϯτͰσϓϩΠ͠·͢ • ·ͣઌʹྲྀΕΛͻͱ௨Γ͓ݟ͔ͤͯ͠Βɺ֤ࣗʹ΍ͬͯ௖ ͖·͢ • Ϋϥ΢υ্ʹαʔόΛߏங͢Δͷʹ10෼ఔ౓ͷ଴ͪ࣌ؒ ͕ൃੜ͠·͢

  5. Engine Yard Cloudͱ͸ 5

  6. Copyright © 2013 Engine Yard. All Rights Reserved. 6 2006೥ɿ

    Engine Yard ઃཱ (Ruby࣮ߦ؀ڥͷఏڙ։࢝) 2008೥ɿ Amazon༷͕Engine Yardʹग़ࢿΛൃද 2009೥ɿ AWSج൫ͷϓϥοτϑΥʔϜΛఏڙ։࢝ ࠷େڃͷAWSϦηʔϥʔʹ 2011೥ɿ PHP࣮ߦ؀ڥͷఏڙ։࢝ 2012೥ɿ Engine Yard ೔ຊ๏ਓઃཱ Node.js࣮ߦ؀ڥͷఏڙ։࢝ എܠ: Engine Yard, Inc.ͷϏϧ(ӈख)͕ݐͭ1929೥ͷαϯϑϥϯγεί Engine YardͷาΈ
  7. PaaS IaaS SaaS ΞϓϦέʔγϣϯ σʔλ ϥϯλΠϜ ϛυϧ΢ΣΞ OS Ծ૝Խ αʔόʔ

    ετϨʔδ ωοτϫʔΫ ΞϓϦέʔγϣϯ σʔλ ΞϓϦέʔγϣϯ σʔλ ϥϯλΠϜ ϛυϧ΢ΣΞ OS Ծ૝Խ αʔόʔ ετϨʔδ ωοτϫʔΫ ΦϯϓϨϛε ΞϓϦέʔγϣϯ σʔλ ϥϯλΠϜ ϛυϧ΢ΣΞ OS Ծ૝Խ αʔόʔ ετϨʔδ ωοτϫʔΫ ϋʔυ΢ΣΞɺϛυϧ ΢ΣΞɺΞϓϦέʔ γϣϯͷ͢΂ͯΛॴ༗ ͢Δܗଶ ωοτϫʔΫ΍αʔ όʔϚγϯͳͲͷΠϯ ϑϥΛαʔϏεͱͯ͠ ఏڙ͢Δܗଶ ΞϓϦέʔγϣϯͷ ػೳΛαʔϏεͱ͠ ͯఏڙ͢Δܗଶ ϥϯλΠϜ ϛυϧ΢ΣΞ OS Ծ૝Խ αʔόʔ ετϨʔδ ωοτϫʔΫ ΞϓϦέʔγϣϯ࣮ߦ ؀ڥɾ։ൃ؀ڥΛαʔ Ϗεͱͯ͠ఏڙ͢Δܗ ଶ PaaS Πϊϕʔτ Ξ΢τιʔε • ࣗ༝ʹબ୒ʗ։ൃΛ ͢Δ͜ͱ͕Մೳɻ • બ୒ʗઃఆʗ։ൃ ޻਺͕͔͔Δɻ • Πϊϕʔτ૚͕૿͑ Δ΄Ͳ޻਺૿Ճɻ • ॴ༗ʗ։ൃίετ͕ ͔͔ΒͣʹࡁΉɻ • Πϊϕʔτ૚ʹूத Ͱ͖Δɻ • Ξ΢τιʔε૚ຖʹ બ୒෯͕ݶఆ͞Εͯ ͍Δɻ
  8. Engine Yard ͷఏҊ͢Δ PaaS ΞϓϦέʔγϣϯͱσʔλͷ Πϊϕʔγϣϯʹूத ʹ PaaS ͷڧΈ

  9. ͳΜ͔ͩΑ͘Θ͔Γ·ͤΜͶ ΋͏͢͜͠۩ମతʹ ߟ͑ͯΈ·͠ΐ͏

  10. Ұൠతͳ2૚Ϋϥελߏ੒ Application Server Application Server Application Server Master Database Slave

    Database LB
  11. ౰વग़དྷ·͢ΑͶʁ Application Server Application Server Application Server Master Database Slave

    Database LB •Ϋϥελߏ੒ͷڍಈͷཧղ •͜ͷߏ੒ͷγεςϜηοτΞοϓ •͜ͷߏ੒ͷγεςϜͷӡ༻
  12. Ͱ͸࣭໰Ͱ͢ ઌ΄Ͳͷߏ੒ͷγεςϜΛ ͲΕ͘Β͍ͷ࣌ؒ ͰߏஙͰ͖·͔͢ʁ

  13. Ͱ͸࣭໰Ͱ͢ ઌ΄Ͳͷߏ੒ͷγεςϜΛ 10ηοτΛ ͲΕ͘Β͍ͷ࣌ؒ ͰߏஙͰ͖·͔͢ʁ

  14. ؤுΓ·ͨ͠

  15. Ͱ͸࣭໰Ͱ͢ ઌ΄Ͳͷߏ੒ͷγεςϜΛ ࠷৽൛΁ͷߋ৽Λ ͲΕ͘Β͍ͷ࣌ؒ Ͱ׬ྃͰ͖·͔͢ʁ

  16. Ͱ͸࣭໰Ͱ͢ ઌ΄Ͳͷߏ੒ͷγεςϜΛ Քಇঢ়گͷ؂ࢹମ੍΋ ༻ҙͰ͖·͔͢ʁ

  17. Ͱ͸࣭໰Ͱ͢ Πϯϑϥʹڧ͍ ΤϯδχΞ͕ܧଓతʹ ౒ྗ͢Ε͹ग़དྷΔ

  18. ͔͠͠ɺΠϯϑϥ࡞ۀ͕޻਺Λѹഭ 18 Πϯϑϥཁһ ։ൃཁһ

  19. Engine Yard Cloud ͸ ͋ͳͨͷҝͷ ੌ࿹ΠϯϑϥΤϯδχΞ

  20. ࠷ઌ୺ͷࣗಈԽɾٕज़ελοΫ

  21. μογϡϘʔυ΍CLI͔Βͷߴ౓ͳӡ༻ σϓϩΠ όοΫΞοϓ ΫϥελϦϯάߏ੒ NoSQL εϨʔϒDB Ϋϩʔϯ ϦόʔεϓϩΩγ Cron δϣϒ

    ৽نߏங ύοέʔδಋೖ ΞϓϦέʔγϣϯӡ༻ γεςϜ؅ཧ μογϡϘʔυ͔Β ༷ʑͳγεςϜΛਝ଎ʹߏ੒
  22. σϓϩΠ

  23. VNOCͰ؂ࢹ΋ߦ͍·͢ 23 Virtual Network Operation Center ্ͰαϙʔτνʔϜ͕ 24/365 ؂ࢹ

  24. શͯͷϦιʔεΛ։ൃʹ౤ೖʂ ։ൃཁһʂ ʢ50%૿ʣ Πϯϑϥ͸ ͓·͔ͤ

  25. 25 PaaSΛར༻͢ΔࣄͰ ͋ͳͨํͷϦιʔε಺Ͱͷ ։ൃ଎౓Λ࠷େݶʹ

  26. σϓϩΠͱϚΠάϨʔγϣϯ 26

  27. σϓϩΠͱϚΠάϨʔγϣϯ • ϫϯΫϦοΫσϓϩΠ ඪ४తͳΞϓϦέʔγϣϯΛϫϯΫϦοΫͰσϓϩΠ • ϚΠάϨʔγϣϯ σʔλϕʔεͷεΩʔϚ৘ใͷߋ৽ΛࣗಈԽ

  28. σϓϩΠ Gentoo Linux (EC2 Instance) ιʔείʔυ Gemfile rake db:migrate ઃఆϑΝΠϧੜ੒

    /data/{appname}/ releases/{datetime} ಛఆͷύεʹରͯ͠ ࣗಈσϓϩΠ
  29. ֤छϩάͷऔಘ 29

  30. ౷ܭ߲໨ cpu΍σΟεΫͳͲͷ ΦʔιυοΫεͳ؂ࢹ

  31. όοΫΞοϓͱεφοϓγϣοτ 31

  32. εέʔϧΞ΢τ • όοΫΞοϓ σʔλϕʔεͷσʔλͷμϯϓ • εφοϓγϣοτ σΟεΫͷ಺༰ͷશͯͷίϐʔ

  33. εφοϓγϣοτɾόοΫΞοϓ Gentoo Linux (EC2 Instance) EBS αʔόΛఀࢭ͢Δͱ ফ͑ΔྖҬ ೚ҙʗࣗಈͰόοΫΞοϓ࡞੒ /data

    /db ӬଓԽ͞ΕͨྖҬ (όοΫΞοϓͳͲ)
  34. Ϋϩʔϯ 34 ຊ൪؀ڥͷෳ੡Λ ඞཁͳ͚࣌ͩ࡞੒ʂ

  35. εέʔϧΞ΢τ 35

  36. εέʔϧΞ΢τ • ֤छαʔόʔΛ௥ՃՄೳ • ϩʔυόϥϯαʔ΁ͷొ࿥ͳͲ͸ࣗಈతʹߦΘΕΔ • ࣌ؒΛܾΊͯαʔόͷ૿ݮΛ͢ΔͳͲͷࣗಈԽ΋αϙʔ τ༧ఆ

  37. ௥Ճ͞ΕͨΠϯελϯεΛࣗಈͰෛՙ෼ࢄ 37 ϩʔυόϥϯα HA Proxy ϩʔυόϥϯα Elastic Load Balancing Availability

    Zone A Availability Zone B EC2 EC2 EC2
  38. Πϯελϯε΁ͷSSH 38

  39. ެ։伴ͷొ࿥ 39

  40. deploy ϢʔβͰͷSSH 40 sudo Ͱ͖·͢ʂ

  41. SSH ઀ଓͷ஫ҙ఺ • ΠϯελϯεΛఀࢭɾىಈ͢Δͱϗετ伴͕มΘΔ • sudo ͯ͠؀ڥʹมߋΛՃ͑ͯ΋ఀࢭɾىಈͰফࣦ • Root ͕औΕΔͱ͍͏ҙຯͰIaaSͱಉ༷ͷࣗ༝౓

    ஫ҙ IaaSͱͯ͠࢖͏ͱ ࣗಈԽͷԸܙ͕ແ͘ͳΔ
  42. CLI 42

  43. CLI ΫϥΠΞϯτ • ίϚϯυϥΠϯ͔ΒEngine Yard Cloud ʹΞΫηε • gem install

    engineyard • ey deploy σϓϩΠΛ࣮ߦ • ey rebuild ؀ڥͷ࠶ߏங • ey web disable / enable WebΞΫηεͷແޮԽɾ༗ޮԽ • ey recipes ΧελϜ Chef Ϩγϐͷ࣮ߦ ΞϓϦέʔγϣϯͷ ϧʔτͰ࣮ߦ͢Δ
  44. ChefʹΑΔ؀ڥͷΧελϚΠζ 44

  45. ύοέʔδߋ৽ • શͯͷߏங͸ChefͷϨγϐ • Կ౓Ͱ΋࠶ߏஙͳͷͰ࠷৽ͷϛ υϧ΢ΣΞΛਵ࣌ಋೖՄೳ • ΧελϚΠζ΋Ͱ͖Δ • Engine

    Yard͸ϛυϧ΢ΣΞͷ ݕূΛਵ࣌ߦͳ͍ͬͯ·͢ Amazon EC2 Cloud cookbook ΧελϜϨγϐ Your App ΞυΦϯ
  46. ChefͷΫοΫϒοΫͷྫ 46

  47. Chef Ϩγϐͷ࣮ߦ • https://github.com/engineyard/ey-cloud-recipes • ϑΥʔΫͨ͠ϧʔτɾσΟϨΫτϦͰίϚϯυ࣮ߦ ey recipies upload -e

    ENV ey recipes apply -e ENV • ΧελϜϨγϐ͸࠶ߏங࣌ʹ΋ࣗಈ࣮ߦ • ఀࢭɾ࠶։ͰࣦΘΕͳ͍ߏ੒มߋ͸શͯϨγϐͰߦ͏