Skip to content

Case file 40

GitHub's Rails upgrade: a year and a half without stopping the site

GitHub's main application ran on a Rails version years past its support. Instead of a long-running branch, the team made the app run on two versions of Rails at once and moved it across one minor version at a time.

Slide: one codebase running on Rails 3.2 and the next version side by side, stepping through 4.0, 4.1 and 4.2 to 5.2 over a year and a half with no downtime.

Not every Gen 2 is a rewrite. Sometimes the new generation is the same application on a new version of the framework under it, and the hard part is getting there while the site keeps shipping. GitHub's own account is unusually detailed.

Gen 1

Eileen Uchitelle's post describes the starting point: GitHub's main application was on Rails 3.2, and "the GitHub codebase is 10 years old." Old versions stop getting fixes. The post notes that GitHub had "been backporting security fixes to 3.2," doing for itself what the Rails team no longer did.

The scale ruled out the usual approach: "Since GitHub is so important to our community, we can't stop feature development or bug fixes in order to upgrade Rails."

The approach: run both versions

Instead of a long-running branch, the team made the app boot on two versions at once. "We created two Gemfile.lock's: one for the current version Gemfile.lock and one for the future version Gemfile_next.lock." Code that differed between versions was wrapped in checks such as if GitHub.rails_3_2?.

That made the upgrade a series of small, continuously merged changes rather than a branch that drifted for months: "The dual booting allows us to regularly deploy changes for the next version to GitHub without requiring long running branches or altering how production works." This is branch by abstraction applied to a framework.

One minor version at a time

"Each time we got a minor version of Rails green we'd make the CI job required for all pushes to the GitHub application and start work on the next version." Once a version passed, nobody could break it again. Only two versions were deployed: 4.2, "the first version of Rails that hadn't been EOL'd yet," and 5.2.

Rolling it out

Each release went through people first, then a slice of production. Volunteers from each team click-tested their areas, then "we deployed in off-hours to a percentage of production servers." The bar for finishing was concrete: "We merged the upgrade once we could deploy to full production for 30 minutes at peak traffic with no visible impact."

The result: "minimal customer impact and no down time." It was not painless: "we had issues with CI, local development, slow queries, and other problems that didn't show up in our CI builds or click testing."

How long, and why

"The Rails upgrade took a year and a half." The two halves were very different: "3.2 to 4.2 took 1 year, 4.2 to 5.2 only took 5 months." The post gives three reasons: some versions had major breaking changes, ten years of technical debt, and nobody knew at first what the work needed.

The team grew as it went. "The project originally began with 1 full-time engineer and a small army of volunteers. We grew that team to 4 full-time engineers plus the volunteers."

What came after

The real Gen 2 was the process. By 2023, Adam Hess wrote: "nearly every week one of those deploys is a Rails upgrade." An automated pull request each Monday moves the app to the newest commit on Rails' main branch. The next big upgrade never has to happen, because the small ones never stop.

What made it work

  • Two versions in one codebase, so every change shipped to production instead of waiting on a branch.
  • A ratchet: once a version's tests passed, they became required.
  • A staged rollout with a clear finish line: 30 minutes at peak with no visible impact.
  • Volunteers from every team, so knowledge of the new version spread instead of sitting with one group.

What to take from it

  • Upgrade in small steps, one version at a time. GitHub's own advice: "Upgrade early and upgrade often."
  • Do not let the framework fall years behind. The year from 3.2 to 4.2 was the price of waiting.
  • Keep the machinery after you finish. The dual-boot setup became a weekly habit.
  • A framework upgrade is a running two systems project inside one codebase, and needs the same discipline.

Sources

  1. Eileen M. Uchitelle - Upgrading GitHub from Rails 3.2 to 5.2 (GitHub Blog, September 28, 2018)
  2. Adam Hess - Building GitHub with Ruby and Rails (GitHub Blog, April 6, 2023) - the weekly upgrade to the newest Rails
  3. Ruby on Rails - Maintenance Policy - why old Rails versions stop getting security fixes
  4. Ruby on Rails - Upgrading Ruby on Rails guide - upgrading one version at a time

Last updated November 29, 2026.