Building GitHub with Ruby and Rails

Since the beginning, GitHub.com has been a Ruby on Rails monolith. Today, the application is nearly two million lines of code and more than 1,000 engineers collaborate on it daily.…

Adam Hess
6 min readadvanced
--
View Original

Overview

The article discusses GitHub's approach to building and maintaining its platform using Ruby on Rails, highlighting their weekly upgrade process for both Rails and Ruby. It emphasizes the benefits of staying updated with the latest versions, including improved performance, security, and collaboration with the Ruby community.

What You'll Learn

1

How to implement a weekly upgrade process for Rails

2

Why maintaining up-to-date dependencies improves security posture

3

How to test Ruby changes in a production environment before release

Prerequisites & Requirements

  • Understanding of Ruby on Rails and its upgrade processes
  • Experience with continuous integration and deployment practices(optional)

Key Questions Answered

How does GitHub upgrade Rails weekly?
GitHub utilizes a scheduled GitHub Action workflow that triggers an automated pull request every Monday to upgrade Rails to the latest version. This process allows them to run builds on the new version, ensuring compatibility and enabling a quick review and deployment of changes.
What benefits does GitHub gain from upgrading Rails frequently?
By upgrading Rails weekly, GitHub provides developers with the latest tools, removes the need for patches, simplifies collaboration, enhances security, and avoids large migrations. This strategy allows for easier debugging and contributes to a stronger engineering team.
What is the process for testing Ruby upgrades at GitHub?
GitHub builds and tests Ruby shas from the latest version in a parallel build environment. This dual testing approach ensures compatibility with upcoming Ruby versions and allows for early identification of potential issues before the official release.
Why is it important to invest in Rails as a framework?
Investing in Rails ensures that the framework remains robust and capable of supporting the application as it scales. Treating Rails as an integral part of the application leads to better resilience and stability, which is crucial for long-term success.

Key Statistics & Figures

Lines of code in GitHub application
nearly two million
This highlights the scale and complexity of maintaining such a large codebase.
Number of engineers collaborating on GitHub daily
more than 1,000
This indicates the collaborative nature of the development process at GitHub.
Number of deploys per day
up to 20 times
Frequent deployments demonstrate GitHub's commitment to continuous delivery and rapid iteration.

Technologies & Tools

Some links below are affiliate links. We may earn a commission if you make a purchase.

Key Actionable Insights

1
Implement a weekly upgrade schedule for Rails to keep your application current and secure.
Regular upgrades allow teams to leverage the latest features and improvements, reducing the risk of security vulnerabilities and technical debt.
2
Utilize continuous integration to test new Ruby versions in parallel with your production version.
This practice helps identify compatibility issues early, ensuring a smoother upgrade process and enhancing the overall stability of your application.
3
Engage with the Ruby community to contribute back patches and improvements.
By collaborating with the community, you not only enhance your own application but also help improve the framework for everyone, fostering a stronger ecosystem.

Common Pitfalls

1
Neglecting regular upgrades can lead to significant technical debt and compatibility issues.
Without a consistent upgrade strategy, teams may face overwhelming challenges when trying to migrate to newer versions, resulting in lengthy downtimes and increased risk of bugs.

Related Concepts

Continuous Integration And Deployment Practices
Ruby And Rails Upgrade Strategies
Collaboration With Open-source Communities