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

Heroku101 Kanazawa

Heroku101 Kanazawa

Heroku101 for Kanazawa.rb #22

C43af8c5615e17a1d534b7fbfec46656?s=128

Keiko Oda

June 21, 2014
Tweet

Transcript

  1. Heroku 101 Keiko Oda (@keiko713) Technical Support Engineer Saturday, June

    21, 14
  2. About me ৫ాܟࢠʢ͓͚͍ͩ͜ʣ ੴ઒ݝۚ୔ࢢग़਎ ੴ઒ߴઐɹిࢠ৘ใ޻ֶՊଔ 2013೥4݄ɹHerokuೖࣾ ݱࡏ͸ۚ୔ͷ࣮ՈΑΓϦϞʔτۈ຿ Saturday, June 21,

    14
  3. Table of Contents Herokuͬͯʁ (20mins) Πϯετʔϧͯ͠ΈΑ͏ (10mins) σϞ (10mins) ΞϓϦΛσϓϩΠͯ͠ΈΑ͏

    (30mins) ΧελϚΠζͯ͠ΈΑ͏ (20mins) Saturday, June 21, 14
  4. What is Heroku? PaaS (Platform as a Service) Heroku༻ޠɹ ଟݴޠରԠ

    (Ruby, Java, Node.js, etc.) ๛෋ͳΞυΦϯ ࢝Ί΍͍͢ແྉ࿮ Saturday, June 21, 14
  5. Heroku ຊࣾɿΞϝϦΧɹαϯϑϥϯγεί ɹ2007 James, Adam, OrionʹΑͬͯઃཱ 2010 Salesforce.com͕ങऩ 2011 Matz͕͖ͨΑ

    Saturday, June 21, 14
  6. PaaS IaaS (Infrastracture as a Service) ࣗ෼ͰαʔόʔΛ༻ҙ͠ͳ͍͍ͯ͘ʂ SaaS (Software as

    a Service) ࣗ෼ͰΞϓϦΛ࡞Βͳ͍͍ͯ͘ʂ PaaS (Platform as a Service) ࣗ෼ͰαʔόʔͷηοτΞοϓ͠ͳ͍͍ͯ͘ʂ Saturday, June 21, 14
  7. Heroku terms dyno: Heroku্Ͱ૸ΔΠϯελϯεͷ୯Ґɻࣗ༝ ʹ૿΍ͨ͠ΓݮΒͨ͠Γग़དྷΔɻαΠζ͸ݱࡏ1X, 2X, PX͕͋Δ add-on: ΞϓϦʹ௥ՃͰ͖Δ֦ுػೳɻσʔλ ϕʔεͳͲ͕͋Δ

    buildpack: ΞϓϦΛσϓϩΠͨ࣌͠ʹ૸ΔεΫ Ϧϓτɻ͜͜ͰRubyͳͲΛΠϯελϯεʹೖΕΔ Saturday, June 21, 14
  8. Languages ੲ͸Ruby͚ͩͩͬͨ ࠓ͸ΦϑΟγϟϧʹ5ݴޠ+αରԠ Ruby, Java, Node.js, Python, PHP ΍͸ΓRuby͕ࠜڧ͍ਓؾ buildpackʹΑͬͯଞͷݴޠ΋ରԠՄೳ

    Saturday, June 21, 14
  9. Add-ons Data Stores (heroku postgres) Logging Email Caching Monitoring Saturday,

    June 21, 14
  10. Pricing 1ϲ݄౰ͨΓ750 dyno-hours͕ແྉʂ 24 h * 1 dyno * 30

    days = 720 dyno-hours ՝ۚ͸ඵ୯ҐʢΞυΦϯؚΉʣ ແྉ͔Β࢝ΊΒΕΔΞυΦϯ΋ͨͬ΀Γ ΞυΦϯΛར༻͍ͨ͠৔߹ͷΈΫϨδοτΧʔυͷొ࿥͕ඞཁ Saturday, June 21, 14
  11. Herokai Japan ·ͭ΋ͱ͞Μ ͳ͔ͩ͞Μ ͍͋͟Θ͞Μ ͩ͞͞͞Μ Herokuͷϓϩ ৭ʑ༏͘͠ڭ͑Δϓϩ ύον/σόοάͷϓϩ Ωʔϊʔτͷϓϩ

    Saturday, June 21, 14
  12. Let’s install! ֬ೝ1: Heroku toolbeltೖΕ·ͨ͠ʁ ֬ೝ2: Heroku Sign up͠·ͨ͠ʁ ֬ೝ3:

    Heroku CLIͰloginͯ͠Έ·ͨ͠ʁ ࣭໰1: طʹHerokuΛ࢖ͬͨ͜ͱ͕͋Δʁ ࣭໰2: GitΛ࢖ͬͨ͜ͱ͕͋Γ·͔͢ʁ Saturday, June 21, 14
  13. Saturday, June 21, 14

  14. Deploy app to Heroku 1. ΞϓϦΛGitHub͔Βམͱͯ͘͠Δ 2. ϩʔΧϧͰ૸ΒͤͯΈΔ 3. git

    push heroku master Saturday, June 21, 14
  15. Clone app from GitHub $ git clone https:/ /github.com/keiko713/rails- todo.git

    ࠓճ͸͋·Γ࣌ؒ΋ͳ͍ͷͰɺrails newͳ Ͳ͸ඈ͹͠·͢ Saturday, June 21, 14
  16. Run app locally $ cd rails-todo $ bundle install --without

    production $ foreman run bundle exec rake db:migrate $ foreman start http://localhost:5000/ Λ։͍ͯΞϓϦ͕ ಈ͍͍ͯΔ͔֬ೝ Saturday, June 21, 14
  17. Deploy $ heroku create # create an app $ git

    remote -v # who the list of remotes $ heroku rename <keiko-todo> # rename $ git push heroku master # deploy! $ heroku run rake db:migrate # db migrate $ heroku open # open the app in browser Saturday, June 21, 14
  18. Customize! 0. Add-onΛ௥Ճͯ͠ΈΔ 1. Unicornʹͯ͠ΈΔ 2. CSS΍JSͳͲΛมߋͯ͠ΈΔ 3. ޷͖ͳͱ͜ΖΛมߋͯ͠ΈΔ Saturday,

    June 21, 14
  19. Using add-ons HerokuͷΞυΦϯ͸ศརͳ΋ͷ͹͔Γ ࠓճ͸loggingͱmonitoringΛ௥Ճ Saturday, June 21, 14

  20. Using Unicorn https://devcenter.heroku.com/articles/ rails-unicorn υΩϡϝϯτʹԊͬͯ΍ͬͯΈΔ HerokuͰͷ։ൃϑϩʔ Change git add git

    commit git push Saturday, June 21, 14
  21. Modify CSS/JS ࠓͷσβΠϯ͸Πέͯͳ͍ͷͰม͑ͯΈΔ HerokuͰͷ։ൃϑϩʔ Change git add git commit git

    push Saturday, June 21, 14
  22. ͦͷଞ޷͖ͳॴΛมߋʂ Saturday, June 21, 14

  23. Thank you for using Heroku! Saturday, June 21, 14