Skip to content

Ruby Update

Henne Vogelsang edited this page Mar 10, 2022 · 12 revisions

Ruby Update

How to make a Ruby version update happening.

⚠️⚠️⚠️ Exchanging the Ruby version is a pretty disruptive change. Make sure people are aware before you disrupt their workday ⚠️⚠️⚠️

Packaging

Ruby Interpreter Package in OBS:Server:Unstable

  • Create a link to the ruby package you want to use from devel:languages:ruby
  • Make sure it builds at least for the distribution we use on production

Project Configuration in OBS:Server:Unstable

There is a ruby configuration section at the bottom of the prjconf. It defines which ruby version the rubygem packages in O:S:U are built for. We only ever build things for one ruby version.

  • Adopt all the versioned macros
  • rebuild of the rubygem packages, make sure they succeed

Code

Interpreter location

Find (grep -Hril ruby.ruby2.5) and replace all interpreter locations you find for the old version with the new version.

Development Environment

Install the new ruby interpreter in your dev-env and try to boot the app. Fix any problems...

docker-compose run --rm --service-ports frontend /bin/bash -l
...
frontend@4757397d3caa:/obs/src/api> sudo zypper rm '*ruby*'
...
frontend@4757397d3caa:/obs/src/api> sudo zypper in ruby4.0-devel
...
frontend@4757397d3caa:/obs/src/api> bundle.ruby3.1 -v # Set this in Gemfile.lock "BUNDLED WITH"
...
frontend@4757397d3caa:/obs/src/api> bundle.ruby3.1 install
...
frontend@4757397d3caa:/obs/src/api> bundle.ruby.ruby3.1 exec rspec
...

Fix what needs to be fixed.

CI Cycle

Once you are reasonably sure you have a working code base again:

  • adopt the frontend container to use/setup the new Ruby interpreter version.
  • send all your code changes from above as PR and get it merged, the CI will use the adopted container

Deployment

Now comes the tricky part...

OBS packages

Adopt the Ruby interpreter version in

  • dist/obs-server.spec
  • dist/obs-bundled-gems.spec

and make them build.

build-test.opensuse.org

Once obs-api is building, our test instance will automatically install it.

You need to adopt some files:

  • Update the ruby version in /etc/apache2/conf.d/mod_passenger.conf
  • Update the ruby version in /root/.bashrc

Once this works, move on to production.

Productions

Repeat what you had to do on the test instance and deploy everything. Good luck!

Clone this wiki locally