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. We manage this with rbenv.
Setting up rbenv
We set up rbenv differently depending on what’s going on:
- Interactive login shells:
/etc/profile.d/rbenv.shsets up rbenv
.ruby-versionin the app directory set up rbenv
- Deployment: Capistrano uses a non -login shell so we set
- Testing: Jenkins uses a non-login shell so we add
- Cronjobs: some cronjobs start with
/bin/bash -l -cwhich runs a login shell
Add a new Ruby version in puppet
Build a package using fpm and make it available using our aptly repository.
The package name includes the version of Ruby (eg
we need to install multiple versions of Ruby at the same time.
Once it’s available as a package you can
install it everywhere using Puppet. Machines only runs
apt-get update periodically so it might take a little time for the package
to become available.
Testing whether a version of Ruby is in use
You can use the Fabric task
rbenv.version_in_use to find out which
applications are using a specific version of Ruby on GOV.UK. For example:
This page is owned by #2ndline and needs to be reviewed
fab production puppet_class:govuk_rbenv::all rbenv.version_in_use:2.3.1