$30 off During Our Annual Pro Sale. View Details »

The Achilles heel of a Rails developer: Upgrading Rails app.

The Achilles heel of a Rails developer: Upgrading Rails app.

These are the slides from the talk I gave at RubyConf, India 2022. The talk is about rails upgrades, best practises, and tools you can use to upgrade rails applications.

rishi jain

August 30, 2022
Tweet

More Decks by rishi jain

Other Decks in Programming

Transcript

  1. The Achilles heel of a Rails developer: Upgrading Rails app

    Rishi Jain @jainrishi15
  2. Ombulabs

  3. Remote work Distributed team Rails upgrades Software Consulting Performance Optimization

    Design Sprint FastRuby.io
  4. Rails Upgrade Why?

  5. Rails Upgrade – Why? •Security fixes

  6. Security Fixes

  7. Rails Upgrade – Why? •Security Fixes •New Features

  8. New Features Active Storage in Rails 5.2 Action Mailbox in

    Rails 6.0
  9. Rails Upgrade – Why? •Security Fixes •New Features •Bug Fixessssss

  10. Rails Upgrade – Why? •Security Fixes •New Features •Bug Fixessssss

    •Ruby Upgrade
  11. Ruby Upgrades •Performance Improvements •New features

  12. Ruby Upgrades Ruby 3.0 introduced performance boost and better concurrency.

  13. Rails Upgrade – Why? •Security Fixes •New Features •Bug Fixessssss

    •Ruby Upgrade •Small upgrade
  14. Small Upgrade Rails 5 to 6 >>>>>> Rails 3 to

    6
  15. Rails Upgrade Should you?

  16. Should you upgrade your app? Depends!

  17. None
  18. Rails Upgrade What makes an app ready for upgrade?

  19. Ready for Rails Upgrade? Test suite

  20. Ready for Rails Upgrade? Code Coverage

  21. Ready for Rails Upgrade? CI Solution

  22. Ready for Rails Upgrade? Priority

  23. Priority Secondary task

  24. Priority Long running upgrade branch

  25. None
  26. Rails Upgrade How do you start the upgrade?

  27. Rails Upgrade – The Process •Version Jump

  28. Version Jump •One major jump at a time •One minor

    jump at a time Ex: current rails version: 5.2.6 next jump: latest patch of the current rails version i.e 5.2.8 next major jump & latest patch of it i.e 6.0.5 next minor jump & latest patch of it i.e 6.1.6
  29. Rails Upgrade – The Process •Version Jump •Git flow

  30. Git flow •No one way •Depends on your team

  31. Git flow Main branch Upgrade branch rails_6_0

  32. Git flow Upgrade branch rails_6_0 rails6_0_issue1 rails6_0_issue2 rails6_0_issue3

  33. Rails Upgrade – The Process •Version Jump •Git flow •Dual

    boot
  34. Dual Boot •What? Ability to run 2 different versions of

    the rails app with 1 common code base
  35. None
  36. Dual Boot •Why? •Run rspecs •Configure CI •Simple Git Conflicts

  37. Dual Boot •How? Gem: next_rails

  38. None
  39. next_rails Gemfile Gemfile.next Gemfile.lock Gemfile.next.lock symlinked

  40. next_rails •Helpers to write conditional code •Command line options to

    run specs and more •Deprecation tracking •Incompatibility report
  41. next_rails Helper methods and command line options <Insert snippet of

    next in Gemfile>
  42. next_rails Helper methods and command line options <Insert snippet of

    next on command line using next rails c, next rspec>
  43. Rails Upgrade – The Process •Version Jump •Git flow •Dual

    boot •Incompatible gems
  44. Incompabilities •What? List all of the gems that will not

    work with your target rails version.
  45. Incompabilities •How?

  46. Incompabilities next_rails provides a command line option bundle_report compatibility --rails-version=6.0.0

  47. Incompabilities gems with versions compatible with target rails versions

  48. Incompabilities gems with newer versions but not compatible with target

    rails versions
  49. Incompabilities gems with no new versions & not compatible with

    target rails versions
  50. Rails Upgrade – The Process •Version Jump •Git flow •Dual

    boot •Incompatible gems •Backward compatible changes
  51. Backward Compatible changes What?

  52. Backward Compatible changes <insert a snippet of a backward compatible

    change >
  53. Backward Compatible changes Why?

  54. Backward Compatible changes How?

  55. Backward Compatible changes Main branch Upgrade branch rails_6_0 backward-comp atible-pr1

    backward-comp atible-pr2 backward-comp atible-pr3
  56. Rails Upgrade – The Process •Version Jump •Git flow •Dual

    boot •Incompatible gems •Backward compatible changes •Deprecation Warnings
  57. Deprecation Warnings What?

  58. Deprecation Warnings < insert a snippet of a deprecation warnings

    >
  59. Deprecation Warnings Where?

  60. Deprecation Warnings – where to find them? Starts with ”DEPRECATION

    WARNING:”
  61. Deprecation Warnings – where to find them? Monitoring tool

  62. Deprecation Warnings How?

  63. Deprecation Warnings < insert a snippet of a deprecation warnings

    >
  64. Deprecation Warnings – how to fix them? < insert snippet

    of a fix of deprecation change >
  65. Deprecation Warnings How?

  66. Deprecation Warnings – how to make sure it does not

    happen again?
  67. Rails Upgrade – The Process •Version Jump •Git flow •Dual

    boot •Incompatible gems •Backward compatible changes •Deprecation Warnings •Other changes
  68. Other changes Rails official upgrade guides https://edgeguides.rubyonrails.org/upgrading_ruby_on_rails.html

  69. Rails Upgrade – The Process •Version Jump •Git flow •Dual

    boot •Incompatible gems •Backward compatible changes •Deprecation Warnings •Other changes •Testing
  70. Rails Upgrade – Testing •Run test suite •File bugs •Fix

    bugs •Run test suite
  71. Rails Upgrade – The Process •Version Jump •Git flow •Dual

    boot •Incompatible gems •Backward compatible changes •Deprecation Warnings •Other changes •Testing •Deployment & Observation
  72. Rails Upgrade – Deployment and Observation

  73. Rails Upgrade – Bugs on production & Rollback Choose your

    path carefully!
  74. None
  75. Contact Reach me at: Twitter @jainrishi15 Want us to upgrade

    your app: Twitter @ombulabs