Upgrading Rails
while the wheels are turning 😓
👋🏼
Onfido's core

In the Beginning, there was the Monolith


Why upgrade

Rails 3 (August 2010)
Ruby 2.2 (Dec 25, 2014)
Rails 5.2 (March 2018)
Ruby 2.6 (December 2018)
Targets
Essentials
- Trust (loose roadmap)
- Autonomy (almost no meetings)
- Company-wide engagement (essential)
Code keeps coming


Old code is hard

Old code is hard

can be :pending 🤔
Upgrade process
CI helps

How do I start?
Step 1 - install a Ruby version manager

Rails 3 - Ruby 2.2.10
Rails 4 - Ruby 2.3.8
Rails 5 - Ruby 2.6.4
Step 2 - tweak Gemfile and Dockerfile





Step 3 - comment out everything except Rails, run bundle

Step 4 - start uncommenting gems (one by one), run bundle


this will take a while...
Step 5 - bundle fixed? run the first build

Step 6 - fix the build

Step 7 - repeat for the other components

Useful things
Version differences

Version differences


Testing differences
Factory{Girl,Bot}


Old gems
declarative_authorization (last commit 2013)

Old gems
symbolize (last commit 2014)

Issues along the way
Rails 3 and 4 lookup constants differently
Rails 3 and 4 routing DSL changes
Some gem updates need Ruby 2.3+ (Devise) 😢
Same-y tests are a problem
Parallel tests hiding issues
Specs relying on global state / not cleaning up
Assets pipeline is a bummer
Current status
Rails 4: 100%
Rails 5: 15%
The Future
Maybe go for Rails 6?
🔑 takeaways
Ruby's flexible

Old code is hard

Harder for a team of 1

frequent breaks help 🤯
Occasionally lots of fun

Company engagement

Constant struggle

Questions?
Upgrading Rails While The Wheels Are Turning (public)
By Bruno Antunes
Upgrading Rails While The Wheels Are Turning (public)
- 25