Last week, GitHub announced that their main application is now running on Rails 5.2.1. Along with this upgrade, they have also improved the overall codebase and cleaned up technical debt.
The upgrade started out as a hobby with no dedicated team assigned. As they made progress and gained traction it became a priority.
They added the ability to dual boot the application in multiple versions of Rails, instead of using a long running branch to upgrade Rails.
Two Gemfile.lock were created:
This dual booting enabled the developers to regularly deploy changes for the next version to GitHub without any affect on how production works. This was done by conditionally loading the code:
if GitHub.rails_3_2?
## 3.2 code (i.e. production a year and a half ago)
elsif GitHub.rails_4_2?
# 4.2 code
else
# all 5.0+ future code, ensuring we never accidentally
# fall back into an old version going forward
end
To roll out the Rails upgrade they followed a careful and iterative process:
This process allowed them to deploy 4.2 and 5.2 with minimal customer impact and no down time.
Upgrading will be easier if you are closer to a new version of Rails. This also encourages your team to fix bugs in Rails instead of monkey-patching the application.
Needless to say, there will always be a new version to upgrade to. To keep up with the new versions, add a build to run against the master branch to catch bugs in Rails and in your application early. This make upgrades easier and increase your upstream contributions.
Technical debt refers to the additional rework you and your team have to do because of choosing an easy solution now instead of using a better approach that would take longer.
Refraining from messing with a working code could cause a bottleneck for upgrades. To avoid this try to prevent coupling your application logic too closely to your framework. The line where your application logic ends and your framework begins should be clear.
Upgrading a large and trafficked application like GitHub is not easy. They did face issues with CI, local development, slow queries, and other problems that didn’t show up in their CI builds or click testing.
Read the full announcement on GitHub Engineering blog.
GitHub introduces ‘Experiments’, a platform to share live demos of their research projects
GitLab raises $100 million, Alphabet backs it to surpass Microsoft’s GitHub
Packt’s GitHub portal hits 2,000 repositories