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

Starting MOGOK - やさしい MOGOK の始めかた -

Starting MOGOK - やさしい MOGOK の始めかた -

IIJ の Ruby on Rails 向け PaaS である MOGOK の使い方。
Kanazawa.rb #6 (2013/02/16) の発表資料。

Tomokazu Kiyohara

February 16, 2013
Tweet

More Decks by Tomokazu Kiyohara

Other Decks in Technology

Transcript

  1. MOGOK ✤ IIJ (Internet Initiative Japan) ͕ఏڙ͢Δ ✤ Ruby on

    Rails ΞϓϦέʔγϣϯͷ ✤ ։ൃࢧԉ؀ڥͱ࣮ߦ؀ڥΛ ✤ ఏڙ͢ΔαʔϏε PaaS (Platform as a Service)
  2. MOGOK ✤ IIJ (Internet Initiative Japan) ͕ఏڙ͢Δ ✤ Ruby on

    Rails ΞϓϦέʔγϣϯͷ ✤ ։ൃࢧԉ؀ڥͱ࣮ߦ؀ڥΛ ✤ ఏڙ͢ΔαʔϏε PaaS (Platform as a Service) !ఏڙ : ࠓ͸͢΂ͯແঈ
  3. MOGOK ʢ࣮ߦ؀ڥʣ ✤ Web ✤ 1 process ✤ 400MB memory

    ✤ 150MB file (w/ gems) ✤ Thin/Ruby 1.9.3/RoR 3.x ✤ *.ruby.iijgio.com ✤ DB ✤ 1 connection ✤ 100MB memory ✤ 100MB data ✤ MySQL 5.5
  4. MOGOK ʢ࣮ߦ؀ڥʣ ✤ Web ✤ 1 process ✤ 400MB memory

    ✤ 150MB file (w/ gems) ✤ Thin/Ruby 1.9.3/RoR 3.x ✤ *.ruby.iijgio.com ✤ DB ✤ 1 connection ✤ 100MB memory ✤ 100MB data ✤ MySQL 5.5 ͍ͣΕ͸༗ঈϓϥϯ΋
  5. Flow ✤ Git ͷಋೖ ✤ RoR ΞϓϦέʔγϣϯͷίϯϑΟάมߋ ✤ MOGOK CLI

    ͷΠϯετʔϧ ✤ MOGOK ΁ͷσϓϩΠ ✤ ΞϓϦέʔγϣϯ؅ཧ
  6. Flow ✤ Git ͷಋೖ ✤ RoR ΞϓϦέʔγϣϯͷίϯϑΟάมߋ ✤ MOGOK CLI

    ͷΠϯετʔϧ ✤ MOGOK ΁ͷσϓϩΠ ✤ ΞϓϦέʔγϣϯ؅ཧ
  7. Git ͷಋೖ $ cd <your RoR app dir> $ git

    init $ git add . $ git commit -m "first commit"
  8. Flow ✤ Git ͷಋೖ ✤ RoR ΞϓϦέʔγϣϯͷίϯϑΟάมߋ ✤ MOGOK CLI

    ͷΠϯετʔϧ ✤ MOGOK ΁ͷσϓϩΠ ✤ ΞϓϦέʔγϣϯ؅ཧ
  9. Bundler : gem 'mysql2' gem 'therubyracer', :platforms => :ruby $

    vim Gemfile ✤ MOGOK ؀ڥͰඞཁͱͳΔ gem Λઃఆ
  10. Env $ vim config/environments/production.rb : config.serve_static_assets = true : ✤

    /public/* ౳ͷ static ίϯςϯπΛ༗ޮԽ ✤ (͓ͦΒ͘)͋Β͔͡Ί false ઃఆ͕͋ΔͷͰ true ʹมߋ
  11. Flow ✤ Git ͷಋೖ ✤ RoR ΞϓϦέʔγϣϯͷίϯϑΟάมߋ ✤ MOGOK CLI

    ͷΠϯετʔϧ ✤ MOGOK ΁ͷσϓϩΠ ✤ ΞϓϦέʔγϣϯ؅ཧ
  12. MOGOK CLI ͷΠϯετʔϧ ✤ gem ϑΝΠϧͷΠϯετʔϧ $ gem install mogok-x.x.x.gem

    $ mogok list $ mogok --help ✤ MOGOK ΞΧ΢ϯτͷ "ID/Password" ͕ٻΊΒΕΔ ✤ ࠷ॳͷ1ճͷΈ
  13. Flow ✤ Git ͷಋೖ ✤ RoR ΞϓϦέʔγϣϯͷίϯϑΟάมߋ ✤ MOGOK CLI

    ͷΠϯετʔϧ ✤ MOGOK ΁ͷσϓϩΠ ✤ ΞϓϦέʔγϣϯ؅ཧ
  14. ΞϓϦέʔγϣϯొ࿥ $ mogok create <app name> ✤ RoR app dir

    Ͱ࣮ߦ͢Δ͜ͱΛڧ͘ਪ঑ ✤ Git remote ʹ MOGOK ؀ڥ͕ొ࿥͞ΕΔ ※ MOGOK CLI ͸͜ͷ஋Λࢀর͠ͳ͕Βಈ࡞͢Δ(--app option ΋͋Δ͕͔ͳΓ໘౗) ✤ <app name> ͸ MOGOKγεςϜશମͰҰҙ ✤ <app name>.ruby.iijgio.com
  15. ࢿࡐͷసૹ $ git push mogok master ✤ MOGOK ΞΧ΢ϯτͷ "ID/Password"

    ͕ٻΊΒΕΔ ✤ ຖճೖྗ͕ඞཁ ✤ "$ git config credential.helper store" ͓ͯ͘͠ͱָ ✤ "~/.git-credentials" ʹอଘ͞ΕΔͷͰѻ͍ʹ͸஫ҙ tips
  16. Flow ✤ Git ͷಋೖ ✤ RoR ΞϓϦέʔγϣϯͷίϯϑΟάมߋ ✤ MOGOK CLI

    ͷΠϯετʔϧ ✤ MOGOK ΁ͷσϓϩΠ ✤ ΞϓϦέʔγϣϯ؅ཧ
  17. ΞϓϦέʔγϣϯ؅ཧ $ mogok info $ mogok start $ mogok stop

    $ mogok restart ✤ MOGOK CLI ͔Βͷૢ࡞
  18. ·ͱΊ ✤ Ruby on Rails ͳ PaaS ✤ !൛͕ͩແྉͰ͔ͳΓͷػೳ͕࢖͑Δ ✤

    Git & mogok ίϚϯυͰσϓϩΠ ✤ mogok ίϚϯυ or Web UI Ͱίϯτϩʔϧ
  19. group :mogok do gem 'mysql2' gem 'therubyracer', :platforms => :ruby

    end $ vim Gemfile ✤ MOGOK ؀ڥ޲͚ gem Λ group Խ Bundler tips
  20. ✤ "$mogok build" ͨ͠Β ✤ "$ mogok restart" →× ✤

    "$ mogok stop; mogok start" →◦ build & restart tips