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

レガシーRailsアプリとの付き合い方について考える

Yusaku ONO
November 17, 2017

 レガシーRailsアプリとの付き合い方について考える

2018/11/17 万葉社内で発表した資料です

Yusaku ONO

November 17, 2017
Tweet

More Decks by Yusaku ONO

Other Decks in Technology

Transcript

  1. Rails ͷΠϯετʔϧํ๏ • όʔδϣϯ͕໌ه͞Εͯͳ͍৔߹ʹಛఆ͢ΔࡐྉʹͳΔ • bundle install • gem install

    rails • apt-get install rails ʢDebian ܥݶఆʣ • apt ܦ༝ͰΠϯετʔϧ͢Δͱ gem list ʹݱΕͳ͍ • gem list ʹݱΕͳ͍ͷʹ rails ίϚϯυ͕ଘࡏ͢Δ৔߹͸͜ ΕΛٙͬͯΈΔ
  2. ͪͳΈʹ apt-get ͱ͸ • Debianܥͷ OS ʹ౥ࡌ͞Ε͍ͯΔύοέʔδ
 Ϛωʔδϟʔ • CentOS

    Ͱݴ͏ͱ͜Ζͷ yum • ྫ: apt-get install postgresql • աڈͷ apt Ͱ͸ rails ͳͲͷ gem ͕ύοέʔδͱͯ͠ ఏڙ͞Ε͍ͯͨ
  3. Ruby ͷΠϯετʔϧํ๏ • γεςϜΠϯετʔϧ (apt, yumʣ • جຊతʹݹ͍ʢྫ: CentOS6 =>

    1.8.7ʣ • ࣮֬ʹϏϧυͰ͖ΔͷͰ҆৺ • rbenv • σϑΝΫτʁ • Ϗϧυ͢ΔͷʹҰ޻෉͍Δ৔߹΋͋Δ • Cron ܦ༝Ͱಈ͔͢ͱ͖ʹҰۤ࿑ • rvm • ͋·Γ࢖ΘΕͳ͘ͳͬͨ • ϏϧυͰ͖ΔΑ͏ʹσϑΥϧτͰύονΛ͋ͯͯ͘ΕΔ৔߹͋Γ
  4. σʔλϕʔε • PostgreSQL / MySQL ͩͱخ͍͠ • ͨ·ʹ SQL Server

    ͱ͔͋Γ·͢ • ΫϥαόͰ࢖ΘΕ͍ͯΔDBʢSQL ServerʣΛࢀর͢ΔΑ͏ͳέʔε • ΋ͪΖΜDBͷόʔδϣϯ΋ॏཁͰ͢ • όʔδϣϯʹΑͬͯΫΤϦͷৼΔ෣͍͕มΘΔέʔε͕͋Δ • SQL΂ͨॻ͖ͯ͠ΔΑ͏ͳ৔߹ʹҾ͔͔ͬΓ͕ͪ
  5. Webαʔόʔ / ΞϓϦέʔγϣϯαʔόʔ • Webαʔόʔ • Apache / nginx •

    ΞϓϦέʔγϣϯαʔόʔ • mongrel / Passenger / unicorn • Webαʔόʔ࢖Θͣ௚઀ΞϓϦέʔγϣϯαʔόʔͰ
 ड͚Δέʔε΋
  6. ಈ࡞OS • CentOS • Debian / Ubuntu • كʹ Windows

    • Bitnami Redmine ͱ͍͏ Window ༻ͷ Redmine Πϯετʔϥ͕ఏڙ͞Ε͍ͯΔ
  7. ֎෦ͱͷ࿈ܞ • ଞͷ Rails ΞϓϦͱ࿈ܞ • ActiveResource ( 4.0 Ͱݸผ

    gem ʹͳͬͨʣ • ActionWebService (1ܥݶఆ) • Web API ܦ༝Ͱଞͷ Web ΞϓϦͱ࿈ܞ • DB Λ௚઀ࢀরʢ͢Δ/͞ΕΔέʔε྆ํ͋Γ͏Δʣ • αʔόʔ಺Λௐࠪ͢Δ͚ͩͰ͸ݟ͚͖ͭΕͳ͍ʢಛʹࢀর͞ΕΔ৔߹ʣ
  8. Rails 2 → 3.0 • ҙ֎ͱͳΜͱ͔ͳΔҹ৅ • rails_upgrade plugin Λ࢖͏ͱมߋ͕ඞཁͳ


    ՕॴΛચ͍ग़ͯ͘͠ΕΔ • https://github.com/rails/rails_upgrade
  9. Rails 3.0 → 3.2 • ݸਓతʹ͸Ұ൪ͭΒ͍ • assets pipeline… •

    CSS, ը૾ೖΓͷڊେͳ JavaScript ϥΠϒϥϦΛಋೖ͍ͯ͠Δͱ ٧Έ΍͍͢ʢ٧Μͩʣ • prototype.js ༻ͷϔϧύʔϝιου͕ফ͑Δ • ࠷ऴखஈ: https://github.com/rails/prototype_legacy_helper
  10. Rails 3.2 → 4 • vendor/plugins → Bundler • Bundler

    ಋೖલͷ rails ͸ vendor/plugins ҎԼʹ plugin ͷιʔείʔυΛ഑ஔ͢ΔܗࣜΛऔͬͯ ͍ͨ • ΞϓϦͷϦϙδτϦʹ֤ plugin ͷιʔείʔυ Λ߹Θͤͯίϛοτ͍ͯͨ͠
  11. Rails 3.2 → 4 • plugin ͷιʔείʔυΛϦϙδτϦʹؚΊΔ͜ͱͰԿ ͕ى͜Δ͔ • plugin

    ࣗମʹखΛՃ͍͑ͯͯ΋ؾ͖ͮʹ͍͘ • ޓ׵ੑͷ͋Δ࠷৽൛ͷ gem ʹஔ͖׵͑ͯ΋ಈ͔ͳ͍ • όʔδϣχϯά͕͔ͬ͠Γ͍ͯ͠Δ pluginͰͳ͍ͱ
 Ͳͷόʔδϣϯ͕࢖ΘΕ͍ͯΔ͔೺Ѳ͢Δͷ͕େม