Skip to main content
Warning This document has not been updated for a while now. It may be out of date.
Last updated: 8 Dec 2023

Add a new Ruby version

The Ruby language is a core part of GOV.UK - most of our applications are written in it.

Managing different versions of Ruby

Each app can use whatever version of Ruby it wants. For development purposes we manage this locally with rbenv, and when apps are deployed they are built with a container that uses the requested version.

Setting up rbenv

We set up rbenv differently depending on what’s going on:

  • Interactive login shells: /etc/profile.d/rbenv.sh sets up rbenv
  • Applications: govuk_setenv and a .ruby-version in the app directory set up rbenv

Updating the Ruby version in apps

Automatically raising PRs

We use bulk-changer to automatically raise pull requests in GOV.UK repositories to update Ruby applications. Please note, we manage the Ruby version in gems differently to applications.

For applications, you will usually need to change the ruby version in two places - in .ruby-version (which is used by rbenv), and in Dockerfile (which is used during deployment)

Manually raising a PR

You can also create your own branch, update the two files as above, and raise a PR.

Updating individual applications

For each application a PR is raised for (either manually or via bulk-changer), you should test the changes before merge, as follows:

  1. Most apps will run a test suite through CI. You should check the output of this for any Ruby deprecation warnings. If there are any warnings, they should be fixed.
  2. Next, you should deploy the updated branch of the app to Integration, and manually test its features to ensure that the new Ruby version hasn’t broken the app.
  3. It’s worth checking the logs for deprecation warnings at this point (and fixing them), in case there are warnings that weren’t flagged by the test suite run.
  4. Next, check our monitoring tools
    1. Grafana: Visit Grafana Integration, Select General/App: request rates, errors, durations, then choose your app from the apps dropdown.
    2. Sentry: Visit Sentry Projects, choose your app, then use the All Envs drop down to select Integration EKS
  5. The PR should be safe to merge.