Rails 7 upgrade

As promised in Path to Ruby 3.0, 3.1, EL9 and Ubuntu 22.04 - #44 by ekohl there would be a follow up project to upgrade from Rails 6.1 to Rails 7(.1).

The primary motivation is to remain up to date. Rails 6.1 will at some point be out of security support.

This RFC won’t go into detail how exactly we’ll solve things, because we partly don’t know. Instead, we’ll start with 3 major milestones that we need to achieve.

For background, Ruby & Rails Compatibility Table - FastRuby.io | Rails Upgrade Service has a nice list of version compatibility. Even Rails 7.1 still works with Ruby 2.7 (though 3.2 is recommended) so we don’t expect problems with the platforms we deploy on.

Convert the loader to Zeitwerk

This has been long known as something to resolve. Feature #29991: Enable Zeitwerk autoload mode for Rails 6+ - Foreman was opened almost 4 years ago and in the mean time work has been done. It must be resolved because the other way will be dropped.

This is aimed to land in Foreman 3.12. 3.11 will branch in less than a month and we don’t expect to resolve the outstanding issues in time, especially taking in mind that we need some time to stabilize things.

Upgrade to Rails 7.0

Previously a tracker was created for this: Tracker #34647: Rails 7.0 Tracker - Foreman

I already opened a PR that at least gets a basic version running (Rails 7 & Ruby 3.1 by ekohl · Pull Request #9328 · theforeman/foreman · GitHub) and have been using it to split off work that could already be merged. The main pain point was Zeitwerk.

One thing it doesn’t do (yet) is update the defaults to Rails 7.0 defaults. We’ll also need to update the packages. The official upgrading guide is a good starting point:

If all goes well, this could land quickly after Zeitwerk. Possibly in 3.12.

Upgrade to Rails 7.1

This is the latest version. I haven’t done a lot of research on how, but the official guide is, again, a good starting point.

Given the building on uncertainty, I don’t know when this will land.

Sidekiq 7

A big unknown is Sidekiq 7. We’re on 6 now, but it must be checked of this will continue to work with Rails 7. It could significantly increase the scope of this project.

1 Like

Quick first update.

While we opened a few PRs in the past, @ofedoren has submitted Fixes #29991 - Enable Zeitwerk by ofedoren · Pull Request #10131 · theforeman/foreman · GitHub which is our closest attempt to date. Still work in progress and plugins will likely need work as well.

To keep track, I just created a project. I also started to review open issues on Feature #29991: Enable Zeitwerk autoload mode for Rails 6+ - Foreman.