September 19th, 2024

We upgrade major Rails versions

Upgrading Ruby on Rails requires maintaining compatibility with current and next versions, updating dependencies, fixing tests, and conducting phased deployments to minimize risks and ensure a smooth transition.

Read original articleLink Icon
We upgrade major Rails versions

Upgrading major versions of Ruby on Rails is a complex and time-consuming process that involves multiple stages of development, testing, and deployment. The approach taken by the company includes maintaining compatibility with both the current and next versions of Rails simultaneously. This is achieved by using a secondary Gemfile, referred to as Gemfile.next, which allows the application to run with either version during the upgrade process. The upgrade begins with updating the Gemfile, ensuring all dependencies are resolved, and reviewing the Rails upgrade guide and release notes. The bulk of the work involves fixing tests to ensure compatibility with both versions, which can take weeks or months. Manual testing is also conducted with the Customer Success team before deployment. The deployment is executed in two phases: an initial rollout to a small subset of customers followed by a full rollout. Throughout the process, careful attention is paid to maintaining consistent gem versions and ensuring that any patches to core or third-party gems are updated accordingly. The company also emphasizes the importance of running tests against both versions in their CI pipeline to catch regressions early. This structured approach helps mitigate risks associated with major upgrades and ensures a smoother transition to the new Rails version.

- Upgrading Rails involves maintaining compatibility with both current and next versions.

- The process includes updating the Gemfile, fixing tests, and conducting manual testing.

- Deployment is done in two phases to minimize risks.

- Consistent gem versions are crucial to avoid issues during the upgrade.

- Running tests against both versions helps catch regressions early in the process.

Link Icon 2 comments
By @joshum97 - 4 months
This is a cool approach. Definitely better than an all-at-once cutover!

If only Ruby had better support for static typing though. Clearly infinite dynamism works for some folks and a lot of successful businesses, but I couldn't live without a type checker pointing me towards all of the places that need fixing. Kind of forces you to have comprehensive test coverage or you're screwed, which maybe isn't a bad thing.